Not able to access phpinfo.php page

I created a test file phpinfp.php to check php version and other details inside the folder var/www/html on my RHEL server

image

When I’m trying to access it like this

https://myservername.com/var/www/html/phpinfo.php, I’m getting 404 error. Am I accessing it properly?

I tried https://myservername.com/phpinfo.php as well but same result - 404

Probably not. :slight_smile:

The URL path (the part in the https…) is appended to the document root (the part in the file system “var/www…”) by default, behind the scenes. So a typical setup would be what you have with putting your file in var/www/html and, assuming the document root is actually set (in the Apache web server, another assumption since I don’t know what you’re using) to that path, then it would make your URL simply https://myservername.com/phpinfo.php as you have in your second example.

Could you show a directory listing of that folder on the server, just to clear up a simple typo or upper/lowercase mixup?

Sure. Could you tell me which folder’s directory listing
you are referring to? Thanks!

Have you tried using the URL that tracknut put in their post? I’d guess that you’ll have success with that.

listing of the folder var/www/html

off-topic

Do you know of any “tricks” at differentiating between filesystem paths and URIs ?

For me, (without adequate caffeine yet) all I got is “just kinda know” :coffee:

I’m not sure I get your question completely, but yeah “just kinda know” is how I usually do it.

Alternatively, DocumentRoot it is set in the server config file httpd.conf or from php you can view it as $_SERVER[“DOCUMENT_ROOT”]

A URI will get the DocumentRoot glued to the front of it to resolve to the actual file system.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.