PHP源码安装经常会碰到的问题及解决办法

错误:configure: error: libevent >= 1.4.11 could not be found

解决:yum -y install libevent libevent-devel

错误:configure: error: Please reinstall the mysql distributio

解决:yum -y install mysql-devel

错误:make: *** [sapi/fpm/php-fpm] error 1

解决:用make ZEND_EXTRA_LIBS=‘-liconv‘编译

错误:configure: error: XML configuration could not be found

解决:yum -y install libxml2 libxml2-devel

错误:configure: error: No curses/termcap library found

解决:yum -y install ncurses ncurses-devel

错误:configure: error: xml2-config not found

解决:yum -y install libxml2 libxml2-devel

错误:configure: error: Cannot find OpenSSL‘s <evp.h>

解决:yum install openssl openssl-devel

错误:configure: error: Please reinstall the libcurl distribution -easy.h should be in <curl-dir>/include/curl/

解决:yum install curl curl-devel

错误:configure: error: Cannot find ldap.h

解决:yum install openldap openldap-devel

错误:configure: error: libjpeg.(a|so) not found

解决:yum install libjpeglibjpeg -devel

错误:configure: error: libpng.(a|so) not found.

解决:yum install libpnglibpng –devel

错误:onfigure: error: freetype.h not found.

解决:yum install freetype-devel

错误:configure: error: cannot find output from lex; giving up

解决:yum -y install flex

错误:configure: error: mod_deflate has been requested but can not be built due to prerequisite failures

解决:yum -y install zlib-devel openssl-devel

错误:Configure: error: Unable to locate gmp.h

解决:yum install gmp-devel

错误:Configure: error: Cannot find MySQL header files under /usr.

Note that the MySQL client library is not bundled anymore!

解决:yum install mysql-devel

更多的补充内容:

安装php: ./configure
configure: error: XML configuration could not be found

yum -y install libxml2 libxml2-devel

Cannot find OpenSSL‘s <evp.h>
yum install openssl openssl-devel

1) Configure: error: xml2-config not found. Please check your libxml2 installation.
#yum install libxml2 libxml2-devel (For RedHat & Fedora)
# aptitude install libxml2-dev (For Ubuntu)

2) Checking for pkg-config… /usr/bin/pkg-config
configure: error: Cannot find OpenSSL‘s <evp.h>
#yum install openssl openssl-devel

3) Configure: error: Please reinstall the BZip2 distribution
# yum install bzip2 bzip2-devel

4) Configure: error: Please reinstall the libcurl distribution -
easy.h should be in <curl-dir>/include/curl/
# yum install curl curl-devel (For RedHat & Fedora)
# install libcurl4-gnutls-dev (For Ubuntu)

5) Configure: error: libjpeg.(also) not found.
# yum install libjpeg libjpeg-devel

6) Configure: error: libpng.(also) not found.
# yum install libpng libpng-devel

7) Configure: error: freetype.h not found.
#yum install freetype-devel

8) Configure: error: Unable to locate gmp.h
# yum install gmp-devel

9) Configure: error: Cannot find MySQL header files under /usr.
Note that the MySQL client library is not bundled anymore!
# yum install mysql-devel (For RedHat & Fedora)
# apt-get install libmysql++-dev (For Ubuntu)

10) Configure: error: Please reinstall the ncurses distribution
# yum install ncurses ncurses-devel

11) Checking for unixODBC support… configure: error: ODBC header file ‘/usr/include/sqlext.h‘ not found!
# yum install unixODBC-devel

12) Configure: error: Cannot find pspell
# yum install pspell-devel

13) configure: error: mcrypt.h not found. Please reinstall libmcrypt.
# yum install libmcrypt libmcrypt-devel (For RedHat & Fedora)
# apt-get install libmcrypt-dev

14) Configure: error: snmp.h not found. Check your SNMP installation.
# yum install net-snmp net-snmp-devel

15)
/usr/bin/ld: cannot find -lltdl
collect2: ld returned 1 exit status
make: *** [sapi/cgi/php-cgi] Error 1
# yum install libtool-ltdl.x86_64 libtool-ltdl-devel.x86_64

