开发者

How to check where Apache is looking for a php.ini file?

I have a feeling that Apache is using a different php.ini file that the one I am ed开发者_StackOverflow中文版iting. I make a change in my php.ini file, restart Apache, and the change doesn't take affect. So I don't know what to do anymore.

Any ideas?

Update: Found out it's using the right php.ini file...but I still don't know what to do!


To find the file that's being run by PHP, create a phpinfo file (just <?php phpinfo();?>) and look for the 'Configuration File (php.ini) Path' directive.


from the command line, run

php -i |grep "php.ini" 

This will describe the location php is loading its ini file from. You can reconfigure the php.ini location by recompiling php.


The output from phpinfo() will contain this. When using PHP as an Apache module, it can be configured using PHPIniDir in httpd.conf (or similar).


To get the php.ini file which is being used by Apache you will probably have to add phpinfo() into a .php file and open it in the browser. As php -r "phpinfo();" | grep php.ini will outout the same as php --ini would. Which php.ini is used for the CLI.


Question for you, what platform are you running on unix or windows? If it is unix based, check if your php.ini is residing in the same directory as /etc/httpd. Again, installation of apache can vary so check...or issue the command "find / -name php.ini -print" (without quotes) to see which one is it you are using

Ok. Since you said you have found the correct php.ini, sounds like something is missing when you edited the php.ini and reloaded apache. Look in the log directory /var/log/httpd for error_log and check to see if there was errors...that would be a start!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