##Method 1: PECL installation
Install dependency packages
apt-get install libpcre3 libpcre3-dev
Copy after login
Install swoole
pecl install swoole
Copy after login
Modify PHP configuration php.ini Load swoole
Verify installation and loading:
php -m | grep swoole
Copy after login
Method 2: Source code compilation and installation
1. Download swoole
Download the source code package, decompress it, and switch to the decompression directory
wget -c https://github.com/swoole/swoole-src/archive/v2.0.6.tar.gz
Copy after login
Decompression: tar -zxvf v2.0.6.tar.gz
cd swoole- src-2.0.6/
2. Compile and install
Use phpize to generate PHP compilation configuration
.configure for compilation configuration detection
make Compile make install and install
Execute command:
phpize
./configure
make
make install
Under normal circumstances, it will appear
Installing shared extensions: /usr/lib64/php/modules
Indicates that the swoole.so file is generated in the above directory/usr/lib64/php/modules
3. Modify the configuration file and load the module
Add the swoole module to the PHP configuration file php.ini. Note that the PHP7 module configuration file is separate and only needs to be in /etc/php. Add the module configuration file swoole.ini to the d/ directory to
Enter /etc/php.d/ and execute the command
vim swoole.ini
In swoole.ini Enter
;Enable swoole extension module
extension=swoole.so
Save.
Recommended learning:
swoole video tutorial
The above is the detailed content of How to install swoole. For more information, please follow other related articles on the PHP Chinese website!