php7 file_exists not working ?

News,announcements,programming,fixes,game patches & discussions.

Moderator: troed

Post Reply
User avatar
exxos
Site Admin
Site Admin
Posts: 23499
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

php7 file_exists not working ?

Post by exxos »

This was working on the current (this) server..

Code: Select all

echo "file_exists ".file_exists($file)."<BR>" ;
But on the new server with php7.4 it doesn't return anything at all, just totally blank.. anyone know whats going on with it ?!
https://www.exxosforum.co.uk/atari/ All my hardware guides - mods - games - STOS
https://www.exxosforum.co.uk/atari/store2/ - All my hardware mods for sale - Please help support by making a purchase.
viewtopic.php?f=17&t=1585 Have you done the Mandatory Fixes ?
Just because a lot of people agree on something, doesn't make it a fact. ~exxos ~
People should find solutions to problems, not find problems with solutions.
User avatar
exxos
Site Admin
Site Admin
Posts: 23499
Joined: Wed Aug 16, 2017 11:19 pm
Location: UK
Contact:

Re: php7 file_exists not working ?

Post by exxos »

Oh nevermind..

$file= "./DOWNLOAD/file.txt" doesn't work anymore.

$file= "/DOWNLOAD/file.txt" doesn't work anymore.

$file= "DOWNLOAD/file.txt" Does :roll:
https://www.exxosforum.co.uk/atari/ All my hardware guides - mods - games - STOS
https://www.exxosforum.co.uk/atari/store2/ - All my hardware mods for sale - Please help support by making a purchase.
viewtopic.php?f=17&t=1585 Have you done the Mandatory Fixes ?
Just because a lot of people agree on something, doesn't make it a fact. ~exxos ~
People should find solutions to problems, not find problems with solutions.
User avatar
thorsten.otto
Posts: 148
Joined: Mon Nov 04, 2019 2:20 am

Re: php7 file_exists not working ?

Post by thorsten.otto »

file_exists() works on local filenames of the server, so you have to prepend the directory part of $_SERVER['SCRIPT_FILENAME'] when you want to use an absolute path (or $_SERVER['DOCUMENT_ROOT'], if your script is in the toplevel directory). Relative pathnames are always troublesome; the current directory may not always be the same as where the script is located.
Post Reply

Return to “SOFTWARE PROGRAMMING & DISCUSSION”