Startup
The server Ubuntu14.04 has a post-lamp development environment , but still can't successfully compile the php source code, here is the compilation process.
Get source code and compile
Make sure git is installedsudo apt-get install git -y
, because you can see the content and log information of each PHP modification and follow up with updates from the author.
git clone https://github.com/php/php-src.git cd php-src sudo apt-get install build-essential ./buildconf ./configure --disable-all # 为了尽快得到可以测试的环境,我们仅编译一个最精简的PHP make ./sapi/cli/php -v
The -v parameter indicates the output version number. If the php version information is output after the command is executed, the compilation is successful.
Error set
Error
configure: error: xml2-config not found. Please check your libxml2 installation.
Solutionapt-get install libxml2-dev
Error
/usr/bin/mysql_config: No such file or directory
Solutionapt-get install mysql-server mysql-client libmysqlclient-dev
Error
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 43 Warning: 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.4 Warning: 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.3 Warning: 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 76 Warning: 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.5 Wrote PEAR system config file at: /root/php7/usr/etc/pear.conf
Solution
`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`
Error
configure: WARNING: unrecognized options: --with-mysql
Error
checking for bison version... invalid configure: WARNING: This bison version is not supported for regeneration of the Zend/PHP parsers (found: none, min: 204, excluded: ). checking for re2c... no configure: 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!
Solutionapt-get install bison
Error
configure: error: Cannot find OpenSSL's
Solutionapt-get install libssl-dev
Error
configure: error: Cannot find OpenSSL's libraries
Solutionapt -get install libssl-dev
Error
checking for BZip2 in default path… not found configure: error: Please reinstall the BZip2 distribution
Solutionapt-get install libbz2-dev
Error
configure: error: Please reinstall the libcurl distribution – easy.h should be in /include/curl/
Solutionapt-get install libcurl4-openssl-dev
Error
If configure fails try --with-vpx-dir= configure: error: jpeglib.h not found.
Solutionapt-get install libjpeg- dev
Error
configure: error: png.h not found.
Solutionapt-get install libpng12-dev
Error
configure: error: freetype-config not found.
Solutionapt-get install libfreetype6-dev
Error
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
Solutionapt-get install libmcrypt-dev
Error
configure: error: Cannot find pspell
Solutionapt-get install libpspell-dev
Error
PEAR package PHP_Archive not installed: generated phar will require PHP's phar extension be enabled.
Solutionpear install pear/PHP_Archive
Error
checking for recode support... yes configure: error: Can not find recode.h anywhere under /usr /usr/local /usr /opt.
Solutionapt-get install librecode-dev