16)
为php编译xcache模块的时候,需要运行phpize
得到了一个错误
#/usr/local/php/bin/phpize
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF
environment variable is set correctly and then rerun this script.
通过安装 autoconf 可以解决
centos下执行 yum install autoconf 即可
Ubuntu下执行 apt-get install autoconf 即可
17)
# /usr/local/php/bin/phpize
Cannot find config.m4.
Make sure that you run ‘/usr/local/php/bin/phpize‘ in the top level source directory of the module
修改方法:
[[email protected] lnmp]# cd php-5.2.14ext/
[[email protected] ext]# ./ext_skel --extname=my_module
Creating directory my_module
Creating
basic files: config.m4 config.w32 .cvsignore my_module.c
php_my_module.h CREDITS EXPERIMENTAL tests/001.phpt my_module.php
[done].
To use your new extension, you will have to execute the following steps:
1. $ cd ..
2. $ vi ext/my_module/config.m4
3. $ ./buildconf
4. $ ./configure --[with|enable]-my_module
5. $ make
6. $ ./php -f ext/my_module/my_module.php
7. $ vi ext/my_module/my_module.c
8. $ make
Repeat steps 3-6 until you are satisfied with ext/my_module/config.m4 and
step 6 confirms that your module is compiled into PHP. Then, start writing
code and repeat the last two steps as often as necessary.
[[email protected] ext]# cd my_module/
[[email protected] my_module]# vim config.m4
根据你自己的选择将
dnl PHP_ARG_WITH(my_module, for my_module support,
dnl Make sure that the comment is aligned:
dnl [ --with-my_module Include my_module support])
修改成
PHP_ARG_WITH(my_module, for my_module support,
Make sure that the comment is aligned:
[ --with-my_module Include my_module support])
或者将
dnl PHP_ARG_ENABLE(my_module, whether to enable my_module support,
dnl Make sure that the comment is aligned:
dnl [ --enable-my_module Enable my_module support])
修改成
PHP_ARG_ENABLE(my_module, whether to enable my_module support,
Make sure that the comment is aligned:
[ --enable-my_module Enable my_module support])
[[email protected] my_module]# vim my_module.c
  将文件其中的下列代码进行修改
/* Every user visible function must have an entry in my_module_functions[].
*/
function_entry my_module_functions[] = {
    PHP_FE(say_hello,    NULL) /* ?添加着一行代码 */
    PHP_FE(confirm_my_module_compiled,   NULL) /* For testing, remove later. */
    {NULL, NULL, NULL}   /* Must be the last line in my_module_functions[] */
};
  在文件的最后添加下列代码
PHP_FUNCTION(say_hello)
{
    zend_printf("hello sdomain!");
}
再修改:php_sdomain.h
vi php_sdomain.h
在PHP_FUNCTION(confirm_my_module_compiled ); /* For testing, remove later. */ 这行的下面添加一行:
PHP_FUNCTION(say_hello); /* For testing, remove later. */
  保存文件退出
  然后我们就可以在这个目录下使用上面的命令了
  /usr/local/php/bin/phpize
  执行以后会看到下面的
  [[email protected] sdomain]# /usr/local/php/bin/phpize
  Configuring for:
  PHP Api Version:     20020918
  Zend Module Api No:   20020429
  Zend Extension Api No:  20050606
  [[email protected] sdomain]#
  然后执行./configure --with-php-config=/usr/local/php/bin/php-config
  然后执行make
  make install
然后他会把对应的so文件生成放到PHP安装目录下面的一个文件夹,并提示在在什么地方,然后再把里面的SO文件拷到你存放SO文件的地方
  即你在php.ini里面的extension_dir所指定的位置
  最后一步是你在php.ini文件中打开这个扩展
  extension=sdomain.so
  然后
  重新起动apache

以上错误都是在整个编译安装遇到的问题,然后结合网上的资料,找到的解决方法,总结到这个地方,希望能帮到大家!

时间: 2024-10-26 16:29:52

PHP源码安装经常会碰到的问题及解决办法的相关文章

源码安装extundelete以及对遇到问题的解决

