'Upgrade PHP on AWS Linux
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?
Solution 1:[1]
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.
Solution 2:[2]
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Lee Melbourne |
Solution 2 | karel |