Home > Backend Development > PHP Problem > How to install php5

How to install php5

藏色散人
Release: 2023-03-08 19:00:02
Original
2294 people have browsed it

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
Copy after login

View the error message

checking for xml2-config path… 
configure: error: xml2-config not found. Please check your libxml2 installation.
Copy after login

Solution The method is as follows. After completion, execute configure

yum install libxml2-devel -y 
yum install libxml2 -y
Copy after login

to view the error message

configure:error: cannot find OpenSSL&#39;s <evp&#39;h>
Copy after login

. 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
Copy after login

View the error message

configure:error:please reinstall the BZip2 distribution
Copy after login

The solution is as follows, and continue configure after completion

yum install bzip2-devel -y
Copy after login

View the error message

configure:error:jpeglib.h not found
Copy after login

The solution is as follows, and continue configure after completion

yum install libjpeg-devel -y
Copy after login

Check the error message

png.h  not found
Copy after login

After solving the problem, continue configure

yum install libpng-devel
Copy after login

Check the error message

freetype-config not found
Copy after login

After solving the problem, continue configure

yum install freetype-devel -y
Copy after login

Check the error message

mcrypt.h not found please reinstall libmcrypt
Copy after login

After solving the problem, continue configure

yum install libmcrypt-devel -y
Copy after login

How to install php5

When this interface appears, you can compile and install it

make && make install
Copy after login

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
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template