php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74916 include path takes / as being user's home dir
Submitted: 2017-07-13 04:12 UTC Modified: 2017-07-23 04:22 UTC
From: jmichae3 at yahoo dot com Assigned:
Status: No Feedback Package: Unknown/Other Function
PHP Version: 7.1.7 OS: nix
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: jmichae3 at yahoo dot com
New email:
PHP Version: OS:

 

 [2017-07-13 04:12 UTC] jmichae3 at yahoo dot com
Description:
------------
include "/somefile.php";
pulls in a file from the home directory on the server (login root dir), not the html web directory you put your html files into.


Test script:
---------------
include "/somefile.php";

Expected result:
----------------
should include from web root
 (unless you want to run php as a general scripting language for general tasks - why not a separate command like include_webhome or include_webdir?)

Actual result:
--------------
includes from root dir, which on windows would be c:\

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-07-13 05:24 UTC] requinix@php.net
-Status: Open +Status: Feedback
 [2017-07-13 05:24 UTC] requinix@php.net
Are you running in a chroot-ed environment?

> not the html web directory you put your html files into.
It would not do that anyways. /somefile.php will be relative to the root of the filesystem, but if you're in a chroot then "root of the filesystem" will be different from the actual root.

> why not a separate command like include_webhome or include_webdir
Add four more of those functions? No thank you. Use $_SERVER["DOCUMENT_ROOT"].
 [2017-07-23 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 [2017-07-27 14:36 UTC] jmichae3 at yahoo dot com
it's probably centos of which I know nothing since it costs money.
 [2017-07-27 15:00 UTC] spam2 at rhsoft dot net
> it's probably centos of which I know nothing since it costs money

what are you talking about?
don't confuse CentOS with RHEL
 [2017-09-24 19:26 UTC] jmichae3 at yahoo dot com
how about making it relative to $_SERVER['DOCUMENT_ROOT']?
 [2017-09-24 19:50 UTC] spam2 at rhsoft dot net
> include "/somefile.php";
> how about making it relative to $_SERVER['DOCUMENT_ROOT']?

what the hell - a path startign with "/" is a *absolute path* - period

if you want a relative path just use one
if you want a sbolute path just form it properly
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 11:01:30 2024 UTC