How to install php5: First download the PHP5 source code package; then compile and install through the "make && make install" command; then copy a file to make the configuration file; finally check the PHP information.
The operating environment of this article: windows7 system, PHP5 version, DELL G3 computer
PHP5 installation
Go to the src directory cd /usr/local/src
Download the PHP5 source code package wget http://cn2.php.net/distributions/php-5.6.37.tar.gz
Extract the downloaded file tar -zxvf php-5.6.37.tar.gz
Enter the file directory cd php-5.6.37
configure ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-pdo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-zlib-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl-dir=/usr/include/openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif
View the error message
checking for xml2-config path… configure: error: xml2-config not found. Please check your libxml2 installation.
Solution The method is as follows. After completion, execute configure
yum install libxml2-devel -y yum install libxml2 -y
to view the error message
configure:error: cannot find OpenSSL's <evp'h>
. The solution is as follows. After completion, change --with-openssl to --with-openssl-dir= when executing configure again. /usr/include/openssl. Or you can directly execute yum install -y openssl-devel without changing the command.
export PHP_OPENSSL_DIR=yes
View the error message
configure:error:please reinstall the BZip2 distribution
The solution is as follows, and continue configure after completion
yum install bzip2-devel -y
View the error message
configure:error:jpeglib.h not found
The solution is as follows, and continue configure after completion
yum install libjpeg-devel -y
Check the error message
png.h not found
After solving the problem, continue configure
yum install libpng-devel
Check the error message
freetype-config not found
After solving the problem, continue configure
yum install freetype-devel -y
Check the error message
mcrypt.h not found please reinstall libmcrypt
After solving the problem, continue configure
yum install libmcrypt-devel -y
When this interface appears, you can compile and install it
make && make install
After compiling and installing, you need to copy a file Make the configuration file. The source file is under /usr/local/src/php-5.6.37. cp php.ini-development /usr/local/php/etc/php.ini
to check whether the configuration is loaded. file, this command can view PHP information, including compilation parameters, configure path, etc.
/usr/local/php/bin/php -i |less
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of How to install php5. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

WebStorm Mac version
Useful JavaScript development tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function
