Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP 4 won't take PHP.ini changes after Apache restart

Tags:

php

php4

We have a very old PHP application that needs PHP 4 to run. We're decommissioning the old server and so I've built PHP 4 on the new server (Ubuntu 13.04 32 bit). When I did ./configure I made sure to do --with-config-file-path=/etc/php4/php.ini. I'm trying to enable error logging, but my changes to the php.ini don't seem to be taking hold.

Yes, the file exists and is owned by the Apache user

nick@server:/etc/php4$ ls
php.ini

Yes, I restarted Apache. And yes, it shows up in the phpinfo():

Configuration File (php.ini) Path   /etc/php4/php.ini

Does the --with-config-file-path only take hold at compilation time and thus in order to make changes I have to recompile? Or does it work the same as newer versions of PHP?

For example, in the php.ini I've turned off display_errors, but phpinfo() shows:

display_errors  On

Note that it shows On for both the local and master values for this server.

Also, I'm sorry for perpetuating PHP 4

My php.ini and screenshot of phpinfo to prove I'm not lying

like image 406
nwalke Avatar asked Jun 12 '13 14:06

nwalke


People also ask

Do you need to restart Apache after changing PHP ini?

If you're using PHP as an Apache module for example, you need to restart apache so that the php. ini values take effect.

Which PHP ini does Apache use?

Apache. /etc/php/8.1/apache2/php. ini is for the PHP plugin used by Apache. This is the one you need to edit if you are using the Apache web server.

How do I start PHP-FPM service?

Log into WHM as root. Search “PHP-FPM” and select PHP-FPM service for Apache. Select Yes to restart the PHP-FPM service.


1 Answers

--with-config-file-path expects a directory, not a filename. So with your confiuration PHP would look for /etc/php4/php.ini/php.ini.

Background: The reason for taking a path is that in fact PHP is looking for different files in order: First a SAPI specific file php-$SAPI.ini and then the generic php.ini. This allows i.e. using a different configuration on CLI where initial startup time matters more and other caching settings (apc etc.) are required.

like image 114
johannes Avatar answered Sep 30 '22 07:09

johannes