Skip to content

Instantly share code, notes, and snippets.

@eduardo-g-silva
Created November 5, 2016 15:46
Show Gist options
  • Save eduardo-g-silva/b094b1576f9d847596e54076327ad415 to your computer and use it in GitHub Desktop.
Save eduardo-g-silva/b094b1576f9d847596e54076327ad415 to your computer and use it in GitHub Desktop.
Laravel open_basedir error runing Artisan in a shared hosting
If you are trying to run Artisan in shared and secure hosting and you are getting this type of error
php artisan migrate
[ErrorException]
is_file(): open_basedir restriction in effect. File(/usr/local/bin/php) is
not within the allowed path(s): (/usr/local/apache/htdocs:/tmp:/usr/local/l
ib/php:/usr/share:/etc/xml:/etc/pki:/usr/bin-safe:/home:/home2:/home3)
You can comment the is_file() function at the following vendor:
vendor/symfony/process/PhpExecutableFinder.php
something like that
// PHP_BINARY return the current sapi executable
if (defined('PHP_BINARY') && PHP_BINARY && in_array(PHP_SAPI, array('cli', 'cli-server', 'phpdbg')) && is_file(PHP_BINARY)) {
return PHP_BINARY.$args;
}
to
// PHP_BINARY return the current sapi executable
if (defined('PHP_BINARY') && PHP_BINARY && in_array(PHP_SAPI, array('cli', 'cli-server', 'phpdbg')) ) { //&& is_file(PHP_BINARY)) {
return PHP_BINARY.$args;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment