Sign up ×
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them, it only takes a minute:

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=
  • 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

share|improve this question

1 Answer 1

I have resolve the problem. The detail is that php has two versions in linux. So I only assign the path of php.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.