php - file_put_contents failed to open stream: no such file or directory (only locally) -


I have PHP scripts I've added to a cron job, though PHP script is not able to run locally .

If I use it through a web browser, then it works 100% if I use it via terminal, then it reproduces the behavior below.

Test:

  $ php5 /path/test.php  

Error:

  file_put_contents (folder / filename.txt): failed to open the stream: test.php on such a file or directory / path / line 11  

Code:

  $ host = 'https://www.google.com/'; $ Ch = curl_init (); Curl_setopt ($ ch, CURLOPT_URL, host $); Curl_setopt ($ ch, CURLOPT_CONNECTTIMEOUT, 1); Curl_setopt ($ ch, CURLOPT_RETURNTRANSFER, 1); $ Result = curl_xac ($ CH); $ Position = curl_getinfo ($ CH, CURLINFO_HTTP_CODE); Curl_close ($ ch); File_put_contents ('folder / filename.txt', $ position);  

I do not believe the error is a problem because the error does not say anything but the folder is set to 777 and the php script is set to


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -