Jump to content

How to make php.ini changes stick?


NotionCommotion
Go to solution Solved by Jacques1,

Recommended Posts

Often I use Centos on a physical or virtual server with Apache.

 

My normal operation is edit php.ini and then do /etc/init.d/httpd restart.

 

Found myself using Raspian on a Raspberry Pi with nginx, so tried /etc/init.d/nginx restart, but it didn't take, and I had to reboot the server.

 

Really, wasn't so easy, and it took me over an hour to try this :(

 

How should changes to php.ini be made active?

Link to comment
Share on other sites

PHP isn't embedded into nginx as is the case with Apache, so restarting the webserver has no effect on PHP (unless your init.d script does more).

 

How are you running PHP? Are you using PHP-FPM? Then you need to restart the PHP-FPM processes. Either through an init script (if available) or by killing the master process (the PID is written to a file depending on the configuration).

Link to comment
Share on other sites

PHP isn't embedded into nginx as is the case with Apache, so restarting the webserver has no effect on PHP (unless your init.d script does more).

 

How are you running PHP? Are you using PHP-FPM? Then you need to restart the PHP-FPM processes. Either through an init script (if available) or by killing the master process (the PID is written to a file depending on the configuration).

 

No, I expect my init.d script doesn't do more.

 

In /etc/nginx/sites-available/default, I replaced server{ ... } with the following, and thus suspect I am using PHP-FPM, however, confess I am just guessing.

server {
        listen 80;
        server_name $domain_name;
        root /var/www/html/;
        index index.html index.htm index.php;
        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;
 
        location ~\.php{
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_split_path_info ^(.+\.php)(/.*)$;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                fastcgi_param HTTPS off;
                try_files $uri =404;
                include fastcgi_params;
        }
}
Link to comment
Share on other sites

  • Solution

Yes, that's PHP-FPM.

 

Do you have an init script for PHP-FPM? Then you simply need to use that instead of the nginx one after you've updated the PHP configuration:

/etc/init.d/php-fpm restart

(the script could be named differently)

 

There are also plenty of init scripts on the Internet.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.