以下跟大家介紹linux編譯安裝php7.2,希望對需要的朋友有幫助,更多Linux使用教學可直接存取Linux影片教學學習!
php編譯安裝
新增使用者
useradd -r -s /sbin/nologin php-fpm
#下載解壓縮安裝套件
cd /data/pkg wget http://php.net/get/php-7.2.2.tar.gz/from/this/mirror mv mirror php-7.2.2.tar.gz tar zxvf php-7.2.2.tar.gz cd php-7.2.2
安裝依賴
yum -y install libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel libxslt libicu-devel libxslt-devel
#編譯安裝
./configure \ --prefix=/usr/local/php-7.2.2 \ --with-mhash \ --with-openssl \ --with-config-file-path=/usr/local/php-7.2.2/etc \ --disable-short-tags \ --enable-fpm \ --with-fpm-user=php-fpm \ --with-fpm-group=php-fpm \ --enable-xml \ --with-libxml-dir \ --enable-bcmath \ --enable-calendar \ --enable-intl \ --enable-mbstring \ --enable-pcntl \ --enable-shmop \ --enable-soap \ --enable-sockets \ --enable-zip \ --enable-mbregex \ --enable-mysqlnd \ --enable-mysqlnd-compression-support \ --with-mysqli=mysqlnd \ --with-pdo-mysql=mysqlnd \ --with-gd \ --enable-ftp \ --with-curl \ --with-xsl \ --with-iconv \ --with-freetype-dir \ --with-jpeg-dir \ --with-png-dir \ --with-zlib \ --enable-sysvsem \ --enable-inline-optimization \ --with-xmlrpc \ --with-gettext make -j 4 && make install
建立軟鏈
ln -s /usr/local/php-7.2.2/ /usr/local/php ln -s /usr/local/php/bin/php /usr/local/bin ln -s /usr/local/php/sbin/php-fpm /usr/local/sbin
對php-fpm運行使用者進行設定
cd /data/pkg/php-7.2.2 cp ./php.ini-development ./php.ini-production /usr/local/php/etc cp /usr/local/php/etc/php.ini-development /usr/local/php/etc/php.ini cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
建立軟鏈
ln -s /usr/local/php/etc/php.ini /usr/local/etc/ ln -s /usr/local/php/etc/php-fpm.conf /usr/local/etc/ ln -s /usr/local/php/etc/php-fpm.d/www.conf /usr/local/etc/
配置環境變量,加入全域指令
vim /etc/profile PATH=$PATH:/usr/local/php/bin export PATH source /etc/profile
啟動php-fpm 服務
/usr/local/sbin/php-fpm
查看是否啟動
netstat -lnt | grep 9000
殺死php-fpm
killall php-fpm
或
ps aux | grep php ![clipboard.png](/img/bVbi8rC) kill -USR2 29261
以上是linux 編譯安裝 php7.2的詳細內容。更多資訊請關注PHP中文網其他相關文章!