php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51506 Realpath failed on linux Server for version 5.2.10 ?
Submitted: 2010-04-08 10:47 UTC Modified: 2013-02-18 00:34 UTC
From: mastershepper at gmail dot com Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: 5.2.13 OS: Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2010-04-08 10:47 UTC] 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.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-04-08 11:02 UTC] pajoye@php.net
-Status: Open +Status: Feedback
 [2010-04-08 11:02 UTC] 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 11:12 UTC] 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:15 UTC] 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-09 09:51 UTC] mastershepper at gmail dot com
-Status: Feedback +Status: Open
 [2010-04-09 09:51 UTC] 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-22 22:23 UTC] whatrevolution at yahoo dot com
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)
 [2010-04-23 23:15 UTC] felipe@php.net
-Package: Apache2 related +Package: Scripting Engine problem
 [2010-05-12 16:13 UTC] mike@php.net
-Status: Open +Status: Feedback
 [2010-05-12 16:13 UTC] mike@php.net
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.



 [2013-02-18 00:34 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 "Open". Thank you.
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu Oct 06 13:05:53 2022 UTC