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

nwalke
  • 3,170
  • 6
  • 35
  • 60
  • 4
    Man, I was ready to hit the edit button and fix your "4" typo. – 000 Jun 12 '13 at 14:58
  • 2
    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 one – Orangepill Jun 12 '13 at 14:58
  • 2
    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. – nwalke Jun 12 '13 at 14:59
  • Did you make sure `display_errors` is not overridden locally using `.htaccess`? – haim770 Jun 12 '13 at 15:00
  • 1
    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. – Prisoner Jun 12 '13 at 15:00
  • 1
    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... – marekful Jun 12 '13 at 15:01
  • 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`. – nwalke Jun 12 '13 at 15:02
  • @tubaguy50035 Maybe something is cached? – Leri Jun 12 '13 at 15:04
  • I'd suggest pasting your whole php.ini and php_info() output into two pastebins – Prisoner Jun 12 '13 at 15:05
  • 1
    apache module or fastcgi module? Because if the latter, you might need to restart fastcgi instead... – Denis de Bernardy Jun 12 '13 at 15:05
  • Apache module. I wish it were easy :) – nwalke Jun 12 '13 at 15:07
  • 1
    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. – Spudley Jun 12 '13 at 15:08
  • 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. – Prisoner Jun 12 '13 at 15:16
  • Yeah, that didn't do anything either. I figured it wasn't loading it, thus my question :) – nwalke Jun 12 '13 at 15:17
  • @PLB I doubted, but rebooted the whole server just in case. Same issues after reboot. – nwalke Jun 12 '13 at 15:23
  • I'm assuming nothing in the log files? – Prisoner Jun 12 '13 at 15:24
  • 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. – nwalke Jun 12 '13 at 15:25

1 Answers1

2

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

johannes
  • 15,807
  • 3
  • 44
  • 57