编译php源码错误集与解决
起步服务器ubuntu14.04已后lamp开发环境,却还是没有不能顺利编译php源码,在此整理编译过程。
获取源码与编译确保已安装了gitsudo apt-get install git -y,因为这可以看到php每次修改的内容及日志信息和跟进作者的更新。
git clone https://github.com/php/php-src.gitcd php-srcsudo apt-get install build-essential./buildconf./configure --disable-all # 为了尽快得到可以测试的环境,我们仅编译一个最精简的phpmake./sapi/cli/php -v
-v参数表示输出版本号,如果命令执行完后看到输出php版本信息则说明编译成功。
错误集错误
configure: error: xml2-config not found. please check your libxml2 installation.
解决
apt-get install libxml2-dev
错误
/usr/bin/mysql_config: no such file or directory
解决
apt-get install mysql-server mysql-client libmysqlclient-dev
错误
warning: declaration of pear_installer::download() should be compatible with & pear_downloader::download($params) in phar:///root/php7/php-src/pear/install-pear-nozlib.phar/pear/installer.php on line 43warning: declaration of pear_packagefile_parser_v2::parse() should be compatible with pear_xmlparser::parse($data) in phar:///root/php7/php-src/pear/install-pear-nozlib.phar/pear/packagefile/parser/v2.php on line 113[pear] archive_tar - installed: 1.3.13[pear] console_getopt - installed: 1.3.1[pear] structures_graph- installed: 1.0.4warning: declaration of pear_task_replace::init() should be compatible with pear_task_common::init($xml, $fileattributes, $lastversion) in phar:///root/php7/php-src/pear/install-pear-nozlib.phar/pear/task/replace.php on line 31[pear] xml_util - installed: 1.2.3warning: declaration of pear_task_windowseol::init() should be compatible with pear_task_common::init($xml, $fileattributes, $lastversion) in phar:///root/php7/php-src/pear/install-pear-nozlib.phar/pear/task/windowseol.php on line 76warning: declaration of pear_task_unixeol::init() should be compatible with pear_task_common::init($xml, $fileattributes, $lastversion) in phar:///root/php7/php-src/pear/install-pear-nozlib.phar/pear/task/unixeol.php on line 76[pear] pear - installed: 1.9.5wrote pear system config file at: /root/php7/usr/etc/pear.conf
解决
`you may want to add: /root/php7/usr/lib/php to your php.ini include_path
/root/php7/php-src/build/shtool install -c ext/phar/phar.phar /root/php7/usr/bin`
错误
configure: warning: unrecognized options: --with-mysql
错误
checking for bison version... invalidconfigure: warning: this bison version is not supported for regeneration of the zend/php parsers (found: none, min: 204, excluded: ).checking for re2c... noconfigure: warning: you will need re2c 0.13.4 or later if you want to regenerate php parsers.configure: error: bison is required to build php/zend when building a git checkout!
解决
apt-get install bison
错误
configure: error: cannot find openssl's
解决
apt-get install libssl-dev
错误
configure: error: cannot find openssl's libraries
解决
apt-get install libssl-dev
错误
checking for bzip2 in default path… not foundconfigure: error: please reinstall the bzip2 distribution
解决
apt-get install libbz2-dev
错误
configure: error: please reinstall the libcurl distribution –easy.h should be in /include/curl/
解决
apt-get install libcurl4-openssl-dev
错误
if configure fails try --with-vpx-dir=configure: error: jpeglib.h not found.
解决
apt-get install libjpeg-dev
错误
configure: error: png.h not found.
解决
apt-get install libpng12-dev
错误
configure: error: freetype-config not found.
解决
apt-get install libfreetype6-dev
错误
configure: error: mcrypt.h not found. please reinstall libmcrypt.
解决
apt-get install libmcrypt-dev
错误
configure: error: cannot find pspell
解决
apt-get install libpspell-dev
错误
pear package php_archive not installed: generated phar will require php's phar extension be enabled.
解决
pear install pear/php_archive
错误
checking for recode support... yesconfigure: error: can not find recode.h anywhere under /usr /usr/local /usr /opt.
解决
apt-get install librecode-dev
推荐学习:《php视频教程》
以上就是分享编译php源码错误集与解决方案的详细内容。