php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37318 is_file() and file_exist() do not return anything but false...
Submitted: 2006-05-05 00:29 UTC Modified: 2006-05-06 09:09 UTC
From: ryanericw at gmail dot com Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.4.2 OS: WinXP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ryanericw at gmail dot com
New email:
PHP Version: OS:

 

 [2006-05-05 00:29 UTC] ryanericw at gmail dot com
Description:
------------
is_file and file_exists() bugged?

Reproduce code:
---------------
I am kind of a newbie at coding PHP, but I recently inserted the code 

//if(is_file("$main_link_files/$file"))
if(file_exists("http://www.rfiles.com/rp/downloads/files/remo_test.zip"))
	{
		header("Location: $main_link_files/$file");

	}
	else
	{
		include('inc/site_header.inc');
		echo "Sorry, the file you have requested is either invalid or missing.<br> Please try again later or contact an administrator.<br>$main_link_files/$file";
	}

and all I end up being returned is false, leading me to the "Sorry, etc". I've tried, is_file() and file_exists(), and have ended up with the same result.

Now, I'm not sure if this is a problem, but I am actually hosting the file off of my webspace, which is on another webserver, apart from the script, which is hosted on my server machine.

I troubleshooted this for hours, and still come up with false, but yet the direct link works from the header if I remove the checks.

I even made sure all the permissions are set to 777 in the CHMod file properties.

Any help would be very appreciated.
Thank You.

Expected result:
----------------
True.

Actual result:
--------------
False.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-05 06:57 UTC] judas dot iscariote at gmail dot com
I kindly suggest you use a support channel next time.
this is not a bug.

if you read this
http://php.net/manual/en/wrappers.http.php
you will notice that the http:// wrapper do not support stat() functionality, required for file_exists or is_file to work on http/https  that's the reason why it is returning false, AFAIK it will only work with FTP and a few others , but in PHP5, not 4.
 [2006-05-05 08:05 UTC] tony2001@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php


 [2006-05-05 19:38 UTC] ryanericw at gmail dot com
Well, is there any possible way to then tell if a file at least exists w/stat?
I need it desperately.

Thank you.
 [2006-05-06 09:09 UTC] tony2001@php.net
Over HTTP? Of course no.
There are no files in HTTP, only URLs.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 13 23:01:33 2025 UTC