How to compile and install PHP?

Guanhui
Release: 2023-03-02 22:56:01
Original
2647 people have browsed it

How to compile and install PHP?

How to compile and install PHP?

First use the "wget" command to download and decompress PHP;

wget http://am1.php.net/distributions/php-7.3.2.tar.gz    
tar -zxvf php-7.3.2.tar.gz
Copy after login

Then execute the command "./configure --prefix=/opt/soft/php --enable-fpm "Compile;

./configure --prefix=/opt/soft/php --enable-fpm
Copy after login

Finally execute "make install" to install.

 sudo make install
Copy after login

Configuring PHP

In the previously compiled source code package, find php.ini-production, copy it to /usr/local/php, and rename it to php .ini:

$ cp php.ini-production /usr/local/php/php.ini
Copy after login

[Optional] Set PHP error messages to be printed on the page

$ vim /usr/local/php/php.ini
Copy after login
display_errors = On
Copy after login

Copy the startup script:

$ cp ./sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
$ chmod +x /etc/init.d/php-fpm
Copy after login

Modify the php-fpm configuration file:

$ cd /usr/local/php/etc
$ cp php-fpm.conf.default php-fpm.conf
$ vim php-fpm.conf
Copy after login

Remove the semicolon in front of pid = run/php-fpm.pid

$ cd php-fpm.d
$ cp www.conf.default www.conf
$ vim www.conf
Copy after login

Modify the users of user and group to the current user (you can also leave it unchanged, the user and user group nobody will be added by default) )

Recommended tutorial: "PHP"

The above is the detailed content of How to compile and install PHP?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!