1

Running Fedora 28 with Apache server and in /var/www/html having Laravel app. Apache is running under user apache. I'm starting the app with my current user, but getting Access denied for the laravel.log file in the app. Tried many different solutions on the web, changing mode to 777, changing owner, group, but none of them actually worked. There was a comment, stating that this is the default installation in Fedora for the test page and I have to create different virtual directory for my app with different user attached to the apache group. What is the right and working way of doing that?

2
  • How are you starting the app? Are you using php artisan serve as a user directly from the /var/www/html directory? Or are you using the default index.php via Apache? – Mr Shunz Sep 4 '18 at 9:38
  • Starting via php artisan serve as a user. – worldwildwebdev Sep 4 '18 at 9:43
2

As per your comment, starting a Laravel App directly with php artisan serve with a non privileged user from a system directory (as /var/www/html is) creates a lot of permission problems.

Looks like you already have Apache installed, and deployed your application to the default web root.

The easiest step should be to make sure you have mod_php installed on your system, checking if Apache configuration has the correct DirectoryIndex (something like DirectoryIndex index.html index.cgi index.php) and then just point your browser to your server IP/name without using php artisan serve (let Apache do its thing ;) ).

If you instead would like to continue using php artisan serve, as an alternative, you can deploy the application to a subdirectory of your home directory (for example, /home/youruser/my_app), then you can use php artisan serve and have the correct permissions (as your user owns all the directories and files under your home).

Obviously, in this case you cannot use a privileged port like 80 or 443 as in the previous case (IIRC php artisan serve uses port 8000 by default).

So, using Apache+PHP you can reach your app via http://my_app/, while with the "artisan" method you'll reach it with something like http://my_app:8000/.

1
  • I went with php artisan serve and working like charm. Thank you. – worldwildwebdev Sep 5 '18 at 8:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.