0

I am using wamp 2.2e. I have tested the PHP on tha server and it works.

Now, I have a script called scriptA.py that I want to execute. I am not using safe mode, and in the php.ini the disable_functions line is empty. Ok, so I tried:

 exec("C:\wamp\www\scriptA.py")
 exec('C:\wamp\www\scriptA.py')
 exec('C:\\wamp\\www\\scriptA.py')

same with system()... tried with "cmd /c"..

none worked.

I also found a potential reason - maybe I need to set permmisions to the cmd using the CALC command, but I dont know what is my user, is it the computer name in control panel->system ?

please assist me


OK, there is a progress, now the browser shows me the errors:

Warning: exec() [<a href='function.exec'>function.exec</a>]: Unable to fork [C:\wamp\www\Telnetshutdown.py] in C:\wamp\www\index2.php on line 2
# Time Memory Function Location 
1 0.0005 362784 {main}( ) ..\index2.php:0 
2 0.0005 362912 exec ( ) ..\index2.php:2 

( similar if i try with system() ) - does it help ?

4

2 回答 2

0

您可能必须通过 Python 可执行文件调用这些,因为 Python.exe 不太可能在PATH您的apache用户中:

exec('C:\Python3\Python.exe C:\wamp\www\ScriptA.py');

exec在 Windows 上有几个抱怨。apache您可能会发现将 Python 代码重构为 PHP 比让用户像这样访问整个磁盘更省时且更安全。

于 2013-06-04T11:54:22.913 回答
-1

如果您安装 ActiveState python,安装程序会将扩展名为 .py 的文件关联到 python.exe 程序。因此,您需要做的就是双击该文件(在 windows 2k(可能还有其他)中,您可以简单地按原样键入文件名(即 foo.py 并且命令 shell 知道调用关联的应用程序)

http://www.activestate.com/Products/ActivePython/

编辑;

这将解决您的问题: http ://www.iis-aid.com/articles/trouble_shooting/warning_exec_functionexec_unable_to_fork

于 2013-06-04T11:54:44.807 回答