473,725 Members | 1,966 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

file_exists alway returns false

Hi

I've got two linux boxes running redhat9 and either PHP Version 4.2.2
or PHP Version 4.3.7. The file structure is set up the same on both
machines and both files exist. The problem is not file specific and
on both machines seq_tables is a symbolic link to another location.

It makes no difference to either version of php whether I use double
or single quotes when asigning a value to $filename. Nor does it
matter whether I use single or double, forward(/) or back(\) slashes
in the path.

I don't use open_basedir in either php.ini file so this warning
doesn't apply. 'If you use open_basedir in php.ini and use file_exists
for file outside open_basedir path, you will not be warned at log and
file_exists returns false even if file really exists.'

So what else could cause the file to be found on the 4.2.2 version but
not on the 4.3.7 version? Any hints will be much appreciated.

Annie


<?php

#####test script######### ############### ####
$filename = '/var/www/html/seq_tables/lumbricus/sequences/CF610635';

if (file_exists($f ilename)) {
print("The file $filename exists<br>");
} else {
print("The file $filename doesn't exists<br>");
}
############### ############### ###############
?>
Jul 17 '05 #1
3 7957
ba****@hotmail. com (annie) wrote in message news:<5b******* *************** ****@posting.go ogle.com>...
Hi

I've got two linux boxes running redhat9 and either PHP Version 4.2.2
or PHP Version 4.3.7. The file structure is set up the same on both
machines and both files exist. The problem is not file specific and
on both machines seq_tables is a symbolic link to another location.

It makes no difference to either version of php whether I use double
or single quotes when asigning a value to $filename. Nor does it
matter whether I use single or double, forward(/) or back(\) slashes
in the path.

I don't use open_basedir in either php.ini file so this warning
doesn't apply. 'If you use open_basedir in php.ini and use file_exists
for file outside open_basedir path, you will not be warned at log and
file_exists returns false even if file really exists.'

So what else could cause the file to be found on the 4.2.2 version but
not on the 4.3.7 version? Any hints will be much appreciated.

Annie

This might sound a bit simplistic, but did you verify if the file
exists via command-line? "ls -l ../myfile"? Also check permissions
on the file, if Apache (or whatever webserver you use) has no
permissions to at least read that file you could return a false on
file_exists() even though the file really does exist (I have run into
that in the past).

Phil

<?php

#####test script######### ############### ####
$filename = '/var/www/html/seq_tables/lumbricus/sequences/CF610635';

if (file_exists($f ilename)) {
print("The file $filename exists<br>");
} else {
print("The file $filename doesn't exists<br>");
}
############### ############### ###############
?>

Jul 17 '05 #2
I don't think it's just a permissions thing. I believe something is
set to allow the seq_tables directory to be read on PHP Version 4.2.2
or to stop it from being read on PHP Version 4.3.7 but I can't find
anything like this in the ini file. Perhapse it's an apache setting?

see links for example of problem. Any other thoughts appreciated.

http://zeldia.cap.ed.ac.uk/Lumbribase/file_exists.php
and
http://trichuris.cap.ed.ac.uk/Lumbri...ile_exists.php

Annie
Jul 17 '05 #3
I think it's a permission issue. Accessing the URL
http://trichuris.cap.ed.ac.uk/seq_tables/test.txt yields a 403 error.

"annie" <ba****@hotmail .com> wrote in message
news:5b******** *************** **@posting.goog le.com...
I don't think it's just a permissions thing. I believe something is
set to allow the seq_tables directory to be read on PHP Version 4.2.2
or to stop it from being read on PHP Version 4.3.7 but I can't find
anything like this in the ini file. Perhapse it's an apache setting?

see links for example of problem. Any other thoughts appreciated.

http://zeldia.cap.ed.ac.uk/Lumbribase/file_exists.php
and
http://trichuris.cap.ed.ac.uk/Lumbri...ile_exists.php

Annie

Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
4526
by: Chann Becker | last post by:
My current setup: WWW Server: Windows 2000 Server, SP4 IIS5 PHP 4.3.4 File Server Windows 2000 Server, SP4
2
3758
by: Andrew Crowe | last post by:
Hi guys, I've created this little function to check whether a user has uploaded a file with the same name as an existing file, and if so rename it to file-1.jpg, file-2.jpg etc. clearstatcache(); if(file_exists("$BasePath/$FileName.jpg")){ $extra=1; while(file_exists("$BasePath/$FileName-$extra.jpg")){
1
2283
by: Hinrich Specht | last post by:
Hello, I have a problem using file_exists. I want to use file_exists to dertermine if a product-image is available or not to show either the product-image or a standard-image. This is the code: $image = "../../artimages/".$item_code.".jpg"; if (file_exists($image))
12
11887
by: Alan | last post by:
Running PHP5 with IIS on a Win2K Server whenever I try file_exists() on a file in a windows share on another server I get a response of False - I can't open the file or do anything with it. I'm sure the filename/path is Ok $filename= '//print-admin/Public$/planningprepress/planning/prepresslist.xls' I've tried replacing all the '/' with chr(92) to no avail. The only
6
2785
by: +86 | last post by:
i encountered this problem: "include('inc.php')" will work problely but "include('./inc.php') doesn't work .. both file_exists('inc.php') or file_exists('./inc.php') didn't return the right value.this always show "file doesn't exists' my environment is win2003+iis+php5 how to fix it ?
2
1973
by: roger.moon2 | last post by:
So I wrote a script to run via crontab but when it tries to check whether a file exists like below: if (!file_exists("settings.ini")) return false; it checks whether the file exists in $HOME not in /home/user/files/ scripts/ where the original file is been executed from: 00 20 * * 1 /usr/local/bin/php /home/user/files/scripts/check.php /
15
9097
by: cooldht | last post by:
Hi all, I ran into a cool function in a google search, called file_exists that would do exactly what I need it to do. Unfortunately, I think something is wrong with the logic I'm using, because it returns a value of null instead of true or false. It seems to work great if I check for something in the base directory, but when I try something outside of the root, it fails. The check file code looks like this: if (file_exists($filename)) { ...
5
13126
by: chromis | last post by:
Hi there, This has probably been asked a million times but having looked through the PHP manual for the file_exists() function I can't seem to get the right code for what I want to do. I have a typical scenario of wanting to check for an image files existence before displaying, I have foubd the following code to do this but it always returns false: $imageURL = "http://website.com/images/image1.jpg"; $handle =...
9
2129
by: damezumari | last post by:
$file = 'C:\Documents and Settings\Michael\Escritorio\Elvis\test.txt'; file_exists($file) and file_exists('"'.$file.'"') both return false although the file does exist on the user's machine. What am I doing worng?
0
8887
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8751
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9172
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8095
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6702
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4515
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4781
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3219
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2633
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.