Bug #68280 [Opn->Csd]: scuzzy@gmail.com
| From: | scuzzy at gmail dot com | Date: | Tue, 21 Oct 2014 23:39:37 +0000 |
| Subject: | Bug #68280 [Opn->Csd]: scuzzy@gmail.com | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-188242@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68280&edit=1
ID: 68280
User updated by: scuzzy at gmail dot com
Reported by: scuzzy at gmail dot com
-Summary: PHAR temp path being shared across virtualhosts with
open_basedir
+Summary: scuzzy@gmail.com
-Status: Open
+Status: Closed
Type: Bug
Package: PHAR related
Operating System: Windows 7 Version 6.1.7601
PHP Version: 5.5.18
Block user comment: N
Private report: N
New Comment:
I'm closing this myself as I no longer believe my problem is "PHAR" specific, but
revolves around how Apache/PHP manage the sys_temp_dir configuration.
Previous Comments:
------------------------------------------------------------------------
[2014-10-21 23:25:09] ragdata73 at gmail dot com
I've encountered the same problem with PHP 5.5.17, Apache 2.4.10, Amazon Linux AMI (Red Hat
3.10.34). When multiple copies of the same .phar are hosted under different virtual hosts on the
same server instance, it seems whichever virtual host is first to access the .phar sets the
'/tmp' dir for all copies on that server. Don't know about other directories - but
the '/tmp' dir is the one causing issues for me.
------------------------------------------------------------------------
[2014-10-21 23:00:34] scuzzy at gmail dot com
Description:
------------
I have two websites, both with their own sys_temp_dir and open_basedir settings.
I am then trying to load an amazon aws.phar file (each site has it's own copy of the archive)
When executed, the first website (PharA) will function and behave normally.
The second website when executed (PharB) will get open_basedir errors trying to access a temporary
file outside of its path that was generated/cached by the first website (PharA)
I have this simple apache config to create two websites "PharA" and "PharB"
<VirtualHost *:80>
DocumentRoot "C:/WebRoot/PharA/web"
ServerName PharA
<Directory "C:/WebRoot/PharA/web">
php_admin_value open_basedir "C:/WebRoot/PharA/web;C:/WebRoot/PharA/tmp;"
php_admin_value upload_tmp_dir "C:/WebRoot/PharA/tmp"
php_admin_value sys_temp_dir "C:/WebRoot/PharA/tmp"
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/WebRoot/PharB/web"
ServerName PharB
<Directory "C:/WebRoot/PharB/web">
php_admin_value open_basedir "C:/WebRoot/PharB/web;C:/WebRoot/PharB/tmp"
php_admin_value upload_tmp_dir "C:/WebRoot/PharB/tmp"
php_admin_value sys_temp_dir "C:/WebRoot/PharB/tmp"
</Directory>
</VirtualHost>
I then had this as a hosts entry
127.0.0.1 phara
127.0.0.1 pharb
Test script:
---------------
<?php
// Phar downloaded from https://github.com/aws/aws-sdk-php/releases/tag/2.7.1
require('aws.phar');
use Aws\S3\S3Client;
use Aws\Common\Enum\Region;
$client = S3Client::factory(array(
'key' => '[KEY]',
'secret' => '[SECRET]',
'region' => Region::AP_SOUTHEAST_2
));
Actual result:
--------------
After browsing http://phara/ first followed by browsing to http://pharb/ afterwards, I see this error and incorrect temp path in http://pharb/
Warning: file_exists(): open_basedir restriction in effect.
File(C:/WebRoot/PharA/tmp/guzzle-cacert.pem) is not within the allowed path(s):
(C:/WebRoot/PharB/web;C:/WebRoot/PharB/tmp) in
phar://C:/WebRoot/PharB/web/aws.phar/Guzzle/Http/Client.php on line 511
Likewise if I restart apache, then browse http://pharb/ first the error
will then occur under http://phara/ switching positions depending on
which site was executed first (almost as if PHP keeps a index of paths for the phar file it
processes)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68280&edit=1