Home  >  Article  >  PHP Framework  >  What should I do if I get an error when accessing swoole?

What should I do if I get an error when accessing swoole?

藏色散人
藏色散人Original
2020-04-10 09:23:422224browse

What should I do if I get an error when accessing swoole?

swooleWhat should I do if I get an access error?

Some experience in swoole installation and error reporting

When I first learned swoole, I summarized some minor problems that occurred during the installation and shared them here.

Environment dependencies:

swoole-1.x requires php-5.3.10 or higher, swoole-2.x requires php-7.0.0 or higher.

Installation: (The following are the installation steps I performed)

[root@dev ~]# cd /usr/local/src

Download

[root@dev src]# wget http://pecl.php.net/get/swoole-1.9.3.tgz

Unzip

[root@dev src]# tar -zxvf swoole-1.9.3.tgz

Find the location of phpize, find / -name phpize

[root@dev src]# cd swoole-1.9.3[root@dev swoole-1.9.3]# /usr/local/php/bin/phpize

There are no parameters in the swoole document

[root@dev swoole-1.9.3]# ./configure
[root@dev swoole-1.9.3]# make && make install

Then configure it in php.ini and use phpinfo to find the location of php.ini

[root@dev swoole-1.9.3]# vim /etc/php.ini
extension=swoole.so

After completion, restart the service php-fpm restart, and then report the following error:

swoole: Unable to initialize module Module compiled with module API=20090626
PHP compiled with module API=20121212 These options need to match in Unknown on line 0

Every time swoole.so is compiled, it will appear in the /usr/lib/php/modules/ directory, and will overwrite the original

Modify extension=/usr/lib/php/modules/swoole.so, the error is still the same.

Second reinstallation:

Other steps remain unchanged, modify ./configure

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

In the above instructions, use php -v to check the version of php in the server. Mine is php-5.6.27

Then make && make install are executed separately, first execute make, then execute make install,

make install prompts this path /usr/local/php /lib/php/extensions/no-debug-non-zts-20131226/

Modify extension=swoole.so

extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/swoole.so

service php-fpm restart, no error is reported

php -m, swoole is available.

Check phpinfo, the swoole extension is also available.

Note: In addition, when I installed it for the first time, php was version 5.6.27 and swoole was version 1.9.3. Although swoole seemed to be installed successfully, it was not actually successful.

The reason may be that the swoole version is a bit higher, or it may be other environment-dependent issues. The version will be lowered later, php is version 5.4.45, and swoole is version 1.7.6. So if other friends encounter installation problems that they don’t understand, it’s a good idea to ask others first. If it doesn’t work, changing the version is also a good choice.

The above is the detailed content of What should I do if I get an error when accessing swoole?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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