Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem when using open_basedir and multiple installations #256

Open
nublaii opened this issue Feb 15, 2017 · 0 comments
Open

Problem when using open_basedir and multiple installations #256

nublaii opened this issue Feb 15, 2017 · 0 comments

Comments

@nublaii
Copy link

nublaii commented Feb 15, 2017

Hi, I don't know if there is a way of fixing this from your end, since I believe it's a bug on opcode, but it's fixable if you modify the source code.

I have multiple websites using httpful, and each one of them has open_basedir defined to their respective root.

I'm running ubuntu 14.04 with stock php (v 5.5.9) with OPcache v7.0.3 (also stock version)

I include httpful.phar this way:

use Httpful\Request;
if ( ! class_exists( '\Httpful\Request' ) ) {
    include_once( REDIRECT_DIR . '/vendor/httpful.phar' );
}

This is executed on a particular page on multiple websites, each with its own httpful.phar.

I restart apache, and after hitting that page, it works as expected.

When I hit the second page I get open_basedir errors, because the first site tries to use the compiled version (opcache's version), that points to the first website.

If you check this page you can see the only comment that talks about this issue: http://php.net/manual/en/phar.mapphar.php

I know it's opcache's problem, but I found out that if you modify the Bootstrap.php file, line 54, and modify it to point to the full path of the phar file, it works as expected.

self::_autoload('phar://httpful.phar', $classname);

to

self::_autoload('phar:///full/path/on/the/server/httpful.phar', $classname);

Is there any way of self-referencing the file from inside httpful that uses the realpath of the file instead of relative?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant