2

I have an AWS server running a website with NGINX and PHP. I originally installed these using the following:

sudo yum install -y nginx php-fpm

The version of PHP that is installed is 5.3.29 which but I need at least 5.4 to run a payments plug-in. All the info online indicates a PHP upgrade actually involves a reinstall. So I ran the series of commands below to upgrade to 7.1 (based on various online postings):

sudo yum remove php* httpd* sudo yum clean all sudo yum update -y sudo yum install php71

After the upgrade all php files on my site result in a 404. But html files work fine, so NGINX is running. The resulting install of php7.1 doesnt seem to run as a service. If I run service --status-all I see no mention of any PHP. There is now no *.sock file in the /var/run/ folder hierarchy for nginx to link to. There is no www.conf file for php so I cannot configure a sock file location. The tutorials online mention running php afterwards using sudo systemctl restart php7.1-fpm.service but systemctl is not a command and there seems to be no PHP service to run anyway.

Am I missing something here? I am at a loss what to do next. Can anybody offer some direction or indication as to what I have done wrong and how I can debug this?

Lee Melbourne
  • 407
  • 5
  • 20
  • Are you running Fedora or Amazon Linux? Which version of Fedora? – mattdm Nov 08 '17 at 03:07
  • AWS Linux. But I believe it is a version of Fedora. I found the solution below however. – Lee Melbourne Nov 13 '17 at 06:59
  • AWS is derived from, I believe, CentOS (which comes from Fedora via RHEL), and may mix in other packages. But it is not a "version of Fedora". Particularly, package names and package sources will differ. – mattdm Nov 13 '17 at 13:16
  • Possible duplicate of [How to install PHP 7 on EC2 t2.micro Instance running Amazon Linux Distro](https://stackoverflow.com/questions/34873685/how-to-install-php-7-on-ec2-t2-micro-instance-running-amazon-linux-distro) – BharathRao Sep 12 '18 at 12:06

2 Answers2

3

FINALLY! Seems the instructions on virtually every site I have looked at did not work. What did work was the following:

sudo yum install php71-fpm

I dont understand the difference between php71 and php71-fpm but using the latter seems to install the service and other files I needed. Not everything on my site is working though, as I now need to track down the various php components that are needed. It seems that the various php modules have changed name in assorted ways. For example, php71-pdo exists but php71-mysql does not.

Lee Melbourne
  • 407
  • 5
  • 20
  • `php71-mysql` doesn't exist because the basic MySQL extension was removed in PHP 7. PDO or mysqlnd are the non-deprecated options. Do `yum search php71` to see available packages. You should also understand what FPM is/does if you're going to be managing this server. – ceejayoz Nov 07 '17 at 00:38
  • Perhaps you misunderstood. I actually developed the site, so I think I know what php is/does. Its the complexities of the various linux packages that I find confusing. – Lee Melbourne Apr 01 '18 at 11:06
0

Change PHP version.

sudo yum-config-manager --enable epel
yum install dnf -y
yum install epel-release yum-utils -y
yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
dnf install php74.x86_64
dnf clean metadata
dnf install php-cli php-pdo php-fpm php-json php-mysqlnd
dnf list installed php-cli php-pdo php-fpm php-json php-mysqlnd
which php
php -v
yum update
sudo systemctl restart httpd 
karel
  • 5,489
  • 46
  • 45
  • 50