Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

vishal's avatar

Laravel 5.4 not working on Linux shared hosting

Hello,

I deployed application as per this document : https://stackoverflow.com/documentation/laravel/2410/deploy-laravel-5-app-on-shared-hosting-on-linux-server/7970/laravel-5-app-on-shared-hosting-on-linux-server#t=201705250557477657344

But still I am getting server error 500 unable to handle the request.

0 likes
8 replies
neilherbertuk's avatar

Hi VISHAL,

Laravel can be difficult to get working with Shared Hosting. First port of call would be to check your admin panel to see if they provide you with access to any error logs. Something the logs are available from FTP, sometimes from an admin panel. Your error logs will tell you more detail to why your application isn't working.

I think the most common issues for 500 errors tend to be permissions related or missing php extensions. However there are a lot of things that could be stopping it.

Make sure your storage and bootstrap/cache folders have the correct permissions. Most FTP clients allow you to change your permissions through chmod. Make sure you take a look at https://laravel.com/docs/5.4/installation as well.

If you find your error logs, make sure they don't include any passwords and paste it here. Preferably share it via a https://paste.laravel.io paste.

Neil

vishal's avatar

Ok. I will check the error logs.

vishal's avatar

Hi,

I got the error as below:

Warning: require_once(): open_basedir restriction in effect. File(/home/sculpt/web/ewasteweb.ecscorporation.com/application/bootstrap/autoload.php) is not within the allowed path(s): (/home/sculpt/web/ewasteweb.ecscorporation.com/public_html:/home/sculpt/tmp) in /home/sculpt/web/ewasteweb.ecscorporation.com/public_html/index.php on line 32

Warning: require_once(/home/sculpt/web/ewasteweb.ecscorporation.com/application/bootstrap/autoload.php): failed to open stream: Operation not permitted in /home/sculpt/web/ewasteweb.ecscorporation.com/public_html/index.php on line 32

Fatal error: require_once(): Failed opening required '/home/sculpt/web/ewasteweb.ecscorporation.com/public_html/../application/bootstrap/autoload.php' (include_path='.:/usr/share/php') in /home/sculpt/web/ewasteweb.ecscorporation.com/public_html/index.php on line 32

And I think its due to directory access restriction application can not open and execute autoload.php and app.php because it is outside of public_html folder.

So have you any idea How I can give access to this directory?

Thanks.

Thyrosis's avatar

You can't, it's blocked by the webhost.

The solution is to upload your whole Laravel project inside the public_html. So then your site would be reached via ewasteweb.ecscorporation.com/public.

Next, copy the index.php file from within the public folder to the public_html root, change the autoload paths and you should be good to go.

Mind you, doing it this way does pose a security risk. All framework files are publically accessible and, even though php files should be covered by your server settings, other files are available.

This is not recommended and I would suggest either talking to your webhosting provider to see if they can change the open_basedir restriction on your account so that you have access to home/sculpt/web/ewasteweb.ecscorporation.com/ . If they can't, I would seriously consider changing to a different webhosting provider.

1 like
Thyrosis's avatar

@jlrdw, as you can see from the error that Vishal has posted, this won't work for his webhost.

In the installation instructions from your link, you are supposed to upload all core files outside the public_html folder. Unfortunately, Vishal's webhost doesn't give PHP access outside the public_html according to the open_basedir restriction. So even though uploading files via FTP might work that way, Laravel still won't work due to unavailable access.

1 like
jlrdw's avatar

That being the case, DO NOT repeat DO NOT use the .env file, hard code your settings in the various config files. Otherwise the env file will be accessable to anyone. At least then you are more secure.

vishal's avatar

Thanks.. It is solved now by allowed the access to that directory.

Please or to participate in this conversation.