Download the source code package from the official website: https://www.php.net/downloads.php
Steps:
1. Unzip
Command: tar -xjvf php.tar.bz2
2. configure
The configure tool is a shell script that requires gcc and autoconfig tools before configuration and compilation.
Related recommendations: "php tutorial"
You can view the configuration parameters through ./configure --help
Enter decompression After the PHP directory, compile the source code:
./configure --prefix=/home/php (--prefix specifies the path to install PHP)
3 , make
Execute the compile and build command: make
4, make install
Execute the compile Build command: make install
Note: Execute command: php -i | grep php.ini Check the php.ini path of php execution, copy the configuration file php.ini file to the directory, otherwise load it Configuration file failed
PHP command:
php -m View php extension
php -v View version
php --ini Check the php.ini path
php --ri swoole Check whether the swoole expansion is successful
mac pro configure php environment variables
vim ~/.bash_profile
Add: alias php=/home/php/bin/php Save
source ~/.bash_profile
The above is the detailed content of How to install php source code. For more information, please follow other related articles on the PHP Chinese website!