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
+30.6k Golang : bufio.NewReader.ReadLine to read file line by line
+5k Javascript : How to loop over and parse JSON data?
+9.6k Golang : Bcrypting password
+76.9k Golang : How to return HTTP status code?
+8.4k Yum Error: no such table: packages
+37.3k Golang : Comparing date or timestamp
+17.9k Golang : Get download file size
+8.7k Golang : Apply Histogram Equalization to color images
+4.2k Adding Skype actions such as call and chat into web page examples
+9.9k Golang : cannot assign type int to value (type uint8) in range error
+4.2k Javascript : Detect when console is activated and do something about it
+8.6k Golang : Capture text return from exec function example