Install Apache/PHP 5.6.0 on CentOS/RHEL 7/6.5
12 年 ago jony Install Apache/PHP 5.6.0 on CentOS/RHEL 7/6.5已关闭评论
CentOS and Red Hat (RHEL)
## Remi Dependency on CentOS 7 and Red Hat (RHEL) 7 ## rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-1.noarch.rpm ## CentOS 7 and Red Hat (RHEL) 7 ## rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm ## Remi Dependency on CentOS 6 and Red Hat (RHEL) 6 ## rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm ## CentOS 6 and Red Hat (RHEL) 6 ## rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm ## Remi Dependency on CentOS 5 and Red Hat (RHEL) 5 ## rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm ## CentOS 5 and Red Hat (RHEL) 5 ## rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm |
. Install Apache (httpd) Web server and PHP 5.6.0
CentOS 7/6.5/5.10 and Red Hat (RHEL) 7/6.5/5.10
yum --enablerepo=remi,remi-php56 install httpd php php-common |
. Install PHP 5.6.0 modules
CentOS 7/6.5/5.10 and Red Hat (RHEL) 7/6.5/5.10
yum --enablerepo=remi,remi-php56 install php-pecl-apcu php-cli php-pear php-pdo php-mysqlnd php-pgsql php-pecl-mongo php-sqlite php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml |
Start Apache HTTP server (httpd) and autostart Apache HTTP server (httpd) on boot
## Fedora 20/19 and CentOS/RHEL 7 ## systemctl start httpd.service ## use restart after update ## CentOS / RHEL 6.5/5.10 ## /etc/init.d/httpd start ## use restart after update ## OR ## service httpd start ## use restart after update ## Fedora and CentOS/RHEL 7 ## systemctl enable httpd.service ## CentOS / RHEL 6.5/5.10 ## chkconfig --levels 235 httpd on |
Create test PHP page to check that Apache, PHP and PHP modules are working
Add following content to /var/www/html/test.php file.
<?php
phpinfo();
|
Enable Remote Connection to Apache HTTP Server (httpd) –> Open Web server Port (80) on Iptables Firewall (as root user again)
1. CentOS/Red Hat (RHEL) 6.5/5.10
1.1 Edit /etc/sysconfig/iptables file:
nano -w /etc/sysconfig/iptables |
1.2 Add following INPUT rule:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT |
1.3 Restart Iptables Firewall:
service iptables restart ## OR ## /etc/init.d/iptables restart |