|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34514 __FILE__ gives relative path if not in web root
Submitted: 2005-09-15 16:58 UTC Modified: 2005-09-27 19:05 UTC
From: madison at westga dot edu Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.4.0 OS: Solaris 9
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
26 + 20 = ?
Subscribe to this entry?

 [2005-09-15 16:58 UTC] madison at westga dot edu
This bug: appears never to have been completely resolved.

Using the test code from the above bug...

If the code resides somewhere in the DocumentRoot then it works as expected. But, if it resides in a users public_html directory or inside an aliased directory, it doesn't give the correct path.

I get the same issue with the current CVS version of PHP5 and apache 2.

Reproduce code:
echo "original file is: " . __FILE__ . "<br>";

contents of test2.php:
echo "included file is: " . __FILE__ . "<br>";

$boo = "another try:  " . __FILE__;
echo $boo;

Expected result:
original file is: /home/madison/public_html/test.php
included file is: /home/madison/public_html/test2.php
another try: /home/madison/public_html/test2.php

Actual result:
original file is: /home/madison/public_html/test.php
included file is: ./test2.php
another try: ./test2.php


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-09-27 19:05 UTC]
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

See bug #34552 which is exactly same issue.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Mon Jun 01 06:01:26 2020 UTC