php源代碼安裝常見錯(cuò)誤與解決辦法分享
更新時(shí)間:2013年05月28日 15:15:35 作者:
這篇文章主要介紹了在linux服務(wù)器中通過源代碼安裝php過程中,經(jīng)常會(huì)遇到的一些問題做個(gè)小結(jié),特分享給需要的朋友
錯(cuò)誤:configure: error: libevent >= 1.4.11 could not be found
解決:yum -y install libevent libevent-devel
錯(cuò)誤:configure: error: Please reinstall the mysql distributio
解決:yum -y install mysql-devel
錯(cuò)誤:make: *** [sapi/fpm/php-fpm] error 1
解決:用make ZEND_EXTRA_LIBS='-liconv'編譯
錯(cuò)誤:configure: error: XML configuration could not be found
解決:yum -y install libxml2 libxml2-devel
錯(cuò)誤:configure: error: No curses/termcap library found
解決:yum -y install ncurses ncurses-devel
錯(cuò)誤:configure: error: xml2-config not found
解決:yum -y install libxml2 libxml2-devel
錯(cuò)誤:configure: error: Cannot find OpenSSL's <evp.h>
解決:yum install openssl openssl-devel
錯(cuò)誤:configure: error: Please reinstall the libcurl distribution -easy.h should be in <curl-dir>/include/curl/
解決:yum install curl curl-devel
錯(cuò)誤:configure: error: Cannot find ldap.h
解決:yum install openldap openldap-devel
錯(cuò)誤:configure: error: libjpeg.(a|so) not found
解決:yum install libjpeglibjpeg -devel
錯(cuò)誤:configure: error: libpng.(a|so) not found.
解決:yum install libpnglibpng –devel
錯(cuò)誤:onfigure: error: freetype.h not found.
解決:yum install freetype-devel
錯(cuò)誤:configure: error: cannot find output from lex; giving up
解決:yum -y install flex
錯(cuò)誤:configure: error: mod_deflate has been requested but can not be built due to prerequisite failures
解決:yum -y install zlib-devel openssl-devel
錯(cuò)誤:Configure: error: Unable to locate gmp.h
解決:yum install gmp-devel
錯(cuò)誤:Configure: error: Cannot find MySQL header files under /usr.
Note that the MySQL client library is not bundled anymore!
解決:yum install mysql-devel
更多的補(bǔ)充內(nèi)容:
安裝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模塊的時(shí)候,需要運(yùn)行phpize
得到了一個(gè)錯(cuò)誤
#/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下執(zhí)行 yum install autoconf 即可
Ubuntu下執(zhí)行 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
根據(jù)你自己的選擇將
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
將文件其中的下列代碼進(jìn)行修改
/* 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. */
保存文件退出
然后我們就可以在這個(gè)目錄下使用上面的命令了
/usr/local/php/bin/phpize
執(zhí)行以后會(huì)看到下面的
[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]#
然后執(zhí)行./configure --with-php-config=/usr/local/php/bin/php-config
然后執(zhí)行make
make install
然后他會(huì)把對(duì)應(yīng)的so文件生成放到PHP安裝目錄下面的一個(gè)文件夾,并提示在在什么地方,然后再把里面的SO文件拷到你存放SO文件的地方
即你在php.ini里面的extension_dir所指定的位置
最后一步是你在php.ini文件中打開這個(gè)擴(kuò)展
extension=sdomain.so
然后
重新起動(dòng)apache
以上錯(cuò)誤都是在整個(gè)編譯安裝遇到的問題,然后結(jié)合網(wǎng)上的資料,找到的解決方法,總結(jié)到這個(gè)地方,希望能幫到大家!
解決:yum -y install libevent libevent-devel
錯(cuò)誤:configure: error: Please reinstall the mysql distributio
解決:yum -y install mysql-devel
錯(cuò)誤:make: *** [sapi/fpm/php-fpm] error 1
解決:用make ZEND_EXTRA_LIBS='-liconv'編譯
錯(cuò)誤:configure: error: XML configuration could not be found
解決:yum -y install libxml2 libxml2-devel
錯(cuò)誤:configure: error: No curses/termcap library found
解決:yum -y install ncurses ncurses-devel
錯(cuò)誤:configure: error: xml2-config not found
解決:yum -y install libxml2 libxml2-devel
錯(cuò)誤:configure: error: Cannot find OpenSSL's <evp.h>
解決:yum install openssl openssl-devel
錯(cuò)誤:configure: error: Please reinstall the libcurl distribution -easy.h should be in <curl-dir>/include/curl/
解決:yum install curl curl-devel
錯(cuò)誤:configure: error: Cannot find ldap.h
解決:yum install openldap openldap-devel
錯(cuò)誤:configure: error: libjpeg.(a|so) not found
解決:yum install libjpeglibjpeg -devel
錯(cuò)誤:configure: error: libpng.(a|so) not found.
解決:yum install libpnglibpng –devel
錯(cuò)誤:onfigure: error: freetype.h not found.
解決:yum install freetype-devel
錯(cuò)誤:configure: error: cannot find output from lex; giving up
解決:yum -y install flex
錯(cuò)誤:configure: error: mod_deflate has been requested but can not be built due to prerequisite failures
解決:yum -y install zlib-devel openssl-devel
錯(cuò)誤:Configure: error: Unable to locate gmp.h
解決:yum install gmp-devel
錯(cuò)誤:Configure: error: Cannot find MySQL header files under /usr.
Note that the MySQL client library is not bundled anymore!
解決:yum install mysql-devel
更多的補(bǔ)充內(nèi)容:
安裝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模塊的時(shí)候,需要運(yùn)行phpize
得到了一個(gè)錯(cuò)誤
#/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下執(zhí)行 yum install autoconf 即可
Ubuntu下執(zhí)行 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
根據(jù)你自己的選擇將
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
將文件其中的下列代碼進(jìn)行修改
/* 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. */
保存文件退出
然后我們就可以在這個(gè)目錄下使用上面的命令了
/usr/local/php/bin/phpize
執(zhí)行以后會(huì)看到下面的
[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]#
然后執(zhí)行./configure --with-php-config=/usr/local/php/bin/php-config
然后執(zhí)行make
make install
然后他會(huì)把對(duì)應(yīng)的so文件生成放到PHP安裝目錄下面的一個(gè)文件夾,并提示在在什么地方,然后再把里面的SO文件拷到你存放SO文件的地方
即你在php.ini里面的extension_dir所指定的位置
最后一步是你在php.ini文件中打開這個(gè)擴(kuò)展
extension=sdomain.so
然后
重新起動(dòng)apache
以上錯(cuò)誤都是在整個(gè)編譯安裝遇到的問題,然后結(jié)合網(wǎng)上的資料,找到的解決方法,總結(jié)到這個(gè)地方,希望能幫到大家!
相關(guān)文章
Zend Studio去除編輯器的語法警告設(shè)置方法
Zend Studio是PHP開發(fā)者的首選開發(fā)工具,其地位相當(dāng)于微軟開發(fā)工具中的Visual Studio。Zend Studio的編輯器可以幫我們指出語法錯(cuò)誤和警告,但是太多的警告有時(shí)讓我們的代碼看起來很亂,很不舒服2012-10-10
PHP的serialize序列化數(shù)據(jù)以及JSON格式化數(shù)據(jù)分析
這篇文章的內(nèi)容是PHP的serialize序列化數(shù)據(jù)以及JSON格式化數(shù)據(jù)分析,需要的朋友可以參考下2015-10-10
PHP JSON出錯(cuò):Cannot use object of type stdClass as array解決方法
這篇文章主要介紹了PHP JSON出錯(cuò):Cannot use object of type stdClass as array解決方法,需要的朋友可以參考下2014-08-08
php array_filter除去數(shù)組中的空字符元素
php array_filter除去數(shù)組中的空字符元素,array_filter() 函數(shù)根據(jù)回調(diào)函數(shù)過濾數(shù)組中的值,省略回調(diào)函數(shù)則默認(rèn)過濾空值,需要的朋友可以參考下。2011-11-11
php強(qiáng)大的時(shí)間轉(zhuǎn)換函數(shù)strtotime
在php中strtotime() 函數(shù)將任何英文文本的日期時(shí)間描述解析為 Unix 時(shí)間戳,這個(gè)函數(shù)也是我們經(jīng)常會(huì)用到的,有需要的朋友參考一下2016-02-02
探討多鍵值cookie(php中cookie存取數(shù)組)的詳解
本篇文章是對(duì)多鍵值cookie(php中cookie存取數(shù)組)進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下2013-06-06
攻克CakePHP系列一 連接MySQL數(shù)據(jù)庫(kù)
請(qǐng)先參閱以前寫的文章以便對(duì)CakePHP有所了解文章,上一篇2008-10-10
用php代碼限制國(guó)內(nèi)IP訪問我們網(wǎng)站
這篇文章主要介紹了用php代碼限制國(guó)內(nèi)IP訪問我們網(wǎng)站,需要的朋友可以參考下2015-09-09

