Fix "Failed to start php5-fpm.service: Unit php5-fpm.service is masked."
Problem:
Encounter this error message :
Failed to start php5-fpm.service: Unit php5-fpm.service is masked.
after upgrading Ubuntu with do-release-upgrade
command. The problem was caused by php5 being upgraded to php7.
NOTE: Putting this down as a note for myself for future reference. You might need to change the solution given below to suit your own server's environment.
!! Always backup first before upgrade and write down the steps/commands taken !!
Solution:
1) Execute
sudo apt-get install php-fpm
2) Execute
sudo service php7.0-fpm restart
3) From /var/log/nginx :
2016/04/26 18:15:47 [crit] 1526#0: *10 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 121.122.88.176, server: example.com, request: "GET /admin HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "example.com"
4) Did a ps -ef | grep fpm
and the grab the configuration file used by the fpm master process
and found out that it has include=/etc/php/7.0/fpm/pool.d/*
5) Go to /etc/php/7.0/fpm/pool.d/www.conf
and found
listen = /run/php/php7.0-fpm.sock
6) Go to /etc/nginx/ and change nginx.conf
change this line:
fastcgi_pass unix:/var/run/php5-fpm.sock;
to
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
7) Restart nginx
8) New problem
2016/04/26 18:27:58 [crit] 3403#0: *1 connect() to unix:/run/php/php7.0-fpm.sock failed (13: Permission denied) while connecting to upstream, client: 121.122.88.176, server: example.com, request: "GET /admin HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "example.com"
9) Edit /etc/php/7.0/fpm/pool.d/www.conf ( please change according to your own configuration )
change
user = www-data
group = www-data
to
user = nginx
group = nginx
and
listen.owner = www-data
listen.group = www-data
to
listen.owner = nginx
listen.group = nginx
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+5.6k Golang : Fix opencv.LoadHaarClassifierCascade The node does not represent a user object error
+12.8k Golang : Convert(cast) uintptr to string example
+8.8k Golang : Get SPF and DMARC from email headers to fight spam
+10.1k Golang : cannot assign type int to value (type uint8) in range error
+5.2k Golang : What is StructTag and how to get StructTag's value?
+5.1k Javascript : Change page title to get viewer attention
+10.2k Fix ERROR 1045 (28000): Access denied for user 'root'@'ip-address' (using password: YES)
+7.2k Golang : Check to see if *File is a file or directory
+4.9k Golang : Experimental Jawi programming language
+18.2k Golang : Example for RSA package functions
+12.9k Golang : Convert(cast) int to int64