ID: 34552
Comment by: dak at solo dot net
Reported By: mmayer at blastwave dot org
Status: Open
Bug Type: Scripting Engine problem
Operating System: Solaris 9
PHP Version: 5CVS, 4CVS (2005-09-20)
New Comment:
We're also seeing this on:
Darwin xxx.yyy.com 7.9.0 Darwin Kernel Version 7.9.0: Wed Mar 30
20:11:17 PST 2005; root:xnu/xnu-517.12.7.obj~1/RELEASE_PPC Power
Macintosh powerpc
PHP Version 5.0.4
www.entropy.ch Release 1
System Darwin xxx.yyy.com 7.9.0 Darwin Kernel Version 7.9.0: Wed Mar
30 20:11:17 PST 2005; root:xnu/xnu-517.12.7.obj~1/RELEASE_PPC Power
Macintosh
Build Date Apr 4 2005 17:31:35
Configure Command './configure' '--prefix=/usr/local/php5'
'--with-config-file-path=/usr/local/php5/lib' '--with-apxs'
'--with-iconv' '--with-openssl=/usr' '--with-zlib=/usr'
'--with-mysql=/Users/marc/svn/entropy/php-module/src/mysql-standard-*'
'--with-mysqli=/usr/local/mysql/bin/mysql_config'
'--with-libxml-dir=/usr/local/php5' '--with-xsl=/usr/local/php5'
'--with-pdflib=/usr/local/php5'
'--with-pgsql=/Users/marc/svn/entropy/php-module/build/postgresql-build'
'--with-gd' '--with-jpeg-dir=/usr/local/php5'
'--with-png-dir=/usr/local/php5' '--with-zlib-dir=/usr'
'--with-freetype-dir=/usr/local/php5' '--with-t1lib=/usr/local/php5'
'--with-imap=../imap-2002d' '--with-imap-ssl=/usr'
'--with-gettext=/usr/local/php5'
'--with-ming=/Users/marc/svn/entropy/php-module/build/ming-build'
'--with-ldap' '--with-mime-magic=/usr/local/php5/etc/magic.mime'
'--with-iodbc=/usr' '--with-xmlrpc' '--with-expat-dir=/usr/local/php5'
'--with-iconv-dir=/usr' '--with-curl=/usr/local/php5' '--enable-exif'
'--enable-wddx' '--enable-soap' '--enable-sqlite-utf8'
'--enable-ftp'
'--enable-sockets' '--enable-dbx' '--enable-dbase'
'--enable-mbstring'
'--enable-calendar' '--with-bz2=/usr' '--with-mcrypt=/usr/local/php5'
'--with-mhash=/usr/local/php5' '--with-mssql=/usr/local/php5'
'--with-fbsql=/Users/marc/svn/entropy/php-module/build/frontbase-build/Library/FrontBase'
'--enable-openbase_module'
Server API Apache
Virtual Directory Support disabled
Configuration File (php.ini) Path /usr/local/php5/lib/php.ini
PHP API 20031224
PHP Extension 20041030
Zend Extension 220040412
Debug Build no
Thread Safety disabled
IPv6 Support enabled
Registered PHP Streams php, file, http, ftp, compress.bzip2,
compress.zlib, https, ftps
Registered Stream Socket Transports tcp, udp, unix, udg, ssl, sslv3,
sslv2, tls
Previous Comments:
------------------------------------------------------------------------
[2005-09-20 18:43:34] mmayer at blastwave dot org
No, I cannot reproduce this problem with CLI. Even 4.4.0 works in that
case.
I downloaded php5-latest.tar.gz.
$ telnet localhost 80
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
HEAD / HTTP/1.0
HTTP/1.1 200 OK
Date: Tue, 20 Sep 2005 16:31:46 GMT
Server: Apache/2.0.54 (Unix) DAV/2 PHP/5.1.0RC2-dev
[...]
Still getting the same results with the apache module that I saw for
4.4.0, so the problem is still there. CLI of 5.1.0RC2 works, however,
just like CLI for 4.4.0.
------------------------------------------------------------------------
[2005-09-20 11:02:12] sniper@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5-win32-latest.zip
See also bug #34514, can you reproduce this with CLI?
------------------------------------------------------------------------
[2005-09-19 18:26:28] mmayer at blastwave dot org
I'm running Apache 2.0.54. Also tried Apache 1.3.33 and got the same
results.
$ uname -a
SunOS valhalla 5.9 Generic_118558-10 sun4u sparc SUNW,Ultra-60
------------------------------------------------------------------------
[2005-09-19 18:21:07] mmayer at blastwave dot org
Description:
------------
This issue seems to be related to bug #27823, but broader in scope.
Using __FILE__ or realpath() on Solaris 9 SPARC (don't know about x86)
doesn't work as expected if the scripts are located in a user's
home-directory (~username/public_html) and the URL looks like
http://my.example.com/~user/testscript.php.
(Don't know if the '~' is
actually causing the problem or if it's something else in this
scenario).
Note that I *do* get the expected results from these scripts if I copy
them to /opt/csw/apache2/share/htdocs/file_bug (i.e. underneath my
web-server's doc-root) and access them through a URL like
http://my.example.com/file_bug/<scriptname>.
In the failure case, __FILE__ returns './<filename>' instead of the
full path if it is used in an included file.
realpath() returns an empty string instead of the actual path even
though the file in question exists and the permissions are correct.
(Regardless of whether realpath is used in an included file or
directly.)
Reproduce code:
---------------
=== file.php: ===
<?php
print __FILE__;
print "<p>";
require("file2.php");
?>
=== file2.php: ===
<?php
print __FILE__;
?>
=== realpath.php: ===
<?php
print("realpath: '".realpath('realpath/test.txt')."'\n");
?>
Expected result:
----------------
file.php should print:
/home/markus/public_html/file_bug/file.php
/home/markus/public_html/file_bug/file2.php
realpath.php should print:
realpath: '/home/markus/public_html/file_bug/realpath/test.txt'
Actual result:
--------------
file.php prints:
/home/markus/public_html/file_bug/file.php
./file2.php
realpath.php prints:
realpath: ''
This is the directory layout (just to show that it's not a permission
problem):
total 14
drwxr-xr-x 3 markus staff 512 Sep 19 09:10 .
drwxr-xr-x 11 markus staff 1536 Sep 15 11:07 ..
-rw-r--r-- 1 markus staff 60 Sep 14 13:41 file.php
-rw-r--r-- 1 markus staff 25 Sep 14 13:41 file2.php
drwxr-xr-x 2 markus staff 512 Sep 19 09:07 realpath
-rw-r--r-- 1 markus staff 67 Sep 19 09:08 realpath.php
./realpath:
total 6
drwxr-xr-x 2 markus staff 512 Sep 19 09:07 .
drwxr-xr-x 3 markus staff 512 Sep 19 09:10 ..
-rw-r--r-- 1 markus staff 5 Sep 19 09:07 test.txt
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34552&edit=1