php 32位编译安装,编译安装 PHP 7.0.3 亲测全攻略 & 以及如何单独的安装某个模块...

截止 2016年2月15日 ,PHP7 的最新 stable 版本是 PHP 7.0.3 ,最新版本信息:http://php.net/downloads.php 。下载最新版:$ wget http://cn2.php.net/get/php-7.0.3.tar.bz2/from/this/mirror

$ tar jxvf mirror

$ cd php-7.0.3/

可以先看看配置帮助:./configure --help

本例使用的配置,其中 /usr/local/php 是安装目标位置./configure \

--prefix=/usr/local/php \

--with-apxs2=/usr/local/apache/bin/apxs \       #apxs工具参数

--with-mysqli=/usr/local/mysql/bin/mysql_config \   # mysql参数

--with-config-file-path=/usr/local/php/etc \ # 指定自己的php.ini路径

--with-curl \

--with-freetype-dir \

--with-gd \

--with-gettext \

--with-iconv-dir \

--with-kerberos \

--with-libdir=lib64 \

--with-libxml-dir \

--with-openssl \

--with-pcre-regex \

--with-pdo-mysql \

--with-pdo-sqlite \

--with-pear \

--with-png-dir \

--with-xmlrpc \

--with-xsl \

--with-zlib \

--enable-fpm \

--enable-bcmath \

--enable-libxml \

--enable-inline-optimization \

--enable-gd-native-ttf \

--enable-mbregex \

--enable-mbstring \

--enable-opcache \

--enable-pcntl \

--enable-shmop \

--enable-soap \

--enable-sockets \

--enable-sysvsem \

--enable-xml \

--enable-zip

----------无汉字可复制安装

./configure \

--prefix=/usr/local/php \

--with-apxs2=/usr/local/apache/bin/apxs \

--with-mysqli=/usr/local/mysql/bin/mysql_config \

--with-config-file-path=/usr/local/php/etc \

--with-curl \

--with-freetype-dir \

--with-gd \

--with-gettext \

--with-iconv-dir \

--with-kerberos \

--with-libdir=lib64 \

--with-libxml-dir \

--with-openssl \

--with-pcre-regex \

--with-pdo-mysql \

--with-pdo-sqlite \

--with-pear \

--with-png-dir \

--with-xmlrpc \

--with-xsl \

--with-zlib \

--enable-fpm \

--enable-bcmath \

--enable-libxml \

--enable-inline-optimization \

--enable-gd-native-ttf \

--enable-mbregex \

--enable-mbstring \

--enable-opcache \

--enable-pcntl \

--enable-shmop \

--enable-soap \

--enable-sockets \

--enable-sysvsem \

--enable-xml \

--enable-zip

如果提示某些模块找不到,可能需要单独安装它们,例如$ sudo apt-get install libcurl4-gnutls-dev

您可能需要安装的模块有 libjpeg libjpeg-devel libpng libpng-develfreetype freetype-devel libxml2 libxml2-devel mysql pcre-devel curl-devel libxslt-devel 等等……

接下来运行:$ make && make install

就开始编译安装了。

img_0500.jpgPHP7 编译安装完成的画面,安装完成后在/usr/local/apache/modules/可以看到有新的模块 还没完,以上出处:https://www.bokeyy.com/post/build-php-7-0-3-for-wordpress.html

编译过程中落下了一个模块libphp5(或者libphp7)又不想重新编译安装所有的参数,所以单独安装,某一个模块。如下:

cd /usr/local/src/php-7.0.3./configure --with-apxsz2=/usr/local/apache/bin/apxs (需注意此参数一定要和Apache下的目录对应,比如如果是默认的apahce2则应该是--with-apxsz=/usr/local/apache2/bin/apxs 否则可能会出现报错1.Perl不存2. /usr/local/apache/bin/apxs 文件不存在等等。注意:此方法并不可靠会把之前的编译安装好的给覆盖掉,其他的编译参数会变成默认的,谨慎使用。)

中间如果出现报错:ext/phar/.libs/util.o: In function `phar_create_signature':/usr/local/src/php-5.6.17/ext/phar/util.c:1860: undefined reference to `BIO_new_mem_buf'/usr/local/src/php-5.6.17/ext/phar/util.c:1869: undefined reference to `PEM_read_bio_PrivateKey'/usr/local/src/php-5.6.17/ext/phar/util.c:1870: undefined reference to `BIO_free'/usr/local/src/php-5.6.17/ext/phar/util.c:1879: undefined reference to `EVP_MD_CTX_create'/usr/local/src/php-5.6.17/ext/phar/util.c:1881: undefined reference to `EVP_PKEY_size'/usr/local/src/php-5.6.17/ext/phar/util.c:1884: undefined reference to `EVP_sha1'/usr/local/src/php-5.6.17/ext/phar/util.c:1884: undefined reference to `EVP_DigestInit'/usr/local/src/php-5.6.17/ext/phar/util.c:1893: undefined reference to `EVP_DigestUpdate'/usr/local/src/php-5.6.17/ext/phar/util.c:1902: undefined reference to `EVP_SignFinal'/usr/local/src/php-5.6.17/ext/phar/util.c:1911: undefined reference to `EVP_MD_CTX_destroy'ext/phar/.libs/util.o: In function `phar_verify_signature':/usr/local/src/php-5.6.17/ext/phar/util.c:1533: undefined reference to `EVP_sha1'/usr/local/src/php-5.6.17/ext/phar/util.c:1590: undefined reference to `BIO_new_mem_buf'/usr/local/src/php-5.6.17/ext/phar/util.c:1600: undefined reference to `PEM_read_bio_PUBKEY'/usr/local/src/php-5.6.17/ext/phar/util.c:1601: undefined reference to `BIO_free'/usr/local/src/php-5.6.17/ext/phar/util.c:1611: undefined reference to `EVP_DigestInit'/usr/local/src/php-5.6.17/ext/phar/util.c:1623: undefined reference to `EVP_DigestUpdate'/usr/local/src/php-5.6.17/ext/phar/util.c:1631: undefined reference to `EVP_VerifyFinal'/usr/local/src/php-5.6.17/ext/phar/util.c:1642: undefined reference to `EVP_MD_CTX_cleanup'/usr/local/src/php-5.6.17/ext/phar/util.c:1633: undefined reference to `EVP_MD_CTX_cleanup'collect2: ld returned 1 exit statusmake: *** [sapi/cli/php] 错误 1

重新编译:./configure --with-apxsz=/usr/local/apache/bin/apxsmakemake install

方法二:cd/usr/local/src/php-7.0.3/ext/curl  以curl模块为例(此方法局限在PHP自带模块才可以。)

进入到curl这个目录下找到configure   如果没有便在当前目录直接运行phpize这个命令就会生成configure 生成后  运行这个命令  ./configure  --with-php-config=/usr/local/php/bin/php-config   前面是执行的参数,安装哪个模块就在哪个模块下执行这个命令,等号后面是安装后的路径

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值