RPM package using FPM to beat PHP7

Source: Internet
Author: User
Tags gmp

Installing the FPM Environment installation PHP7

http://php.net/manual/zh/install.unix.nginx.php

1. Download the PHP7 tar package and unzip it. http://php.net/downloads.php

2. Compile. In the process of compiling, it will report the error of the dependency package, while installing the dependent package, note the installation package name and add it as a-d parameter when packing. Here is a sample example of a./configure.

./configure--prefix=/usr/local/PHP7--with-config-file-path=/etc/php7/etc--with-config-file-scan-dir=/etc/php7/etc/PHP.D--with-mcrypt=/usr/include--enable-Mysqlnd--with-mysqli--with-pdo-MySQL--enable-FPM--with-fpm-user=Odin--with-fpm-group=Odin--with-GD--with-Iconv--with-zlib--enable-XML--enable-Shmop--enable-Sysvsem--enable-inline-optimization--enable-Mbregex--enable-mbstring--enable-FTP--enable-gd-native-TTF--with-OpenSSL--enable-Pcntl--enable-Sockets--with-Xmlrpc--enable-Zip--enable-Soap--without-Pear--with-GetText-enable-Session--with-Curl--with-jpeg-dir--with-freetype-dir--with-bz2--with-GMP--enable-simplexml
./configure

3.make && make Install

Modifying the PHP7 configuration file

Writing installation scripts and removing scripts
#!/bin/bashgroup=Odinuser=Odinphp_install_dir=/usr/local/php7/Conf_dir=/etc/Php_fpm_dir=/etc/init.d/function Check_file () {file=$1if[-F"${file}"];then Test-F"${file}.rpmsave"&& RM-RF"${file}.rpmsave"MV"${file}" "${file}.rpmsave"fi}function Check_dir () {dir=$1if[-D"${dir}"];then Test-D"${dir}.rpmsave"&& RM-RF"${dir}.rpmsave"MV"${dir}" "${dir}.rpmsave"fi} {! ID $user>/dev/null 2>&1;} && Useradd"${user}"-G"${group}"Chown-R odin:odin/usr/local/PHP7#Copy php-fpmCheck_file"${PHP_FPM_DIR}PHP-FPM"CP ${php_install_dir}etc/PHP-FPM ${php_fpm_dir}php-Fpmchmod+x/etc/init.d/php-FPM#Copy php-fpm.confCheck_file"${conf_dir}php-fpm.conf"CP ${php_install_dir}etc/php-fpm.conf ${conf_dir}php-fpm.conf#Copy PHP-FPM.DCheck_dir"${CONF_DIR}PHP-FPM.D"CP-R ${PHP_INSTALL_DIR}ETC/PHP-FPM.D ${conf_dir}php-FPM.D#copy php.iniCheck_file"${conf_dir}php.ini"CP ${php_install_dir}etc/php.ini ${conf_dir}php.ini#Copy PHP.DCheck_dir"${CONF_DIR}PHP.D"CP-R ${php_install_dir}etc/PHP.D ${conf_dir}php.dtest-l/usr/local/bin/php && unlink/usr/local/bin/PHP#Copy phpCheck_file"/usr/local/bin/php"CP ${php_install_dir}bin/php/usr/local/bin/Phpmkdir-p/var/lib/Phpchown-R odin:odin/var/lib/Phpmkdir-p/search/odin/devdirs/{tmp,applogs/php-Fpm}chmod777-r/search/odin/devdirs/Tmpchmod770/search/odin/devdirs/applogs/php-Fpmchmod+t/search/odin/devdirs/tmp
install.sh

Note that the install script is the script to be executed after installation, so you can only do some operations such as CP or chmod.

#!/bin/bashphp_install_dir=/usr/local/php7/Conf_dir=/etc/PHP-fpm_dir=/etc/init.d/RM-rf/usr/local/php7function check_file () {file=$1if[-F"${file}"];then Test-F"${file}.rpmsave"&& RM-RF"${file}.rpmsave"MV"${file}" "${file}.rpmsave"fi}function Check_dir () {dir=$1if[-D"${dir}"];then Test-D"${dir}.rpmsave"&& RM-RF"${dir}.rpmsave"MV"${dir}" "${dir}.rpmsave"fi}#Copy php-fpmCheck_file"${PHP-FPM_DIR}PHP-FPM"#Copy php-fpm.confCheck_file"${conf_dir}php-fpm.conf"#Copy PHP-FPM.DCheck_dir"${CONF_DIR}PHP-FPM.D"#copy php.iniCheck_file"${conf_dir}php.ini"#Copy PHP.DCheck_dir"${CONF_DIR}PHP.D"Test-l/usr/bin/php && unlink/usr/local/bin/PHP#Copy phpCheck_file"/usr/bin/php"
Remove

Since all the machines on the line, the remove script is more conservative in writing.

Packaging with the FPM command
Fpm-f-p/search/jingliyang/myrpm/-S dir-t rpm-n php-desktop-specialformaxueyong-rh6.x86_64--epoch 0-v 7.0.13-c/US r/local/php7/--verbose--description'php-desktop-specialformaxueyong-7.0.12.rh6.x86_64'--url'http://php.net/manual/zh/index.php'-M'php-7.0.12'-D'Libxml2-devel'-D'LIBXML2'-D'Bzip2-devel'-D'Libcurl-devel'-D'Libidn-devel'-D'Libjpeg-devel'-D'Libpng-devel'-D'Freetype-devel'-D'Gmp-devel'-D'Libmcrypt-devel'-D'Pcre-devel'--post-install/search/jingliyang/myrpm/php7/php7_scripts/php_install--post-uninstall/search/jingliyang/myrpm/ Php7/php7_scripts/php_remove/usr/local/php7

RPM package using FPM to beat PHP7

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.