阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

Ubuntu中编译安装PHP

138次阅读
没有评论

共计 2942 个字符,预计需要花费 8 分钟才能阅读完成。

关于怎么在 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 配置 http://www.linuxidc.com/Linux/2016-02/128442.htm

剖析 PHP 脚本的超时机制 http://www.linuxidc.com/Linux/2016-02/128441.htm

Ubuntu 14.04 下搭建 PHP 开发环境 PDF  http://www.linuxidc.com/Linux/2016-02/128330.htm

PHP 7 革新与性能优化 http://www.linuxidc.com/Linux/2015-09/123136.htm

PHP 7,你值得拥有  http://www.linuxidc.com/Linux/2015-06/118847.htm 

在 CentOS 7.x / Fedora 21 上面体验 PHP 7.0  http://www.linuxidc.com/Linux/2015-05/117960.htm 

CentOS 6.3 安装 LNMP (PHP 5.4,MyySQL5.6) http://www.linuxidc.com/Linux/2013-04/82069.htm 

在部署 LNMP 的时候遇到 Nginx 启动失败的 2 个问题 http://www.linuxidc.com/Linux/2013-03/81120.htm 

Ubuntu 安装 Nginx php5-fpm MySQL(LNMP 环境搭建) http://www.linuxidc.com/Linux/2012-10/72458.htm 

《细说 PHP》高清扫描 PDF+ 光盘源码 + 全套教学视频 http://www.linuxidc.com/Linux/2014-03/97536.htm 

CentOS 6 中配置 PHP 的 LNMP 的开发环境  http://www.linuxidc.com/Linux/2013-12/93869.htm 

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

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

正文完
星哥说事-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-21发表,共计2942字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中