php源代码安装常见错误与解决办法分享


Posted in PHP onMay 28, 2013

错误: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
修改方法:
[root@centos lnmp]# cd php-5.2.14ext/
[root@centos 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.
[root@centos ext]# cd my_module/
[root@centos 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])
[root@centos 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

执行以后会看到下面的

[root@ns sdomain]# /usr/local/php/bin/phpize

Configuring for:

PHP Api Version:

20020918

Zend Module Api No:

 20020429

Zend Extension Api No:  20050606

[root@ns 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

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

PHP 相关文章推荐
支持oicq头像的留言簿(二)
Oct 09 PHP
PHP array_multisort()函数的使用札记
Jul 03 PHP
php分页示例分享
Apr 30 PHP
PHP实现生成唯一编号(36进制的不重复编号)
Jul 01 PHP
PHP中防止SQL注入方法详解
Dec 25 PHP
php实现仿写CodeIgniter的购物车类
Jul 29 PHP
在WordPress中获取数据库字段内容和添加主题设置菜单
Jan 11 PHP
php中json_encode不兼容JSON_UNESCAPED_UNICODE的解决方案
May 31 PHP
Thinkphp和Bootstrap结合打造个性的分页样式(推荐)
Aug 01 PHP
php基于session锁防止阻塞请求的方法分析
Aug 07 PHP
php面向对象重点知识分享
Sep 27 PHP
PHP SESSION跨页面传递失败解决方案
Dec 11 PHP
如何批量替换相对地址为绝对地址(利用bat批处理实现)
May 27 #PHP
php 深入理解strtotime函数的使用详解
May 23 #PHP
如何使用PHP计算上一个月的今天
May 23 #PHP
解析php二分法查找数组是否包含某一元素
May 23 #PHP
PHP下打开phpMyAdmin出现403错误的问题解决方法
May 23 #PHP
php设计模式之观察者模式的应用详解
May 21 #PHP
php设计模式之命令模式的应用详解
May 21 #PHP
You might like
php实现加减法验证码代码
2014/02/14 PHP
PHP自定session保存路径及删除、注销与写入的方法
2014/11/18 PHP
php实现的mongodb操作类实例
2015/04/03 PHP
android上传图片到PHP的过程详解
2015/08/03 PHP
php实现socket推送技术的示例
2017/12/20 PHP
YII框架学习笔记之命名空间、操作响应与视图操作示例
2019/04/30 PHP
tp5.0框架隐藏index.php入口文件及模块和控制器的方法分析
2020/02/11 PHP
js 事件截取enter按键页面提交事件示例代码
2014/03/04 Javascript
js拖拽一些常见的思路方法整理
2014/03/19 Javascript
JS实现简单的顶部定时关闭层效果
2014/06/15 Javascript
用js传递value默认值的示例代码
2014/09/11 Javascript
JS实现网页滚动条感应鼠标变色的方法
2015/02/26 Javascript
jQuery简单实现点击文本框复制内容到剪贴板上的方法
2016/08/01 Javascript
用JS中split方法实现彩色文字背景效果实例
2016/08/24 Javascript
jQuery实现表格文本框淡入更改值后淡出效果
2016/09/27 Javascript
jquery 实时监听输入框值变化的完美方法(必看)
2017/01/26 Javascript
vue实现公告栏文字上下滚动效果的示例代码
2020/06/16 Javascript
Vue实现input宽度随文字长度自适应操作
2020/07/29 Javascript
[01:00:17]DOTA2-DPC中国联赛 正赛 SAG vs Dynasty BO3 第二场 1月25日
2021/03/11 DOTA
python读取中文txt文本的方法
2018/04/12 Python
pyqt5使用按钮进行界面的跳转方法
2019/06/19 Python
Python使用tkinter模块实现推箱子游戏
2019/10/08 Python
Python while true实现爬虫定时任务
2020/06/08 Python
浅谈keras2 predict和fit_generator的坑
2020/06/17 Python
termux中matplotlib无法显示中文问题的解决方法
2021/01/11 Python
html5 canvas移动浏览器上实现图片压缩上传
2016/03/11 HTML / CSS
奥斯汀独木舟和皮划艇:Austin Canoe & Kayak
2018/05/22 全球购物
日本最大化妆品和美容产品的综合口碑网站:cosme shopping
2019/08/28 全球购物
C#和SQL Server的面试题
2016/08/12 面试题
JPA的优势都有哪些
2013/07/04 面试题
幼儿园迎国庆65周年活动策划方案
2014/09/16 职场文书
少先队入队仪式主持词
2015/07/04 职场文书
2015国庆节放假通知范文
2015/07/30 职场文书
《时代广场的蟋蟀》读后感:真挚友情,温暖世界!
2020/01/08 职场文书
为什么mysql字段要使用NOT NULL
2021/05/13 MySQL
通过feDisplacementMap和feImage实现水波特效
2022/04/24 HTML / CSS