Install PHP7 in CentOS6
Recently installedZabbix
Management tools encounteredPHP
After a while, I found some information and shared it for your reference. I took some detours.
Update Software source [1]
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpmwget http://rpms.remirepo.net/enterprise/remi-release-6.rpmrpm -Uvh remi-release-6.rpm epel-release-latest-6.noarch.rpm
Install php7 [2] [3]
yum install php70-php php70-php-pear php70-php-bcmath php70-php-pecl-jsond-devel php70-php-mysqlnd php70-php-gd php70-php-common php70-php-fpm php70-php-intl php70-php-cli php70-php php70-php-xml php70-php-opcache php70-php-pecl-apcu php70-php-pecl-jsond php70-php-pdo php70-php-gmp php70-php-process php70-php-pecl-imagick php70-php-devel php70-php-mbstring php70-php-mcrypt
View the installation path for php70 and php70-php-fpm [4]
Rpm-qa php70 # php70-1.0-5.el6.remi.x86_ 64rpm-ql php70-1.0-5.el6.remi.x86_64 (contains no files) ###### rpm-qa php70-php-fpm # limit 64rpm-ql php70-php-fpm-7.0.8-1.el6.remi.x86_64 #/etc/logrotate. d/php70-php-fpm #/etc/opt/remi/php70/php-fpm.conf # php-fpm configuration file #/etc/opt/remi/php70/php-fpm.d #/etc/opt/remi/ php70/php-fpm.d/www. conf # www configuration file #/etc/opt/remi/php70/sysconfig/php-fpm #/etc/rc. d/init. d/php70-php-fpm #/opt/remi/php70/root/usr/sbin/php-fpm # binary location #/opt/remi/php70/root/usr/share/doc/ php70-php-fpm-7.0.8 #/opt/remi/php70/root/usr/share/doc/php70-php-fpm-7.0.8/fpm_LICENSE #/opt/remi/php70/root/usr/share/doc/php70-php-fpm-7.0.8/php-fpm.conf.default # /opt/remi/php70/root/usr/share/doc/php70-php-fpm-7.0.8/www. conf. default #/opt/remi/php70/root/usr/share/fpm #/opt/remi/php70/root/usr/share/fpm/status.html #/opt/remi/php70 /root/usr/share/man/man8/php-fpm.8.gz #/var/opt/remi/php70/lib/php/opcache #/var/opt/remi/php70/lib/php /session #/var/opt/remi/php70/lib/php/wsdlcache #/var/opt/remi/php70/log/php-fpm #/var/opt/remi/ php70/run/php-fpm
As you can see,rpm -ql php70-php-fpm-7.0.8-1.el6.remi.x86_64
Not listedphp70
According to the explanation in [5,yum
By default, the software package is installed in the following locations
- Binary:/usr/bin
- Class Library:/usr/lib
- Header file:/usr/include, so we can
/usr/bin
.php70
Is
php
And
php-fpm
Create a symbolic link
cp /usr/bin/php{,.bak}ln -s /usr/bin/php70 /usr/bin/phpcp /usr/sbin/php-fpm{,.bak}ln -s /opt/remi/php70/root/usr/sbin/php-fpm /usr/sbin/php-fpm
Check and start php-fpm
Php-v # PHP 7.0.8 (cli) (built: Jun 22 2016 11:05:30) (ETS) # Copyright (c) 1997-2016 The PHP Group # Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies # with Zend OPcache v7.0.8, Copyright (c) 1999-2016, by Zend unzip iesphp-fpm-v # PHP 7.0.8 (fpm-fcgi) (built: jun 22 2016 11:06:37) # Copyright (c) 1997-2016 The PHP Group # Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies # with Zend OPcache v7.0.8, Copyright (c) 1999-2016, by Zend using iesphp-I | less # Configuration File (php. ini) Path =>/etc/opt/remi/php70 # Loaded Configuration File =>/etc/opt/remi/php70/php. ini # configuration file php. ini location service php-fpm restart # Start php-fpmps aux | grep php-fpm # Or lsof-P-I: 9000 # php-fpm listens to port 9000 by default, the configuration can be in the 'php-fpm' configuration file specific to 'www '('/etc/opt/remi/php70/php-fpm.d/www. modify the 'listen' parameter in conf ')
(Optional) modify the configuration file
From the above steps, we know: 1.php
Configuration file (php.ini
) In/etc/opt/remi/php70/php.ini
. We can modifypost_max_size
,max_execution_time
,max_input_time
,date.timezone
And so on.date.timezone
According to the description in [6], you can set itAsia/Shanghai
2.php-fpm
Specificwww
In/etc/opt/remi/php70/php-fpm.d/www.conf
. We can modify the listening portlisten
, User name for runninguser
And user groupsgroup
Wait. 3. After modifying any two files above, you only need to restart them.php-fpm
You can:service php-fpm restart
Reference
[1] English: Repository Configuration
[2] Install PHP7 from Remi repo
[3] How to Install PHP 7 on CentOS 7 (Red Hat/Fedora family)
[4] how to view the software path installed by yum
[5] Default path for installed binary?
[6] It is not safe to rely on the system's timezone settings