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

1

8

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

Warranty answered 12/6, 2013 at 14:51 Comment(17)
Man, I was ready to hit the edit button and fix your "4" typo.Pm
create a page with phpinfo(); on it... this should tell you the ini php is using for the webserver. Make sure your editing the right oneZeba
I already did that...? The path is in the question as well as me doing an ls to show you that it exists and that I've been editing the correct one.Warranty
Did you make sure display_errors is not overridden locally using .htaccess?Fagin
My guess is that the php.ini file is owned by root and you webserver doesn't have access to it therefore is just using the default configuration.Celinacelinda
Are you sure PHP ini values aren't modified elsewhere down the line? It may happen in a .htaccess or in PHP code via ini_set. Create a test PHP file with only ini_set("diaplay_errors", 0); ehco phpinfo(); ini_set("display_errors", 1); echo phpinfo() and compare...Horseflesh
The php.ini has global read, so that isn't the problem (I can change the owner if you guys think that will help). The phpinfo() shows both local and global settings and for display_errors it shows On for both, so it's not being overriden locally and it's not being taken up from the php.ini.Warranty
@tubaguy50035 Maybe something is cached?Vasiliu
I'd suggest pasting your whole php.ini and php_info() output into two pastebinsCelinacelinda
apache module or fastcgi module? Because if the latter, you might need to restart fastcgi instead...Need
Apache module. I wish it were easy :)Warranty
I don't know the answer to the question, but I just wanted to say I'm impressed you've managed to get php4 even to compile and run on an up-to-date OS. You might want to add the OS information to the question; not sure if it's relevant, but it could be.Fender
Try changing the value of display_startup_errors to On in your php.ini and see if it makes a difference. If it doesn't, it's not loading that php.ini file it's saying it is.Celinacelinda
Yeah, that didn't do anything either. I figured it wasn't loading it, thus my question :)Warranty
@PLB I doubted, but rebooted the whole server just in case. Same issues after reboot.Warranty
I'm assuming nothing in the log files?Celinacelinda
Nope. Apache logs are all I have and it since the errors I'm seeing aren't fatal, it just shows 200's. Me seeing the errors in the Apache logs wouldn't help me though.Warranty
T
3

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

Throaty answered 12/6, 2013 at 15:29 Comment(1)
Ah, that makes sense. Recompiling now!Warranty

© 2022 - 2024 — McMap. All rights reserved.