MAC下安装swoole,在MAMP这块遇到问题

在MAC下安装swoole,顺着文档安装也成功了,具体的细节是:我把系统的php切换成MAMP的php,然后安装swoole。最后的php-m命令中也已经有swoole在了,但是phpinfo中却搜索不到swoole的字样
然后使用如下代码测试
classClient
{
private$client;
publicfunction__construct(){
$this->client=newswoole_client(SWOOLE_SOCK_TCP);
}
publicfunctionconnect(){
if(!$this->client->connect("127.0.0.1",9501,1)){
echo"Error:{$fp->errMsg}[{$fp->errCode}]\n";
}
$message=$this->client->recv();
echo"GetMessageFromServer:{$message}\n";
fwrite(STDOUT,"请输入消息:");
$msg=trim(fgets(STDIN));
$this->client->send($msg);
}
publicfunctiontest(){
$this->client=newswoole_client(SWOOLE_SOCK_TCP);
}
}
$client=newClient();
$client->connect();
返回:
Fatalerror:Class'swoole_client'notfoundin/Applications/MAMP/htdocs/swoole_example/01/swoole_simple_client.phponline8
更新于(2015-08-07)
另一方方面:
php-i|grepswoole
返回
swoole
swoolesupport=>enabled
swoole.aio_thread_num=>2=>2
swoole.display_errors=>On=>On
swoole.message_queue_key=>0=>0
swoole.unixsock_buffer_size=>8388608=>8388608
php-i|more里的
ConfigurationFile(php.ini)Path=>/Applications/MAMP/bin/php/php5.5.18/conf
LoadedConfigurationFile=>/Applications/MAMP/bin/php/php5.5.18/conf/php.ini,
phpinfo里的
ConfigurationFile(php.ini)Path=>/Applications/MAMP/bin/php/php5.5.18/conf
LoadedConfigurationFile=>/Library/ApplicationSupport/appsolute/MAMPPRO/conf/php.ini
发现只有LoadedCongigurationFile不同,
首先
1./Applications/MAMP/bin/php/php5.5.18/conf/php.ini已经写了extension=swoole.so
2/Library/ApplicationSupport/appsolute/MAMPPRO/conf/php.ini里面没有swoole.so
3.重启MAMP已经尝试过了
慕尼黑5688855
浏览 1008回答 2
2回答

万千封印

phpinfo()沒swoole,說明你可能沒重啟apache.因為php-m是實時的.所以看不出來.建議你php-i|grepswoole看下先,如果有.很可能就是apache沒重啟造成的.mac下還有一種可能性,mac自帶了php.你swoole安裝到自帶的php上了...分別看下php-i|more里面php的路徑和phpinfo()路徑,對比下.看是否一致.
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript