DEV Community

Install PHP 8 on AWS Amazon Linux 2

Andrea Olivato on December 07, 2020

PHP 8 is finally here, and it's time to upgrade our DEV environments to start resolving all those Warnings :) At Lnk.Bio we use the official AWS A...
Collapse
 
abtfur profile image
Richard Fu

Failed in sodo yum install php80:

Error: Package: php80-runtime-1.0-3.el7.remi.x86_64 (remi-safe)
           Requires: scl-utils
 You could try using --skip-broken to work around the problem
** Found 5 pre-existing rpmdb problem(s), 'yum check' output follows:
4:perl-5.16.3-294.43.amzn1.x86_64 is a duplicate with 4:perl-5.16.3-286.38.amzn1.x86_64
perl-Getopt-Long-2.40-3.6.amzn1.noarch is a duplicate with perl-Getopt-Long-2.40-2.5.amzn1.noarch
1:perl-Pod-Escapes-1.04-294.43.amzn1.noarch is a duplicate with 1:perl-Pod-Escapes-1.04-286.38.amzn1.noarch
4:perl-libs-5.16.3-294.43.amzn1.x86_64 is a duplicate with 4:perl-libs-5.16.3-286.38.amzn1.x86_64
4:perl-macros-5.16.3-294.43.amzn1.x86_64 is a duplicate with 4:perl-macros-5.16.3-286.38.amzn1.x86_64
Enter fullscreen mode Exit fullscreen mode
Collapse
 
andreaolivato profile image
Andrea Olivato

Have you added the optional epel repo? You might have other external repo that conflict with higher priority.

Collapse
 
ed_olii profile image
Eduardo Oliveros • Edited

when i try to check the version after instalation php8 wasn't found php -v
-bash: /usr/bin/php: No such file or directory

Collapse
 
andreaolivato profile image
Andrea Olivato

The new binary is php80

Collapse
 
alanondra profile image
Alan Ondra

This new binary name also means tools like composer will not work. Before you go to install it, you'll need to alias PHP so the environment resolves it:

ln -s /usr/bin/php80 /usr/bin/php

Collapse
 
alanondra profile image
Alan Ondra

What's the new Apache module?

Collapse
 
andreaolivato profile image
Andrea Olivato

I don't use the Apache module, which is not the most performing integration.

You can use php80-php-fpm as cgi wrapper, with either apache or nginx.

Not sure about the built-in module

Collapse
 
alanondra profile image
Alan Ondra

Turns out the new mod_php is php80-php in this repo.

I haven't really been in an environment where a more performant server is needed, until you're just doing a completely different architecture altogether (i.e. microservices).

Collapse
 
malwarebo profile image
Irfan

You wouldn't have any warnings until you remove all the code which is not compatible with PHP 8.

Collapse
 
hisampala profile image
hisampala

No package php80 available.
how can i fix it

Collapse
 
ed_olii profile image
Eduardo Oliveros

How to Install or enable PHP's mbstring extension????

Collapse
 
andreaolivato profile image
Andrea Olivato

sudo yum install php80-php-mbstring

More in general, if you do
sudo yum search php80
You will see all available extension/modules

Collapse
 
kaiksilva profile image
Kaik Silva

When I run my php file the php code appears written on the screen

Collapse
 
donvitocodes profile image
donvitocodes

How do you configure php8 with apache?