<p>我的LAMP服务器是centos7.4,带有apache2.4、php5.4和python3.6。在</p>
<p>我是Python的新手;我刚刚从R迁移到Python。我需要一些Python包来做统计,然后将输出传递到PHP。在</p>
<p>我回顾了很多类似的问题。答案是<code>exec()</code>,<code>passthru()</code>,<code>system()</code>,和{<cd4>}。它们是危险的命令,不应该在PHP中启用。在</p>
<p>在<a href="https://wiki.python.org/moin/IntegratingPythonWithOtherLanguages#PHP" rel="nofollow noreferrer">Python official manual, <em>"Integrating Python With Other Languages"</em></a>中,只提到了两个工具,<code>ppython</code>和{<cd6>}。
<a href="https://github.com/liuzhen153/php-python" rel="nofollow noreferrer">ppython</a>似乎不再被维护,但这正是我需要的,就像使用R时的<code>Rserve</code></p>
<p>我还读了<a href="https://www.quora.com/How-do-I-integrate-Python-script-into-PHP-script" rel="nofollow noreferrer">this post</a>:</p>
<blockquote>
<p>Simple and standard solution is using Socket or Webservice(API)</p>
</blockquote>
<p>现在,如何在PHP中运行Python脚本而不使用<code>exec()</code>,<code>system()</code>…(可能是套接字通信)?在</p>