Install swoole on MAC. Problems with MAMP

Source: Internet
Author: User
Install swoole on a MAC, and follow the instructions in this document. The details are as follows: I switched the system's php to MAMP's php, and then installed swoole. Swoole is already in the final php-m command, but swoole cannot be found in phpinfo, and then use the following code to test {... install swoole on MAC. The installation is successful following the instructions. The details are as follows:
I switched the system's php to MAMP's php, and then installed swoole. Swoole is already in the final php-m command, but swoole cannot be found in phpinfo.
Then use the following code to test


  Client = new swoole_client (SWOOLE_SOCK_TCP);} public function connect () {if (! $ This-> client-> connect ("127.0.0.1", 9501, 1) {echo "Error: {$ fp-> errMsg} [{$ fp-> errCode}] \ n ";}$ message = $ this-> client-> recv (); echo "Get Message From Server: {$ message} \ n"; fwrite (STDOUT, "Enter the Message:"); $ msg = trim (fgets (STDIN )); $ this-> client-> send ($ msg);} public function test () {$ this-> client = new swoole_client (SWOOLE_SOCK_TCP );}} $ client = new Client (); $ client-> connect ();

Return Value:

Fatal error: Class 'swoole _ client' not found in/Applications/MAMP/htdocs/swoole_example/01/swoole_simple_client.php on line 8

Updated on)
On the other side:
Php-I | grep swoole
Return

swooleswoole support => enabledswoole.aio_thread_num => 2 => 2swoole.display_errors => On => Onswoole.message_queue_key => 0 => 0swoole.unixsock_buffer_size => 8388608 => 8388608

Php-I | more

Configuration File (php.ini) Path => /Applications/MAMP/bin/php/php5.5.18/confLoaded Configuration File => /Applications/MAMP/bin/php/php5.5.18/conf/php.ini,

In phpinfo

Configuration File (php.ini) Path=>/Applications/MAMP/bin/php/php5.5.18/confLoaded Configuration File=>/Library/Application Support/appsolute/MAMP PRO/conf/php.ini

It is found that only Loaded Congiguration File is different,
First
1./Applications/MAMP/bin/php/php5.5.18/conf/php. ini has written extension = swoole. so
2/Library/Application Support/appsolute/mamp pro/conf/php. ini without swoole. so
3. Restart MAMP.

Reply content:

Install swoole on MAC. The installation is successful following the instructions. The details are as follows:
I switched the system's php to MAMP's php, and then installed swoole. Swoole is already in the final php-m command, but swoole cannot be found in phpinfo.
Then use the following code to test


  Client = new swoole_client (SWOOLE_SOCK_TCP);} public function connect () {if (! $ This-> client-> connect ("127.0.0.1", 9501, 1) {echo "Error: {$ fp-> errMsg} [{$ fp-> errCode}] \ n ";}$ message = $ this-> client-> recv (); echo "Get Message From Server: {$ message} \ n"; fwrite (STDOUT, "Enter the Message:"); $ msg = trim (fgets (STDIN )); $ this-> client-> send ($ msg);} public function test () {$ this-> client = new swoole_client (SWOOLE_SOCK_TCP );}} $ client = new Client (); $ client-> connect ();

Return Value:

Fatal error: Class 'swoole _ client' not found in/Applications/MAMP/htdocs/swoole_example/01/swoole_simple_client.php on line 8

Updated on)
On the other side:
Php-I | grep swoole
Return

swooleswoole support => enabledswoole.aio_thread_num => 2 => 2swoole.display_errors => On => Onswoole.message_queue_key => 0 => 0swoole.unixsock_buffer_size => 8388608 => 8388608

Php-I | more

Configuration File (php.ini) Path => /Applications/MAMP/bin/php/php5.5.18/confLoaded Configuration File => /Applications/MAMP/bin/php/php5.5.18/conf/php.ini,

In phpinfo

Configuration File (php.ini) Path=>/Applications/MAMP/bin/php/php5.5.18/confLoaded Configuration File=>/Library/Application Support/appsolute/MAMP PRO/conf/php.ini

It is found that only Loaded Congiguration File is different,
First
1./Applications/MAMP/bin/php/php5.5.18/conf/php. ini has written extension = swoole. so
2/Library/Application Support/appsolute/mamp pro/conf/php. ini without swoole. so
3. Restart MAMP.

Phpinfo () does not have swoole. It means that you may not duplicate apache. Because php-m is real-time, it cannot be seen.
I suggest you check php-I | grep swoole first. If yes, it is probably because apache does not repeat it.

There is another possibility in mac. mac comes with php. You have installed swoole on your php...
Let's take a look at the php-I | more php paths and
Phpinfo () path comparison. check whether it is consistent.

This problem occurs when you compile swoole to generate the php version of The swoole. so file, which is inconsistent with the php version of swoole!
You can recompile swoole with your current php, generate the swoole. so file, and load it.
During configuration, remember to specify -- php-config = your current php-config path!

MAMP php. the INI file uses a template, which does not take effect directly in the php Directory of the corresponding version. You need to modify the template file. This function is available in the MAMP menu, after adding the extension, restart the web service.

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.