Tricky php.ini settings

Attention: This content is 13 years old. Please keep its age in mind while reading as its contents may now be outdated or inaccurate.

There are several ways PHP settings can be adjusted.  The 2 most common are in the Apache config file, or usually, the php.ini file.

Typically you can use phpinfo(); to get the php settings.  This is extremely useful as it also shows EXACTLY which php.ini file is being used to pull its configuration from.

I recently ran in to a particularly frustrating situation trying to adjust the settings.  I had already grep’ed throughall the Apache config files and knew there were no php configuration settings hidden in there.  So, I knew it was pulling its config from the php file.  In the past it has been a simple matter to adjust the value in the ini file and then reload Apache (this causes php to reload).  Well, this time it wasn’t working.  No matter how many times I killed Apache’s processes and restarted it, it was STILL pulling the old values.

I was really about to lose my mind when I ran the phpinfo via the php cli, and it showed my new correct values!  Arggg!!!

After a shamefully long amount of time trying to figure this out, I FINALLY found the solution.  Well, unbeknownst to me, this server was using something call php-fpm.  Php-fpm is a FastCGI Process Manager, which is an alternative to PHP FastCGI (which if was being used would have also hung me up).  This basically spawns php in a separate service to allow it to work faster.  Well, since php is basically its own process, you have to restart the php-fpm service to get Apache’s PHP to reload the config file!

[root@myserver php53]# /etc/init.d/php-fpm restart
Gracefully shutting down php-fpm . done
Starting php-fpm done

And bam, I finally got the new settings to load!  Note, if you’re using the standard FastCGI module you’d use php-fastcgi restart instead.

I feel silly for not knowing about this php-fpm process before… but I’m used to Apache just calling php directly itself.  This was a set up I had not dealt with before, so it was time for me to learn something new.

Happy PHP’ing folks!