使用FPM打php7的rpm包

來源:互聯網
上載者:User

標籤:bin   bash   設定檔   move   cal   post   rbo   tar   arc   

安裝FPM環境安裝php7

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

1.下載php7的tar包,解壓。http://php.net/downloads.php

2.編譯。編譯的過程中,會報依賴包的錯誤,在安裝依賴包的同時,記下安裝包名,打包的時候作為一個-d參數加進去。下面是一個./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

修改php7設定檔

 

編寫安裝指令碼和移除指令碼
#!/bin/bashgroup=odinuser=odinphp_install_dir=/usr/local/php7/conf_dir=/etc/php_fpm_dir=/etc/init.d/function check_file(){    file=$1    if [ -f "${file}" ];then        test -f "${file}.rpmsave" && rm -rf "${file}.rpmsave"        mv "${file}" "${file}.rpmsave"    fi}function check_dir(){    dir=$1    if [ -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}chmod 777 -R /search/odin/devdirs/tmpchmod 770 /search/odin/devdirs/applogs/php-fpmchmod +t /search/odin/devdirs/tmp
install.sh

注意這個install指令碼是安裝之後要執行的指令碼,所以只能做一些cp或者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=$1    if [ -f "${file}" ];then        test -f "${file}.rpmsave" && rm -rf "${file}.rpmsave"        mv "${file}" "${file}.rpmsave"    fi}function check_dir(){    dir=$1    if [ -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

由雩都是線上的機器,remove的指令碼寫的比較保守。

使用fpm命令打包
fpm -f -p /search/jingliyang/myrpm/ -s dir -t rpm -n php-desktop-specialForMaXueyong-rh6.x86_64 --epoch 0 -v 7.0.13 -C /usr/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

 

使用FPM打php7的rpm包

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.