建立存放目錄
建立php使用者和使用者組
groupadd -r php && useradd -r -g php -s /bin/false -d /usr/local/php7 -m php
安裝編譯php7.時需要的依賴包
yum -y install libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-devel
libpng-devel freetype-devel libmcrypt-devel
解壓軟體包php-7.1.2.tar.bz2
tar -jxvf php-7.1.2.tar.bz2
進入解壓後的資料夾
cd php-7.1.2
php7編譯引數的配置
準備工作做好後,就開始正式配置php5.7.7rc的安裝明細了。注意,操作時一定要先把下面
反斜槓「\」後面新增的注釋文字去掉!!!
[root@typecodes php-src-master]# ./configure
–prefix=/usr/local/php7 \ [php7安裝的根目錄]
–exec-prefix=/usr/local/php7
–bindir=/usr/local/php7/bin
–sbindir=/usr/local/php7/sbin
–includedir=/usr/local/php7/include
–libdir=/usr/local/php7/lib/php
–mandir=/usr/local/php7/php/man
–with-config-file-path=/usr/local/php7/etc \ [php7的配置目錄]
–with-mysql-sock=/var/run/mysql/mysql.sock \ [php7的unix socket通訊文
件]–with-mcrypt=/usr/include
–with-mhash
–with-openssl
–with-mysql=shared,mysqlnd \ [php7依賴mysql庫]
–with-mysqli=shared,mysqlnd \ [php7依賴mysql庫]
–with-pdo-mysql=shared,mysqlnd \ [php7依賴mysql庫]
–with-gd
–with-iconv
–with-zlib
–enable-zip
–enable-inline-optimization
–disable-debug
–disable-rpath
–enable-shared
–enable-xml
–enable-bcmath
–enable-shmop
–enable-sysvsem
–enable-mbregex
–enable-mbstring
–enable-ftp
–enable-gd-native-ttf
–enable-pcntl
–enable-sockets
–with-xmlrpc
–enable-soap
–without-pear
–with-gettext
–enable-session \ [允許php會話session]
–with-curl \ [允許curl擴充套件]
–with-jpeg-dir
–with-freetype-dir
–enable-opcache \ [使用opcache快取]
–enable-fpm
–enable-fastcgi
–with-fpm-user=nginx \ [php-fpm的使用者]
–with-fpm-group=nginx \ [php-fpm的使用者組]
–without-gdbm
–disable-fileinfo
編譯完成 (注:這裡編譯可以會出現configure: error: mcrypt.h not found. please
reinstall libmcrypt.的報錯解決辦法見註1:)
make
make install
檢視編譯成功後的php7安裝目錄
開始設定php7的配置檔案php.ini、php-fpm.conf、www.conf和php-fpm指令碼
cp php.ini-production /usr/local/php7/etc/php-fpm.ini
cp /usr/local/src/php7.1/php-7.1.2/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
cp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.conf
cp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-
fpm.d/www.conf
新增php的環境變數
將php編譯生成的bin目錄新增到當前linux系統的環境變數中
echo e '\nexport
path=/usr/local/php7/bin:/usr/local/php7/sbin:katex parse error: undefined control sequence: \n at position 5: path\̲n̲' >> /etc/profi…document_root,儲存退出
複製**
複製**
location ~ .phpkatex parse error: expected '}', got 'eof' at end of input: …ript_filename document_root$fastcgi_script_name;
include fastcgi_params;
}複製**
複製**
9.重啟nginx
service nginx restart
10.在nginx的web目錄下新增php檔案,如/usr/local/nginx/html/phpinfo.php
<?php phpinfo(); 訪問url,如: 頁面顯示正常,則配置成功
PHP 編譯安裝PHP
1.安裝php所有的依賴軟體包 root web01 yum install zlib devel libxml2 devel libjpeg devel freetype devel libpng devel gd devel libcurl devel libxslt devel openssl...
PHP編譯安裝
錯誤1configure error xml2 config not found.please check your libxml2 installation.解決方案 yum install y libxml2 devel錯誤2 configure error cannot find openss...
編譯安裝PHP
2 確保安裝之前有安裝gd,png,curl,xml等等lib開發庫。如果不確定,執行以下命令 yum install gcc make gd devel libjpeg devel libpng devel libxml2 devel bzip2 devel libcurl devel y 3 編...