Install PHP7 in CentOS6

Source: Internet
Author: User

Install PHP7 in CentOS6

Recently installedZabbixManagement tools encounteredPHPAfter 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_64Not listedphp70According to the explanation in [5,yumBy default, the software package is installed in the following locations

  1. Binary:/usr/bin
  2. Class Library:/usr/lib
  3. Header file:/usr/include, so we can/usr/bin.php70
Is phpAnd php-fpmCreate 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.phpConfiguration file (php.ini) In/etc/opt/remi/php70/php.ini. We can modifypost_max_size,max_execution_time,max_input_time,date.timezoneAnd so on.date.timezoneAccording to the description in [6], you can set itAsia/Shanghai2.php-fpmSpecificwwwIn/etc/opt/remi/php70/php-fpm.d/www.conf. We can modify the listening portlisten, User name for runninguserAnd user groupsgroupWait. 3. After modifying any two files above, you only need to restart them.php-fpmYou 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.