|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2014-10-21 23:25 UTC] ragdata73 at gmail dot com
[2014-10-21 23:39 UTC] scuzzy at gmail dot com
-Summary: PHAR temp path being shared across virtualhosts with
open_basedir
+Summary: scuzzy@gmail.com
-Status: Open
+Status: Closed
[2014-10-21 23:39 UTC] scuzzy at gmail dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 00:00:02 2025 UTC |
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)