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

后端 未结 5 1109
清酒与你
清酒与你 2020-12-05 22:26

I have a feeling that Apache is using a different php.ini file that the one I am editing. I make a change in my php.ini file, restart Apache, and the change doesn\'t take af

相关标签:
5条回答
  • 2020-12-05 23:11

    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.

    0 讨论(0)
  • 2020-12-05 23:15

    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).

    0 讨论(0)
  • 2020-12-05 23:20

    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.

    0 讨论(0)
  • 2020-12-05 23:26

    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 讨论(0)
  • 2020-12-05 23:27

    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.

    0 讨论(0)
提交回复
热议问题