|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2017-07-21 14:11 UTC] jean-christophe dot ventre at wanadoo dot fr
Description:
------------
//googleApiKey : using a python script this allow the final user to see his own reports //without the necessity to be login in
$cmd='.\assets\python\service-account.py C:\\Python27\\python.exe';
exec("$cmd", $output);
$this->data['googleApiKey']=$output[0];
This script doesn't work anymore since the php update from 7.0 to 7.0.21.
I do not have any error message, for example
$cmd='.\assets\python\test.py C:\\Python27\\python.exe';
$mystring = exec("$cmd", $output, $return_var);
echo 'result : ' .$mystring.'</br>';
echo 'return_var :'.$return_var.'</br>';
var_dump($output);
will display
result :
return_var :1
array(0) { }
where test.py :
# -*-coding:Latin-1 -*
import os
def result():
print("resultat")
if __name__ == "__main__":
result()
Test script:
---------------
$cmd='.\assets\python\test.py C:\\Python27\\python.exe';
$mystring = exec("$cmd", $output, $return_var);
echo 'result : ' .$mystring.'</br>';
echo 'return_var :'.$return_var.'</br>';
var_dump($output);
where test.py :
# -*-coding:Latin-1 -*
import os
def result():
print("resultat")
if __name__ == "__main__":
result()
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 13:00:01 2025 UTC |
Thanks for your help,but $cmd='.\assets\python\service-account.py C:\\Python27\\python.exe'; exec("$cmd", $output); is working perfectly well on three differents servers and php configurations since 2 years now. however, you are right, $cmd='C:\\Python27\\python.exe .\assets\python\service-account.py '; exec("$cmd", $output); works as well. The two syntaxes work, not so sure one of them must be prohibited ? Whatever, the code was working perfectly well until the php 7 update from 7.0.0 to 7.0.21 and i am still looking why