2

I recently set up my VPS on CentOS 7 with VestaCP, as I've heard many great things about it. Everything is great except that I can't run a Laravel project on it. I've followed a couple of tutorials on how to set up a Laravel project on VestaCP, but it doesn't do anything.

I have the contents of my public folder in public_html, and I have everything else in private/laravel folder, outside of public_html. I edited the index.php file to include bootstrap/autoload and bootstrap/app like I always do when uploading projects to hosting, but this time it doesn't work at all, and throws me a HTTP ERROR 500.

My initial thoughts were that it must be Apache permissions, but that didn't work at all. If anyone can help me out at all, I'd be really grateful.

Sean Whelan
  • 299
  • 4
  • 14
  • Check your error logs, it will give you a clue of what's going on. – aynber Sep 07 '16 at 14:56
  • Here's my apache error_log, doesn't look like there's any immediate errors relating to my problem :/ http://pastebin.com/raw/MHhYr6Q9 – Sean Whelan Sep 07 '16 at 15:00
  • Laravel will log its errors in storage/logs or app/storage/logs, and bypass the apache logs. – aynber Sep 07 '16 at 15:01
  • Oh, sorry. there wasn't anything in the log (just errors from a few days ago), however, I have just realized that my PHP version looks to be not recent enough for Laravel to run when i ran `phpinfo();` on index.php, would that be what's causing the error? I'll go ahead and update anyway – Sean Whelan Sep 07 '16 at 15:06
  • I went ahead and updated PHP to 7.01, still no luck. – Sean Whelan Sep 07 '16 at 15:45

1 Answers1

0

The error occurs because php is not given access to your private/laravel directory. You can check for this in the logs in /var/log/httpd/domains/yourdomain.com.error.log. If the log message says open_basedir restriction in effect then you can confirm the problem.

To resolve this you need to add your private/laravel directory into the open_basedir path in /home/username/conf/web/httpd.conf and /home/username/conf/web/shttpd.conf.

  • In the .conf file, find listing corresponding to the domain for which the error occurs.
  • Append your path to this line php_admin_value open_basedir /home/username/web/yourdomain.com/public_html:/home/username/tmp.
  • After appending the path the line will be like this php_admin_value open_basedir /home/username/web/yourdomain.com/public_html:/home/username/tmp:/home/username/web/yourdomain.com/private/laravel.
  • Save and exit.
  • Now restart your apache server service httpd restart.
Akhil Mohan
  • 105
  • 2
  • 11