Home  >  Article  >  Backend Development  >  How to install php5

How to install php5

藏色散人
藏色散人Original
2021-03-17 10:24:192158browse

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.

How to install php5

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&#39;s <evp&#39;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

How to install php5

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn