Centos 7 yum安装php 记录


安装 apache 服务

#yum -y install httpd

安装 PHP

#yum -y install  php  php-gd php-mbstring php-mysql

locate php.ini
php -v 查看版本号

添加一个zend gurad loader模块,

在/etc/php.d/目录下新建zend_gurad.ini 然后参考README.txt

1. Extract the Zend Loader package.

2. Locate and extract the ZendGuardLoader.so (Linux) or ZendLoader.dll (Windows) that corresponds to your php version.

3. Add the following line to your php.ini file for loading the ZendGuardLoader:
Linux and Mac OS X: zend_extension=<full_path_to_ZendGuardLoader.so>
Windows non-thread safe: zend_extension=<full_path_to_ZendLoader.dll>

4. Add an aditional line to your php.ini for enabling ZendGuardLoader
; Enables loading encoded scripts. The default value is On

5. Optional: following lines can be added your php.ini file for ZendGuardLoader configuration:

; Disable license checks (for performance reasons)
; The Obfuscation level supported by Zend Guard Loader. The levels are detailed in the official Zend Guard Documentation. 0 – no obfuscation is enabled
; Path to where licensed Zend products should look for the product license. For more information on how to create a license file, see the Zend Guard User Guide

6. If you use Zend debugger as well, please make sure to load it after the Zend guard Loader

7. If you use ioncube loader, please make sure to load it before Zend guard Loader

8. Restart your Web server.




nano /etc/httpd/conf.d/www.conf

<VirtualHost *:80>
ServerName luoyangbang.com
ServerAlias *.luoyangbang.com
DocumentRoot /var/www/abc/
<Directory /var/www/abc>
Require all granted
Options FollowSymLinks
AllowOverride All



  1. systemctl restart mysqld.service
  2. systemctl restart httpd.service


添加 yum 源

CentOS 6.x 的源

# rpm -Uvh http://download.Fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

CentOS 7.x 的源

# rpm -Uvh http://ftp.iij.ad.jp/pub/linux/fedora/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

安装 PHP

# yum install –enablerepo=remi,remi-php56 php php-opcache php-pecl-apcu php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof php-pdo php-pear php-fpm php-cli php-xml php-bcmath php-process php-gd php-common


查看 PHP 版本

# php -v