软件下载:http://sourceforge.net/projects/extundelete/ 1.在安装extundelete包./configure时遇到configure: error: C++ compiler cannot create executables问题 [[email protected] extundelete-0.2.4]# ./configure Configuring extundelete 0.2.4configure: error: in `/root/De

OPENSUSE + zabbix源码安装,PHP出现问题?怎么解决?

通过登录zabbix首页,但是无法加载PHP页面,求大神指引因为是suse系统,跟redhat的安装略有不同. 原文地址:http://blog.51cto.com/13403714/2141067

Linux基础:从源码安装软件

为什么要从源码安装软件 在什么情况之下,我们需要从源代码安装软件呢?我想不外乎这些情形:一种情况是软件放出了新的版本,而所用的发行版并没有及时跟进,这时候,想要尝鲜的话,就非得靠自己不可:另一种情形是不管是软件的开发者,还是现用的系统都没有提供可直接使用的二进制包,而自己又非要使用该软件,那么也需亲自出马才行:当然,还有其他的情形.总而言之,学会从源代码安装软件是一项非常重要的技能. 什么是make 与 configure make 是一支程序,当执行make 时,make 会在当前目录下寻找

【Linux笔记】samba源码安装及基本使用说明

前段时间项目中碰到从windows机器上传多媒体文件至linux服务器的需求(人工审核并触发同步),调研了几种上传机制或实现方案: 1) http方式上传至WebServer 用PHP或Python脚本上传给WebServer,但由于多媒体文件动辄几百兆,PHP由于最长执行时间的限制首先被排除,另外由于用脚本上传需要增加失败重试等控制逻辑,Python虽然可以实现这些功能,但考虑到开发成本及服务的稳定性,并不是最优方案 2) flash方式上传 例如百度云web端就使用了flash方式上传,通过

从源码安装cmake

##安装环境:ubuntu16.04 ## 安装cmake之前需要确认已经安装make.gcc.g++,用make -v | gcc -v | g++ -v可查看是否已经安装,如果没有安装用apt-get安装一下(也可从源码安装): sudo apt-get install gcc sudo apt-get install g++ sudo apt-get install make ## cmake下载:https://cmake.org/download/ wget https://githu

centos7.2源码安装openssl1.0.2

centos7.2默认是安装了opensll软件包的,但是部署个别服务时,由于版本太低.会影响服务的正常部署.只能使用源码安装提高openssl软件版本. 因为之前有openssl软件包,所以要先移除之前版本: 删除旧版本: yum remove -y openssl openssl-devel 源码安装openssl需要perl环境编译,如果没有perl环境还是需要安装: yum -y install perl perl-devel 现在新版本openssl: wget https://www

centos6.5 64 源码安装redis服务,建立可远程连接的redis数据库

安装环境:centos6.5 64位 使用的包:redis-2.8.19.tar.gz  tcl8.6.3-src.tar.gz 包的下载链接:http://downloads.sourceforge.net/tcl/tcl8.6.3-src.tar.gz http://download.redis.io/releases/redis-2.8.19.tar.gz 本次安装的目录/home/hadoop/redis为任意目录 代码实现: 1,安装需要的支持环境 su root cd /home/h

ubuntu php5.6源码安装

今天又花了一天时间装了php,感觉php的源码安装也挺麻烦的,整个过程各种报错. 下篇文章准备整合所有查找到的报错和解决方法. php和nginx一样,在安装前需要装一堆的依赖.有libmcrypt.mcrypt.mhash.其实远不止这三个包,在后面的configure和make中还会陆陆续续安装一些依赖. 1.安装libmcrypt.mcrypt.mhash(整个过程都在/usr/local/src/php目录下) #创建/usr/local/src/php目录并进入mkdir /usr/l

LinuxMint下的Orionode源码安装

1. Orionode介绍 Eclipse-orion是Eclipse项目下面的一个子项目,orion是一个在在线版的代码编辑环境.其介绍参考http://wiki.eclipse.org/Orion. Eclipse-orion是使用Java语言开发的, Orionode则是使用Node.js开发的一个简易版orion.关于orionode跟orion的特性差异请查考http://wiki.eclipse.org/Orion/Node/Getting_started. 2. Node.js和n