NotionCommotion Posted October 22, 2016 Share Posted October 22, 2016 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? Quote Link to comment https://forums.phpfreaks.com/topic/302384-how-to-make-phpini-changes-stick/ Share on other sites More sharing options...
Jacques1 Posted October 22, 2016 Share Posted October 22, 2016 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). Quote Link to comment https://forums.phpfreaks.com/topic/302384-how-to-make-phpini-changes-stick/#findComment-1538514 Share on other sites More sharing options...
NotionCommotion Posted October 22, 2016 Author Share Posted October 22, 2016 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; } } Quote Link to comment https://forums.phpfreaks.com/topic/302384-how-to-make-phpini-changes-stick/#findComment-1538521 Share on other sites More sharing options...
Solution Jacques1 Posted October 22, 2016 Solution Share Posted October 22, 2016 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. Quote Link to comment https://forums.phpfreaks.com/topic/302384-how-to-make-phpini-changes-stick/#findComment-1538523 Share on other sites More sharing options...
NotionCommotion Posted October 23, 2016 Author Share Posted October 23, 2016 Perfect! This works: sudo /etc/init.d/php5-fpm restart Quote Link to comment https://forums.phpfreaks.com/topic/302384-how-to-make-phpini-changes-stick/#findComment-1538524 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.