search
HomePHP FrameworkSwooleWhat to do if swoole mac compilation error occurs

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

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!

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
How can I contribute to the Swoole open-source project?How can I contribute to the Swoole open-source project?Mar 18, 2025 pm 03:58 PM

The article outlines ways to contribute to the Swoole project, including reporting bugs, submitting features, coding, and improving documentation. It discusses required skills and steps for beginners to start contributing, and how to find pressing is

How do I extend Swoole with custom modules?How do I extend Swoole with custom modules?Mar 18, 2025 pm 03:57 PM

Article discusses extending Swoole with custom modules, detailing steps, best practices, and troubleshooting. Main focus is enhancing functionality and integration.

How do I use Swoole's asynchronous I/O features?How do I use Swoole's asynchronous I/O features?Mar 18, 2025 pm 03:56 PM

The article discusses using Swoole's asynchronous I/O features in PHP for high-performance applications. It covers installation, server setup, and optimization strategies.Word count: 159

How do I configure Swoole's process isolation?How do I configure Swoole's process isolation?Mar 18, 2025 pm 03:55 PM

Article discusses configuring Swoole's process isolation, its benefits like improved stability and security, and troubleshooting methods.Character count: 159

How does Swoole's reactor model work under the hood?How does Swoole's reactor model work under the hood?Mar 18, 2025 pm 03:54 PM

Swoole's reactor model uses an event-driven, non-blocking I/O architecture to efficiently manage high-concurrency scenarios, optimizing performance through various techniques.(159 characters)

How do I troubleshoot connection issues in Swoole?How do I troubleshoot connection issues in Swoole?Mar 18, 2025 pm 03:53 PM

Article discusses troubleshooting, causes, monitoring, and prevention of connection issues in Swoole, a PHP framework.

What tools can I use to monitor Swoole's performance?What tools can I use to monitor Swoole's performance?Mar 18, 2025 pm 03:52 PM

The article discusses tools and best practices for monitoring and optimizing Swoole's performance, and troubleshooting methods for performance issues.

How do I resolve memory leaks in Swoole applications?How do I resolve memory leaks in Swoole applications?Mar 18, 2025 pm 03:51 PM

Abstract: The article discusses resolving memory leaks in Swoole applications through identification, isolation, and fixing, emphasizing common causes like improper resource management and unmanaged coroutines. Tools like Swoole Tracker and Valgrind

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
Will R.E.P.O. Have Crossplay?
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Safe Exam Browser

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

WebStorm Mac version

Useful JavaScript development tools

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Atom editor mac version download

Atom editor mac version download

The most popular open source editor