Ubuntu中编译安装PHP


关于怎么在Ubuntu中获取php源码和解压就不再说了。

编译的参数为:

./configure --prefix=/opt/php --with-bz2 --with-mcrypt --with-mhash --with-openssl --with-pdo-mysql --with-pdo-pgsql --with-mysqli --with-pgsql --enable-calendar --with-gettext --with-iconv --enable-mbstring --with-pspell  --enable-exif --with-gd --with-png-dir=/opt/php --with-jpeg-dir=/opt/php --with-imap --enable-bcmath --with-gmp --enable-pcntl --enable-sysvshm --enable-shmop --with-tidy --with-curl --enable-ftp  --with-ldap --enable-sockets --enable-fpm --enable-soap --with-xmlrpc  --enable-wddx --with-xsl  --with-kerberos --with-imap-ssl

--prefix参数的值指定了php的安装路径,如果不指定的话那么安装后php的文件将分散在各个地方,不利于管理,指定路径后所有的php文件将全部存放在指定的路径下。其他参数全部能够在php手册上面能够找到,只要查看函数参考章节下面的每个扩展的安装说明就可以找到需要的参数了。这些参数可以根据自己的需要增加或者减少。如果以后需要添加一个扩展,只需要在原有的参数上加上新的扩展参数然后重新编译安装就可以了(只要--prefix参数的位置不变就可以覆盖以前的安装的php)。

编译完成后执行make命令,make执行完成后执行sudo make install命令进行安装。

在安装过程中可能会遇到各种问题,例如依赖包缺失等等,安装过程中遇到的问题有如下这些:

configure: error:utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information   解决办法:apt-get install libc-client2007e-dev   configure: error: Cannot find ldap libraries in /usr/lib.   解决办法:ln -fs /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/   configure: error: mcrypt.h not found. Please reinstall libmcrypt.   解决办法:sudo apt-get install libmcrypt-dev   CONFIGURE: ERROR: CANNOT FIND LIBPQ-FE.H. PLEASE SPECIFY CORRECT POSTGRESQL INSTALLATION PATH   解决办法:sudo apt-get install postgresql-server-dev-9.5   configure: error: Cannot find pspell   解决办法:sudo apt-get install libpspell-dev   configure: error: Cannot find libtidy   解决办法:sudo apt-get install libtidy-dev   configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution   解决办法:sudo apt-get install libxslt1-dev   /usr/bin/ld: ext/ldap/.libs/ldap.o: undefined reference to symbol 'ber_strdup@@OPENLDAP_2.4_2' //usr/lib/x86_64-linux-gnu/liblber-2.4.so.2: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make: *** [sapi/cli/php] Error 1   解决办法:在PHP源码目录下 vim Makefile 找到 EXTRA_LIBS 行(带有很多参数的行),在行末添加 ‘ -llber ‘ 保存退出再次make即可。   以上只是一部分遇到的问题,由于我在安装的时候遇到的一部分问题没有记录,所以目前只有这几个问题,下次安装时再补充。  

深入理解PHP中的ini配置

剖析PHP脚本的超时机制

Ubuntu 14.04下搭建PHP开发环境PDF 

PHP 7革新与性能优化

PHP 7 ,你值得拥有   

在 CentOS 7.x / Fedora 21 上面体验 PHP 7.0   

CentOS 6.3 安装LNMP (PHP 5.4,MyySQL5.6)  

在部署LNMP的时候遇到Nginx启动失败的2个问题  

Ubuntu安装Nginx php5-fpm MySQL(LNMP环境搭建)  

《细说PHP》高清扫描PDF+光盘源码+全套教学视频  

CentOS 6中配置PHP的LNMP的开发环境   

PHP 的详细介绍:请点这里
PHP 的下载地址:请点这里

本文永久更新链接地址:http://www.bkjia.com/Linux/2016-03/129153tm

相关内容