Re: No such file... but there is!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Nov 28, 2017 at 10:22 AM, Jennifer <jennifer@xxxxxxxxxxxxxxxxxxxx>
wrote:

> Hi!
>
>         I'm having an intermittent problem with a script locating a text
> file.  Here's the code section:
>
>
> function is_crawler($agent) {
>   global $path;
>     $bots_file = $path;
>     $spiders = file($bots_file, FILE_IGNORE_NEW_LINES |
> FILE_SKIP_EMPTY_LINES);
>
>   foreach ($spiders as $spider) {
>     if (stristr($agent, $spider)) {
>       return true;
>    }
>   }
> }
>
>         The error log shows these lines:
>
> [28-Nov-2017 06:50:03] PHP Warning:  file(.../counter/bots.txt): failed to
> open stream: No such file or directory in /home/.../counter/page_hit_counter.php
> on line 235
> [28-Nov-2017 06:50:03] PHP Warning:  Invalid argument supplied for
> foreach() in /home/.../counter/page_hit_counter.php on line 238
>
>
>         The bots file is there and is populated, so I'm not sure why this
> happens from time to time.  It's not read by any other script, so I don't
> think it's a locking issue(?).
>
>         What could be causing this issue?
>
> Thank you,
> Jenni
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Use the absolute file location instead of the relative one.

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux