0

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

1 Answer 1

0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.