This guide shows howto install Apache HTTP Server (httpd) with PHP 5.6.6 and following modules on Fedora 21/20/19, CentOS 7/6.6/5.11 and Red Hat (RHEL) 7/6.6/5.11 systems. OPcache (php-opcache) – The Zend OPcache provides faster PHP execution through opcode caching and optimization. APCu (php-pecl-apcu) – APCu userland caching CLI (php-cli) – Command-line interface for PHP PEAR (php-pear) – PHP Extension and Application Repository framework PDO (php-pdo) – A database access abstraction module for PHP applications MySQL (php-mysqlnd) – A module for PHP applications that use MySQL databases PostgreSQL (php-pgsql) – A PostgreSQL database module for PHP MongoDB (php-pecl-mongo) – PHP MongoDB database driver SQLite (php-pecl-sqlite) – Extension for the SQLite V2 Embeddable SQL Database Engine Memcache (php-pecl-memcache) – Extension to work with the Memcached caching daemon Memcached (php-pecl-memcached) – Extension to work with the Memcached caching daemon GD (php-gd) – A module for PHP applications for using the gd graphics library XML (php-xml) – A module for PHP applications which use XML MBString (php-mbstring) – A module for PHP applications which need multi-byte string handling MCrypt (php-mcrypt) – Standard PHP module provides mcrypt library support Install Apache HTTP Server (httpd) and PHP 5.6.6 on Fedora 21/20/19, CentOS / Red Hat (RHEL) 7/6.6/5.11 1. Change root user 2. Install Remi repository Fedora Shell ## Remi Dependency on Fedora 21 / 20 / 19 ## rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm rpm -Uvh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm ## Fedora 21 ## rpm -Uvh http://rpms.famillecollet.com/remi-release-21.rpm ## Fedora 20 ## rpm -Uvh http://rpms.famillecollet.com/remi-release-20.rpm ## Fedora 19 ## rpm -Uvh http://rpms.famillecollet.com/remi-release-19.rpm ## Remi Dependency on Fedora 21 / 20 / 19 ## rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm rpm -Uvh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm ## Fedora 21 ## rpm -Uvh http://rpms.famillecollet.com/remi-release-21.rpm ## Fedora 20 ## rpm -Uvh http://rpms.famillecollet.com/remi-release-20.rpm ## Fedora 19 ## rpm -Uvh http://rpms.famillecollet.com/remi-release-19.rpm CentOS and Red Hat (RHEL) Shell ## 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-5.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 ## 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-5.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 3. Install Apache (httpd) Web server and PHP 5.6.6 Fedora 21 Shell yum --enablerepo=remi install httpd php php-common yum --enablerepo=remi install httpd php php-common Fedora 20/19 Shell yum --enablerepo=remi,remi-php56 install httpd php php-common yum --enablerepo=remi,remi-php56 install httpd php php-common CentOS 7/6.6/5.11 and Red Hat (RHEL) 7/6.6/5.11 Shell yum --enablerepo=remi,remi-php56 install httpd php php-common yum --enablerepo=remi,remi-php56 install httpd php php-common 4. Install PHP 5.6.6 modules Select what you need: OPcache, APCu, CLI, PEAR, PDO, MySQL, PostgreSQL, MongoDB, SQLite, Memcache, Memcached, GD, MBString, MCrypt, XML More info about PHP APC from PHP APC Configuration and Usage Tips and Tricks. Fedora 21 Shell yum --enablerepo=remi 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 yum --enablerepo=remi 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 Fedora 20/19 Shell 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 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 CentOS 7/6.6/5.11 and Red Hat (RHEL) 7/6.6/5.11 Shell 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 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 5. Start Apache HTTP server (httpd) and autostart Apache HTTP server (httpd) on boot Shell ## Fedora 21/20/19 and CentOS/RHEL 7 ## systemctl start httpd.service ## use restart after update ## CentOS / RHEL 6.6/5.11 ## /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.6/5.11 ## chkconfig --levels 235 httpd on ## Fedora 21/20/19 and CentOS/RHEL 7 ## systemctl start httpd.service ## use restart after update ## CentOS / RHEL 6.6/5.11 ## /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.6/5.11 ## chkconfig --levels 235 httpd on 6. 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 <?php phpinfo();

分类: web

标签: