centos7編譯安裝php7.4.22
阿新 • • 發佈:2021-10-31
------------恢復內容開始------------
yum -y install gcc libxml2-devel bzip2-devel libmcrypt-devel sqlite-devel oniguruma-devel bison tar xjvf php-7.4.22.tar.bz2 ./configure --prefix=/apps/php74 --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-openssl --with-zlib --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --enable-mbstring --enable-xml --enable-sockets --enable-fpm --enable-maintainer-zts --disable-fileinfo make && make install echo 'PATH=/apps/php74/bin:$PATH' > /etc/profile.d/php74.sh source /etc/profile.d/php74.sh [root@17 ~]# php -v PHP 7.4.22 (cli) (built: Oct 31 2021 20:41:00) ( ZTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies cp php.ini-production /etc/php.ini 原始碼目錄中拷貝php配置檔案 cp sapi/fpm/php-fpm.service /usr/lib/systemd/system/ 原始碼目錄中拷貝service檔案 cp /apps/php74/etc/php-fpm.conf.default /apps/php74/etc/php-fpm.conf 安裝目錄中拷貝fpm配置檔案 cp /apps/php74/etc/php-fpm.d/www.conf.default /apps/php74/etc/php-fpm.d/www.conf 安裝目錄中拷貝fpm配置檔案,需要修改啟動使用者為httpd相同使用者,開啟狀態頁和測試頁面。 vim /apps/httpd24/conf/httpd.conf LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so #取消代理模組註釋 <IfModule dir_module> DirectoryIndex index.php index.html #修改預設頁面為index.php </IfModule> AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps ProxyRequests Off ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/data/html/$1 ProxyPassMatch ^/(fpm-status|ping)$ fcgi://127.0.0.1:9000/$1 vim /data/html/info.php <?php phpinfo(); ?> chown apache.apache -R /data/html 訪問測試 [root@17 ~]# curl http://10.0.0.17/ping pong [root@17 ~]# curl http://10.0.0.17/fpm-status pool: www process manager: dynamic start time: 31/Oct/2021:21:08:33 +0800 start since: 1823 accepted conn: 16 listen queue: 0 max listen queue: 0 listen queue len: 128 idle processes: 1 active processes: 1 total processes: 2 max active processes: 1 max children reached: 0 slow requests: 0
記錄
1、httpd安裝參考其他指令碼
2、./configure生成編譯引數是報錯
configure: error: bison 3.0.0 is required to generate PHP parsers (excluded versions: none).
需要安裝 bison 解析器生成器
------------恢復內容結束------------