开发者

How can i create an ultimate script to test the new server environment?

开发者 https://www.devze.com 2023-01-29 11:50 出处:网络
My workspace is kind of unstable at the moment, and I constantly find myself migrating all my projects from one server to another, to my PC using XAMPP, to another server and so on and so forth.

My workspace is kind of unstable at the moment, and I constantly find myself migrating all my projects from one server to another, to my PC using XAMPP, to another server and so on and so forth.

The issue is that at each of these moves, nothing works as it should. My projects all use a config file that contains the full path of the project as well as some other path relate开发者_开发问答d variables. This has eased the transition process considerably.

However there are also often environmental problems, for instance when AllowOverride is set to Deny instead of All. I would like to create a PHP script to test config settings of the current server, and check for f.inst. AllowOverride.

Can this be done?


<?php phpinfo(); ?> -> gives you php settings of the server

<?php print_r(apache_get_modules()); ?> -> Gives a list of loaded Apache modules.

Array ( [0] => core 1 => http_core [2] => mod_so [3] => sapi_apache2 [4] => mod_mime [5] => mod_rewrite )

And then there is this script that checks if mod_rewrite is enabled by testing two urls. I think you can modify it to check other similar settings.


like he said above, you can use phpinfo() to see what the settings differences are.

like you did with paths, figure out what settings are breaking your scripts when you switch servers, and simply set it to a consistent setting in a config file so that it does not break when you move it. if you are using different versions of PHP on each server, there may be differences that cannot be set with a config file, such as using functions that do not exist in earlier versions. in that case I recommend upgrading the older versions if possible, or at least making your dev and production versions match.

see http://php.net/manual/en/configuration.php for further details on using config files and other methods to set PHP settings. in PHP 5 you can set config settings per directory using a simple .htaccess file that you can move along with the rest of your project.

0

精彩评论

暂无评论...
验证码 换一张
取 消