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
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
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
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是软连接过来的 不知道为什么打不开
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‘
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
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"
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!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

WebStorm Mac version
Useful JavaScript development tools
