I have a PHP script called a.php that calls exec()
to execute php command to send data to another platform, and then get data from it. i have found much information. i still failed according to their ways.
a.php uses curl to send data and use json_decode()
to parse data from curl_exec()
function.
My environment:
- php 5.3.2
- php.ini
- safe_mode = Off
- disable_functions=
- php.ini
- server: apache
- os: linux
in my php class:
I use exec("php a.php > /data0/log/log.log")
, then I access it via browser, but i get nothing.
Finally I find that I can use php exec to execute php script, because I find data in the platform where I send data. However a.php shows nothing. i also find nothing in /data0/log/log.log
, but if i use php a.php > /data0/log/log.log
in linux, then I can find information which i use 'echo
, print_r
' in a.php, so I think a.php is correct.
I use exec("php -cli a.php > /data0/log/log.log &")
, i got undefined function json_decode()
in /data0/log/log.log
.
I don't know how to fix this problem. But in my another server it can execute successfully. I only use exec("php a.php")
.
thanks
van