John Davidson

php - executing python in codeigniter with exec command

0 comments
Message:


When executing with php the exec command in codeIgniter


$data=exec("/usr/bin/python python.py");

$data=exec("/usr/bin/python3.6 python36.py");

the first one with python (which point on python 2.7.5) works fine
but when calling the second line with python3.6 it doesn't work.


I precise that at the root of my project, both are working !
That's why I can't understand why in CodeIgniter the first is ok but not the second one.
(security options in codeIgniter ?)


Thank you



My Answer:
"python script.py");

This will execute the Python script named "script.py" and store the output in the variable $data. Make sure that the Python script is in the same directory as your CodeIgniter project or provide the full path to the script in the exec command.

Rate this post

3 of 5 based on 7300 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us