RE: [PHP] No such file... but there is!
| From: | Balbuena, Josue | Date: | Tue, 28 Nov 2017 15:39:32 +0000 |
| Subject: | RE: [PHP] No such file... but there is! | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-326281@lists.php.net to get a copy of this message | ||
Have you checked the read privileges, sometimes the user that the web server is running doesn't
let reading the file.
-----Original Message-----
From: Aziz Saleh [mailto:azizsaleh@gmail.com]
Sent: martes, 28 de noviembre de 2017 09:34 a. m.
To: Jennifer <jennifer@superiorshelving.com>
Cc: PHP General <php-general@lists.php.net>
Subject: Re: [PHP] No such file... but there is!
On Tue, Nov 28, 2017 at 10:22 AM, Jennifer <jennifer@superiorshelving.com>
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.