Jump to content

Niloreptiso

New Members
  • Posts

    2
  • Joined

  • Last visited

Niloreptiso's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. aha.. the only thing I hadn't thought of! I had tried everything else (and lost some hair along the way) but it really is that simple. Thanks very much
  2. I have a PHP file that is executed via batch file very frequently for live updating. This is a sort of "sync" file for reading/writing to a MySQL database. I am able to get it functioning absolutely fine when executed manually via a web browser (and my echo debug lines output the expected information), yet when I run the same PHP file via the command line, it seems to just not be capable of opening any file for reading, so the equivalent variables that are correct when executed on a web browser are blank when echoed through the command line. Is there a different way of handling reading of files when running a php script via the command line, or should it function exactly the same as when run via a browser? For instance: $k = "0"; $line = file("examplefile.log")[$k]; echo $line; The above will output the first line (line 0) of examplefile.log when run via a browser, yet in the command line it doesn't echo anything.. as if it's not able to read the text file for some reason even though other parts of the php file run fine. In my actual code, I am using a foreach loop to run through each line of a file (very few lines and very small file) that then explodes each line and sends the necessary parts to a mysql database; this works fine when I run the php file (and hence script) through the browser, but doesn't do anything within the foreach loop when it runs via the command line php.exe.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.