Linux源碼編譯安裝php7.3


---恢復內容開始---

ps:一切從簡

一、安裝所需環境

yum -y install libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel libzip-devel pcre-devel

二、下載及安裝nginx

1.下載php

wget http://cn2.php.net/distributions/php-7.3.3.tar.gz

 2.解壓php

tar -xzf php-7.3.3.tar.gz

3.進入php目錄

cd php-7.3.3

3.編譯php(我們不提供apxs參數,相反,我們提供php-fpm相關參數)

./configure --prefix=/usr/local/php7 \ --with-config-file-path=/usr/local/php7/etc \ --with-config-file-scan-dir=/usr/local/php7/etc/php.d \ --with-mcrypt=/usr/include \ --enable-mysqlnd \ --with-mysqli \ --with-pdo-mysql \ --enable-fpm \ --with-fpm-user=nginx \ --with-fpm-group=nginx \ --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 \ --enable-opcache

-----------------------start---------------------------

  假如編譯完成之后報錯:

  “checking for libzip... configure: error: system libzip must be upgraded to v”

  執行一下,沒有報錯則忽略。

wget https://nih.at/libzip/libzip-1.2.0.tar.gz

tar -xzf libzip-1.2.0.tar.gz

./configure

make && make install

----------------------------end-------------------------

出現以下則表示編譯成功

+--------------------------------------------------------------------+
| License: |
| This software is subject to the PHP License, available in this |
| distribution in the file LICENSE. By continuing this installation |
| process, you are bound by the terms of this license agreement. |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point. |
+--------------------------------------------------------------------+

Thank you for using PHP.

然后執行:

make test(如果出現什么問題請谷歌或百度,或者往下看看能解決不)

--------------start----------------

如果這里報錯:

/usr/local/include/zip.h:59:21: fatal error: zipconf.h: No such file or directory

則執行一下命令,沒有則忽略。

find / -name zipconf.h

cp /你zipconf.h所在的目錄  //usr/local/include/zipconf.h

然后重新 configure 成功之后在make test,沒問題則繼續執行后面的命令。

---------------end--------------------

make && make install -j2

三、配置php

1.復制ini文件

 cp php.ini-production /usr/local/php7/etc/php.ini

 

2.配置fpm

cd /usr/src/php-7.0.0/sapi/fpm

cp init.d.php-fpm /etc/init.d/php-fpm

chmod +x /etc/init.d/php-fpm

chkconfig --add php-fpm

chkconfig php-fpm on

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM