Home > PHP Framework > Swoole > body text

What to do if swoole mac compilation error occurs

藏色散人
Release: 2020-04-09 10:20:44
Original
2229 people have browsed it

What to do if swoole mac compilation error occurs

swoole What should I do if there is a mac compilation error? Possible errors when installing swoole on mac

Please read this before proceeding

1. Use pecl to install swoole (not installed)

In April 2018, due to changes in homebrew, it was impossible to use brew install to install php extensions. Now it is installed using pecl. The method of pecl installing swoole is:

pecl install swoole
Copy after login

Appears in the options Fill in yes or no

Possible errors and solutions

1 fatal error: 'openssl/ssl.h' file not found

Solution 1: cp -R /usr/local/opt/openssl/include/openssl /usr/local/include

Solution 2: ln -s /usr/local/opt/openssl/include/openssl /usr/local/include/ openssl

Reason: Generally, software installed with brew will automatically put the files that need to be included in /usr/local/include, but I don’t know why it was not put there when installing openssl, so I have to copy it myself. In the past, the best way was actually to make a link, that is, use solution 2!

2 error: Cannot find libpq-fe.h. Please confirm the libpq or specify correct PostgreSQL(libpq) installation path

Solution brew reinstall PostgreSQL

Cause: Possible PostgreSQL is not installed

3 fatal error: 'hiredis/hiredis.h' file not found

Most of the reasons for this are because hiredis is not installed. Use brew search hiredis to see if it is. Installation. If there is no installation, just use brew install hiredis to install it. Then pecl install swoole again.

Careful children will find that after brew install hiredis, there is an extra hiredis in /usr/local/include, and this It is a soft link, linked to /usr/local/Cellar/hiredis/0.13.3/include/hiredis

The result is still an error, it is not solved, and the ability is limited.

2. Change it Way to install swoole (perfect solution)

2.1 Download swoole

sudo pecl download swoole
Copy after login

2.2 Compile and install

tar zxvf swoole-4.2.12.tgz    // 注意自己下载的版本,可能不一定
cd swoole-4.2.12
phpize
./configure --enable-openssl --enable-http2 --enable-sockets --enable-mysqlnd -with-openssl-dir=/usr/local/Cellar/openssl/1.0.2s/
make clean && make && sudo make install
Copy after login

2.3 Encounter an error

mkdir: /usr/local/Cellar/php@7.1/7.1.30/pecl: File exists
mkdir: /usr/local/Cellar/php@7.1/7.1.30/pecl: No such file or directory
make: *** [install-modules] Error 1
// 大致意思就是 pecl  文件夹存在,但是打不开
// 我的pecl是软连接过来的 不知道为什么打不开
Copy after login

2.4 Solution

Modify /usr/local/Cellar/php@7.1/7.1.30/bin/php-config

extension_dir=‘/usr/local/Cellar/php@7.1/7.1.30/pecl/20160303‘ 中的 『pecl』 换成 『lib/php』
extension_dir=‘/usr/local/Cellar/php@7.1/7.1.30/lib/php/20160303‘
Copy after login

2.5 Recompile

./configure --enable-openssl --enable-http2 --enable-sockets --enable-mysqlnd -with-openssl-dir=/usr/local/Cellar/openssl/1.0.2s/
make clean && make && sudo make install
Copy after login

2.6 Add swoole.so

Modify php.ini and add a line at the end of the file

extension = "/usr/local/Cellar/php@7.1/7.1.30/lib/php/20160303/swoole.so"
Copy after login

It really hurts to install swoole on mac

The above is the detailed content of What to do if swoole mac compilation error occurs. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!