<ol> <li> <code><span>1</span><span>、下载</span><span>swoole</span><span>源码(一般下载稳定版)</span></code></li> <li><code></code></li> <li><code><span>下载地址:</span><span>https</span><span>://</span><span>github</span><span>.</span><span>com</span><span>/</span><span>swoole</span><span>/</span><span>swoole</span><span>-</span><span>src</span><span>/</span><span>releases</span></code></li> <li><code></code></li> <li><code><span>2</span><span>、</span><span>cd swoole</span><span>-</span><span>src</span><span>-</span><span>swoole</span><span>-</span><span>1.7</span><span>.</span><span>22</span><span>-</span><span>stable</span><span>(进入解压后的目录)</span></code></li> <li><code><span>3</span><span>、</span><span>phpize </span><span>(生成config脚本工具,如果报错./</span><span>configure</span><span>:</span><span>No</span><span> such file or directory</span><span>,用</span><span>sudo brew install autoconf</span><span>)</span></code></li> <li><code><span>4</span><span>、./</span><span>configure </span></code></li> <li><code><span>5</span><span>、</span><span>make</span></code></li> <li><code><span>6</span><span>、</span><span>sudo make install</span></code></li> <li><code></code></li> <li><code><span>7</span><span>、</span><span>ls modules</span><span>/</span><span> </span><span>(在</span><span>modules</span><span>目录查看是否有</span><span>swoole</span><span>.</span><span>so</span><span>扩展,如果说明成功)</span></code></li> <li><code></code></li> <li><code></code></li> <li><code><span>8</span><span>、</span><span>php </span><span>-</span><span>i</span><span>|</span><span>grep php</span><span>.</span><span>ini </span><span>(查找</span><span>php</span><span>.</span><span>ini</span><span>配置路径)</span></code></li> <li><code></code></li> <li><code></code></li> <li><code><span>9</span><span>、</span><span>sudo vi </span><span>/</span><span>usr</span><span>/</span><span>local</span><span>/</span><span>etc</span><span>/</span><span>php</span><span>/</span><span>5.4</span><span>/</span><span>php</span><span>.</span><span>ini </span></code></li> <li><code></code></li> <li><code><span>(在文件最后加上</span><span>extension</span><span>=</span><span>swoole</span><span>.</span><span>so</span><span>)</span></code></li> <li><code></code></li> <li><code></code></li> <li><code><span>10</span><span>、</span><span>php </span><span>-</span><span>m </span><span>(即可看到扩展模块</span><span>swoole</span><span>)</span></code></li> <li><code></code></li> <li> <p><code><span>11</span><span>、cd examples/ (进入范例目录测试) </span></code></p> <p><code><span> php server.php </span></code></p> </li> </ol>
以上就介紹了mac下swoole安裝步驟,包括了方面的內容,希望對PHP教程有興趣的朋友有所幫助。