Python script execution in php

Source: Internet
Author: User
When designing the interface, you need to click a button on the interface to call the python script in php,
 
Is a php function. the command "python/home/nessus/nessus_schedul/scan_schedul.py" can be executed on the shell command line, and the command line can also execute php, however, clicking the button on the interface is not feasible. I hope you can help me solve this problem. I am very grateful to you...


Reply to discussion (solution)

When designing the interface, you need to click a button on the interface to call the python script in php,
PHP code
$ Host_ip = $ _ GET ["IP"];
$ A = "python/home/nessus/nessus_schedul/scan_schedul.py". $ host_ip ."";
Echo $;
Exec ($ a, $ out, $ states );
Print_r ($ out );
Print_r ($ states );
?>
Is a php function. The Command [code = php] python/home/nessus/nessus_schedul/scan_schedul.py [/code] can be executed on the shell command line, and the command line can also execute php, however, clicking the button on the interface won't be able to be executed. I hope you can help me solve this problem. I am very grateful to you...

Check if php. ini disables exec.
Disable_functions

Python file permissions?

Echo $ a; whether it can be output.



Female ~

The user path used by the web server may not contain python. Try writing an absolute address in python

The py script is still in the website directory.

2L's answer is useful to me. thank you.

Does the web server user have the execution permission?

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.