Recently for one of my project I have installed Laravel 5.3 on server but after installation when I tried to run it in web it was showing 500 Internal Server Error so I had to spend few hours in resolving it so here in this blog I am going to explain what was the issue and how I solved it.
1) Find out the Error.
I looked into to server logs from cPanel and found out following error.
SoftException in Application.cpp:429: Mismatch between target UID (501) and UID (99) of file "/path/larravel/public/index.php"
After searching for sometime about this error I figured out that the apache or web user was not owner for the files because I created laravel project through SSH so the logged in SSH user was the owner of the files and folders.
So when apache or web user tried to access the files it was not working. So the solution was to change the ownership of files and folders to apache user.
2) Find out the username of apache user.
In most cases user name of apache user should be www-data or apache or apache2 but in my case since I was using VPS the username was different. So run following command in terminal through SSH
ls -l
It will give you file list with user and group owner. That's your web username. Now change the ownership of folder to this username.
1) Find out the Error.
I looked into to server logs from cPanel and found out following error.
SoftException in Application.cpp:429: Mismatch between target UID (501) and UID (99) of file "/path/larravel/public/index.php"
After searching for sometime about this error I figured out that the apache or web user was not owner for the files because I created laravel project through SSH so the logged in SSH user was the owner of the files and folders.
So when apache or web user tried to access the files it was not working. So the solution was to change the ownership of files and folders to apache user.
2) Find out the username of apache user.
In most cases user name of apache user should be www-data or apache or apache2 but in my case since I was using VPS the username was different. So run following command in terminal through SSH
ls -l
It will give you file list with user and group owner. That's your web username. Now change the ownership of folder to this username.
chown -R username:username laravel
That's it. Now run your laravel project and it shall display following screen.
That means your laravel project is working fine on the server. Hope this helps you.
No comments:
Post a Comment