I have 2 scripts.
1 - php web-scripts which collects information from a user and execute python script with sending all collected data as arguments
2 - python script which gets arguments from php-script using sys.argv and updates a MySQL using MySQLdb
When I run python script via command line - it works like a charm. It does whatever it suppose to do. But when I try to execute the python script using PHP-script - nothing happens until I delete import MySQLdb from my python script.
As soon as I delete "import MySQLdb" from my python script - PHP script can execute it and they both work (except updating MySQL).
Do you have and idea what's going wrong?
P.S. I was trying to get an error
in python file I use this:
import traceback
import sys
import MySQLdb
# Some classes and functions
if __name__ == '__main__':
try:
main()
except Exception, err:
print traceback.format_exc()
and in the php i use:
$result = shell_exec("/usr/bin/python /FULL_PATH_TO/script.py $argument";
echo $result;
And still... Nothing. web page just reloads without giving any information