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
+7.6k Swift : Convert (cast) String to Double
+23.7k Golang : Find biggest/largest number in array
+21.9k Golang : Repeat a character by multiple of x factor
+9.6k Golang : Sort and reverse sort a slice of integers
+7.1k Golang : Scanf function weird error in Windows
+8.6k Golang : Sort lines of text example
+13.2k Golang : Strings comparison
+16.4k Golang : read gzipped http response
+51k Golang : Check if item is in slice/array
+9.1k Golang : Create unique title slugs example
+17.6k Golang : How to log each HTTP request to your web server?
+12.8k Golang : List objects in AWS S3 bucket