Configuring Swoole on Linux

Source: Internet
Author: User
Tags fpm phpinfo

1. First we want to install the swoole extension, we need to download its package, is:

Https://github.com/swoole/swoole-src

I QQ group also has a lot of technical documents, I hope to provide you with some help (non-technical not to add).

QQ Group: 281442983 (click the link to join the group: http://jq.qq.com/?_wv=1027&k=29LoD19)

2. Unzip after downloading:

unzip swoole-src-master.zip

3. Unzip the unpacked directory after unpacking, I was extracted under the directory/opt, so

cd /opt/swoole-src-master

4. Then recompile PHP with Phpize and execute the command:

 /usr/bin/phpize

If you can't find the Phpize file, you can use the command to find it, preferably in the root directory, so it can start looking from the root directory:

find -name phpize

If your system does not have Phpize installed, execute the command to install it, the instructions are:

yum install php-devel

5. Then configure the command to:

 ./configure --with-php-config=/usr/bin/php-config

Because my php-config file is under/usr/bin/, so as long as you use your own php-config path on it, the others are consistent

6. After the configuration is done, compile the installation:

make && make install

But there may be a problem in this step:

/usr/include/php/ext/pcre/php_pcre.h:29:18: error: pcre.h: No such file or directory

This error is caused by not installing pcre-devel, all as long as the installation is available

yum install pcre-devel

7. After installation, a path is output, which is to generate the swoole.so file path, and then configure PHP.ini to configure the path:

extension=/usr/lib/php/modules/swoole.so

8. Then restart the server

service httpd restart


by Php-m or phpinfo () to see if the Swoole was successfully loaded, you can use Php-i |grep php.ini to navigate to the absolute path of the php.ini if it is not possible that the php.ini path is incorrect.

Quick view of current Swoole version
php --re swoole|grep VERSION
错误解决:
Pcre.h:no such file or directory

Compiler swoole Extension appears

fatal error: pcre.h: No such file or directory

The reason is the lack of pcre and the need to install Libpcre

Ubuntu/debian:
apt-get install libpcre3 libpcre3-dev
Centos/redhat:
yum install pcre-devel
 
In the phpinfo there is no in the php-m

After compiling and installing Swoole, there are php-fpm/apache in the Phpinfo page, not in the command line php-m. The reason may be that Cli/php-fpm/apache uses a different php.ini configuration

First, confirm the location of the php.ini

CLI command line

php -i|grep php.ini

Php-fpm/apache, check the phpinfo page number to find the absolute path to php.ini.

Second, check the corresponding php.ini whether there is extension=swoole.so
cat /usr/local/lib/php.ini | grep swoole.so




My_global.h:no such file or directory

PHP is missing mysqln, please check the PHP compilation parameters.

php -i | grep configure

or view the Configure item in the Phpinfo page

When compiling PHP, be sure to include the./configure parameter.

 --enable-mysqlnd --with-mysqli
 
I QQ group also has a lot of technical documents, I hope to provide you with some help (non-technical not to add).

QQ Group: 281442983 (click the link to join the group: http://jq.qq.com/?_wv=1027&k=29LoD19)

 

Configuring Swoole on Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.