REMINDER - Stay logged in for at least 2 hours a week to get whitelisted.
Also it helps build a picture where our "good traffic" is coming from for detection scripts.
:o)

php7 file_exists not working ?

News,announcements,programming,fixes,game patches & discussions.
User avatar
exxos
Site Admin
Site Admin
Posts: 28605
Joined: 16 Aug 2017 23:19
Location: UK

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 ?!
User avatar
exxos
Site Admin
Site Admin
Posts: 28605
Joined: 16 Aug 2017 23:19
Location: UK

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:
User avatar
thorsten.otto
Posts: 148
Joined: 04 Nov 2019 02:20

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.

Return to “SOFTWARE PROGRAMMING & DISCUSSION”

Who is online

Users browsing this forum: ClaudeBot and 1 guest