如何在 Amazon Linux AMI 2018.03 的 EC2 运行 上安装 PHP 7.1,将 nginx 作为 Web 服务器?
How to install PHP 7.1 on EC2 running on Amazon Linux AMI 2018.03 having nginx as web server?
如何在 Amazon EC2 t2.micro 实例 运行 Amazon Linux AMI 2018.03
上安装 PHP 7.1 将 nginx 作为 Web 服务器?
Reference to PHP7
我按照以下步骤安装 PHP7.1,它已经 Nginx 作为网络服务器 亚马逊 Linux AMI 2018.03
#Remove Old PHP
yum remove php*
#Update Reposistory
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
#Update Amazon AMI
yum upgrade -y
#Install PHP
#List of PHP packages https://webtatic.com/packages/php71/
yum install php71w php71w-cli php71w-fpm
yum install php71w-mysql php71w-xml php71w-curl
yum install php71w-opcache php71w-pdo php71w-gd
yum install php71w-pecl-apcu php71w-mbstring php71w-imap
yum install php71w-pecl-redis php71w-mcrypt
#change listen mode to CGI
sed -i 's/127.0.0.1:9000/\/tmp\/php5-fpm.sock/g' /etc/php-fpm.d/www.conf
/etc/init.d/php-fpm restart
touch /tmp/php5-fpm.sock
chmod 777 /tmp/php5-fpm.sock
service nginx restart
The reason I am still using /tmp/php5-fpm.sock file so that I do not need to change PHP7 sock file in all website nginx conf and assuming server do not have PHP5 as as on first step it has been removed.
参考this答案,将第1步改为:
1.在 Amazon Linux AMI
上安装 Apache 2.4 和 PHP 7.1
# Remove current apache & php
sudo yum remove httpd* php*
# Install Apache 2.4
sudo yum install httpd24
# Install PHP 7.1
sudo yum install php71
# Install additional commonly used php packages
sudo yum install php71-gd
sudo yum install php71-imap
sudo yum install php71-mbstring
sudo yum install php71-mysqlnd
sudo yum install php71-opcache
sudo yum install php71-pdo
sudo yum install php71-pecl-apcu
基本上用 php71 替换 php70。
继续第 2 步,其余的按照 original tutorial。
实现相同输出的可靠方法是在 Amazon Linux AMI 2.
上执行命令
# Remove current php & apache
sudo service httpd stop
sudo yum remove httpd* php*
sudo yum install httpd
amazon-linux-extras install php7.1
如何在 Amazon EC2 t2.micro 实例 运行 Amazon Linux AMI 2018.03
上安装 PHP 7.1 将 nginx 作为 Web 服务器?
Reference to PHP7
我按照以下步骤安装 PHP7.1,它已经 Nginx 作为网络服务器 亚马逊 Linux AMI 2018.03
#Remove Old PHP
yum remove php*
#Update Reposistory
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
#Update Amazon AMI
yum upgrade -y
#Install PHP
#List of PHP packages https://webtatic.com/packages/php71/
yum install php71w php71w-cli php71w-fpm
yum install php71w-mysql php71w-xml php71w-curl
yum install php71w-opcache php71w-pdo php71w-gd
yum install php71w-pecl-apcu php71w-mbstring php71w-imap
yum install php71w-pecl-redis php71w-mcrypt
#change listen mode to CGI
sed -i 's/127.0.0.1:9000/\/tmp\/php5-fpm.sock/g' /etc/php-fpm.d/www.conf
/etc/init.d/php-fpm restart
touch /tmp/php5-fpm.sock
chmod 777 /tmp/php5-fpm.sock
service nginx restart
The reason I am still using /tmp/php5-fpm.sock file so that I do not need to change PHP7 sock file in all website nginx conf and assuming server do not have PHP5 as as on first step it has been removed.
参考this答案,将第1步改为:
1.在 Amazon Linux AMI
上安装 Apache 2.4 和 PHP 7.1# Remove current apache & php
sudo yum remove httpd* php*
# Install Apache 2.4
sudo yum install httpd24
# Install PHP 7.1
sudo yum install php71
# Install additional commonly used php packages
sudo yum install php71-gd
sudo yum install php71-imap
sudo yum install php71-mbstring
sudo yum install php71-mysqlnd
sudo yum install php71-opcache
sudo yum install php71-pdo
sudo yum install php71-pecl-apcu
基本上用 php71 替换 php70。
继续第 2 步,其余的按照 original tutorial。
实现相同输出的可靠方法是在 Amazon Linux AMI 2.
上执行命令# Remove current php & apache
sudo service httpd stop
sudo yum remove httpd* php*
sudo yum install httpd
amazon-linux-extras install php7.1