Install multiple versions of PHP on Amazon Linux 2023

0

Hello,

Is it possible to install multiple version of PHP on an Amazon Linux 2023 image? And how should you approach this? We would like to install the latest php 7 and php 8 versions allongside.

With kind regards, Andries

  • Install docker, create a container with each version of apache+php or nginx+php you need. Map your source code directory to apache rootdirectory inside your container and just it.

    If you need all versions running in the same time, do not forget that each one should run in a exclusive tcp port.

    For example: container with php 5.6 in tcp port 8056, container with php 7.1 in port 8071, container with php 8.2 in port 8082 etc.

    When you access by browser http:<instanceip>:8056 you application will run in php 5.6, if access http:<instanceip>:8071 it will run under php 7.1 and go on.

質問済み 8ヶ月前1933ビュー
4回答
0

Hi,

this post details how to install multiple versions of PHP on Linux: https://utho.com/docs/tutorial/install-multiple-version-of-php-on-ubuntu-server/

It's Ubuntu here but it also applies to AL 2023

Best,

Didier

profile pictureAWS
エキスパート
回答済み 8ヶ月前
0

Hello,

No apt-get available on Amazon Linux, so it's not that straight forward though..

回答済み 8ヶ月前
0

As an alternative to @Didier's suggestion, take a look at PHPBrew https://github.com/phpbrew/phpbrew

Disclaimer - I haven't used it myself, but looks similar to perlbrew which I have used and found to be effective for the use case you are asking about.

profile picture
エキスパート
Steve_M
回答済み 8ヶ月前
0

I don't have an answer but was hoping for a similar usage documented here: https://www.digitalocean.com/community/tutorials/how-to-run-multiple-php-versions-on-one-server-using-apache-and-php-fpm-on-centos-7 But for Current PHP Versions 8.1/.2/.3.

回答済み 2ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