This article is about starting to learn Swoole: PHP7 Swoole installation steps, there is a certain reference value, there is a need for a friend can refer to it, I hope to help you.
The environment
Apache is no longer used as a Web server. Nginx + PHP-FPM, more powerful performance, more convenient configuration. And to keep up with PHP, newer versions of PHP are used
- [x] centos7
- [x] php7.0.12
- Nginx / 1.10.2 [x]
- [x] php-fpm
Download swoole
Start by downloading swoole’s source code package, which is a no-fuss operation. (No wget: brew install wget– MAC)
Wget -c https://github.com/swoole/swoole-src/archive/v2.0.6.tar.gz extract: tar ZXVF - v2.0.6. Tar. GzcdSwoole - SRC - 2.0.6 /Copy the code
Compile & Install
Use phpize to generate a PHP build configuration
./configure to do compilation configuration detection
Make compile and make install install
Command execution:
[root @ php7 swoole SRC - 2.0.6]# phpize[root @ php7 swoole SRC - 2.0.6]# ./configure[root @ php7 swoole SRC - 2.0.6]# make && make install
Copy the code
After make install, if correct, the following content appears
[root @ php7 swoole SRC - 2.0.6]# make install
Installing shared extensions: /usr/lib64/php/modules/
Copy the code
This means that the swoole.so file was successfully generated in /usr/lib64/php.modules /
Modifying a Configuration File
/usr/local/php5-7.0.12-20161101-102255/lib/php.ini /usr/local/php5-7.0.12-20161101-102255
To be able to use this module, you also need to add it to the php.ini file.
Note here that php7’s module configuration files are separate.
You can find the following in php.ini
;;;;
; Note: packaged extension modules are now loaded via the .ini files
; found in the directory /etc/php.d; these are loaded by default.
;;;;
Therefore, if your PHP installation is not specified, you can find the configuration file to add modules in the /etc/php.d directory.
Go to the CD /etc/php.d directory and complete the configuration
[root @ php7 swoole SRC - 2.0.6]# vim swoole.ini
; Enable swoole extension module
extension=swoole.so
Copy the code
Restart the service
echo phpinfo(); See if the swoole load succeeded
Install the ide – helper:
Clone the following address:
Github.com/eaglewu/swo…
github.com
I hope the above content can help you. Many PHPer will encounter some problems and bottlenecks when they are advanced, and they have no sense of direction when writing too many business codes. I have sorted out some information, including but not limited to: Distributed architecture, high scalability, high performance, high concurrency, server performance tuning, TP6, Laravel, YII2, Redis, Swoole, Swoft, Kafka, Mysql optimization, shell scripting, Docker, microservices, Nginx, etc.