Bug #74965 [Nab]: exec() does'nt work anymore since PHP 7.0 was updated to version 7.0.21.

From: Date: Mon, 24 Jul 2017 08:14:56 +0000
Subject: Bug #74965 [Nab]: exec() does'nt work anymore since PHP 7.0 was updated to version 7.0.21.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-210255@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74965&edit=1

 ID:                 74965
 User updated by:    jean-christophe dot ventre at wanadoo dot fr
 Reported by:        jean-christophe dot ventre at wanadoo dot fr
 Summary:            exec() does'nt work anymore since PHP 7.0 was
                     updated to version 7.0.21.
 Status:             Not a bug
 Type:               Bug
 Package:            *General Issues
 Operating System:   windows server 2012R2
 PHP Version:        7.0.21
 Block user comment: N
 Private report:     N

 New Comment:

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


Previous Comments:
------------------------------------------------------------------------
[2017-07-22 08:41:01] ab@php.net

Obvious mistake in the command.

Thanks.

------------------------------------------------------------------------
[2017-07-21 15:04:45] kalle@php.net

Are you sure you didn't mean $cmd to be:

$cmd='C:\\Python27\\python.exe .\assets\python\test.py';

The only other way that calling '.\asserts\python\test.py' as an executable has to do with
what executable is registered to execute .py files, which PHP does nothing about on Windows.

------------------------------------------------------------------------
[2017-07-21 14:11:04] 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()	



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=74965&edit=1


Thread (8 messages)

« previous php.bugs (#210255) next »