Bug #51506 [Com]: Realpath failed on linux Server for version 5.2.10 ?

From: Date: Thu, 22 Apr 2010 20:23:06 +0000
Subject: Bug #51506 [Com]: Realpath failed on linux Server for version 5.2.10 ?
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-149796@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=51506&edit=1

 ID:               51506
 Comment by:       whatrevolution at yahoo dot com
 Reported by:      mastershepper at gmail dot com
 Summary:          Realpath failed on linux Server for version 5.2.10 ?
 Status:           Open
 Type:             Bug
 Package:          Apache2 related
 Operating System: Linux
 PHP Version:      5.2.13

 New Comment:

Code:

<?php
var_dump( realpath( dirname( __FILE__ ) ) );
echo "\n";
var_dump( realpath( '../' ) );
echo "\n";
var_dump( realpath( '../../' ) );
?>

Result:

string '/var/www/php_bugs' (length=17)

string '/var/www' (length=8)

string '/var' (length=4)


PHP Version 5.2.10-2ubuntu6.4

System 	Linux 2.6.31-20-generic x86_64
Build Date 	Jan 6 2010 22:36:47
Server API 	Apache 2.0 Handler 
PHP API 	20041225
PHP Extension 	20060613
Zend Extension 	220060519
Debug Build 	no
Thread Safety 	disabled
Zend Memory Manager 	enabled 

Apache/2.2.12 (Ubuntu)


Previous Comments:
------------------------------------------------------------------------
[2010-04-09 09:51:02] mastershepper at gmail dot com

Hi,

the php version is now up to date (5.2.13) and still have the problem.

I tried many realpath(), the absloute path of the web directory ios the
following one : /home/.sites/38/site52/web

I thought that realpath( '/home/.sites/38/site52/web' ) should works
fine, but it return me false, like any other realpath I'm asking (like
realpath( '/' ) which is working well on my IIS environment).

I also tried to set the include path with this line :
set_include_path(get_include_path() . PATH_SEPARATOR .
'/home/.sites/38/site52/web');
But it still not working fine.

Is there anything I missed ? I'm probably wrong but I don't see where.

Thanks for your help.

------------------------------------------------------------------------
[2010-04-08 11:15:41] pajoye@php.net

You can test locally as well, or in a VM using the same linux version
that you have on your prod server.

------------------------------------------------------------------------
[2010-04-08 11:12:25] mastershepper at gmail dot com

__FILE__ is just a test, the actuel drupal core use realpath on dynamic
paths and it always return false.

The actual production environment is an external one so I'm not able to
change the php version.

I will ask for it and update this report when it will be done (only if
it could be done, unfortunately)

Thanks for your help.

------------------------------------------------------------------------
[2010-04-08 11:02:07] pajoye@php.net

__FILE__ is already an absolute path, I don't see why you would do that
in the 1st place.

However, if you can reproduce the realpath problem with other paths as
well, then I suspect a bug on your linux version. Can you try with
5.2.13 pls?

------------------------------------------------------------------------
[2010-04-08 10:47:47] mastershepper at gmail dot com

Description:
------------
hi,

I met an issue using a drupal CMS. I received an error "warning:
move_uploaded_file() [function.move-uploaded-file]: Unable to access in
/home/.sites/38/site52/web/includes/file.inc on line 572."

I have several web environement, one for coding the website (with IIS 6
and PHP 5.2.3), on for production (with Linux, Apache 2.0 and PHP
5.2.10).

I have no issue on my development server with IIS (same files, same
database).

when I run the following line of code :

var_dump( realpath( dirname( __FILE__ ) ) );

Under IIS: string(44) "D:\inetpub\vhosts\dev.*******.com\httpdocs" 

Under Apache: bool(false)

Did I miss something ? 


Best regards,

Denis.

Test script:
---------------
var_dump( realpath( dirname( __FILE__ ) ) );

Expected result:
----------------
I wish that this function gives me the real path to let drupal copy some
files from the administration.



------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51506&edit=1


Thread (8 messages)

« previous php.bugs (#149796) next »