5

So i installed LEMP (nginx, mysql, php..) by following the digital ocean guide. But ubuntu 16.04 only comes with php7 by default and i need greater then 7.1 to run Laravel. I am confused on why every time i replace php 7 with php 7.2-fpm from ondrej

sudo add-apt-repository ppa:ondrej/php

Why does the default php-fpm work and load the info.php page.. but when i install php 7.2-fpm from ondrej it shows up 502 bad gateway. Any help is appreciated so i can start Laravel! :D

  • Stackoverlfow is not the right place for such questions. Consider deleting and reposting on serverfault. Also, sharing your nginx logs might a good starting point for you and anybody else who might want to help you. – man0v Mar 01 '18 at 01:33
  • Sorry, i thought this would be a place to post it since i am trying to install laravel. –  Mar 01 '18 at 01:57

3 Answers3

6

I had same problem, so I changed the nginx config file /etc/nginx/sites-avaiable/your-site.

Change:

fastcgi_pass unix:/run/php/php7.1-fpm.sock;

to

fastcgi_pass unix:/run/php/php7.2-fpm.sock;

This worked for me.

Paul T. Rawkeen
  • 3,994
  • 3
  • 35
  • 51
  • For anyone using digitalocean droplets. By default for some reason its set on the droplet to be 7.0. Changing to 7.2 as per above fixes it – kevinabraham Dec 07 '19 at 04:06
2

Go to /etc/nginx/sites-avaiable/YOURSITENAME

Change

fastcgi_pass unix:/run/php/php7.X-fpm.sock;

to

fastcgi_pass unix:/run/php/php7.2-fpm.sock;

Restart service

sudo service nginx restart
Danilo
  • 21
  • 2
0

CentOS8 nginx Mariadb PHP7.2 on a free one year trial cloud server:

CentOS-8.1_64bit Plan: G2.1GB CPU: 1 vCPU RAM: 1 GB Disk: 40 GB

After many struggles, tearouts and reinstalls, I can confirm that in:

/usr/share/nginx/html/*.php

You need:

echo <?php phpinfo(); ?>

But, you also need to change file ownership:

sudo chown nginx:nginx usr/share/nginx/html/ -R

Now I can drink to enjoy and not to forget about nights of tail chasing!

Sfili_81
  • 2,377
  • 8
  • 27
  • 36
greg00m
  • 1
  • 1