0

I faced a "mkdir(): permission denied" problem when creating a new laravel project via composer by composer create-project laravel/laravel lsapp command, so I was looking at this solution. It said to change the group ownership by sudo chown -Rv root:$USER . but he was doing this to cd var/www/, so this make me wondering if he did this because he put his files into /var/www/ so I should execute the command on /opt/lampp/htdocs/ . or I should execute the command on /var/www/ regardless which directory I use to put my files.

And finally what is the usual directory people used to put their laravel project into ?

update:

I try to change the ownership to both directories so now I know that the command executed to your directory, now the question still what is the best place to put my laravel project, and if I choose /var/www/ how can I open it from the browser with /localhost

1 Answer 1

1

You need to point your apache .conf file to where ever your files are stored. Here is an example:

<VirtualHost *:8000> 
    DocumentRoot "/var/www/myproject/public/"
    ServerName localhost
    <Directory "/var/www/myproject/">
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

This project will be at "localhost:8000"

If your project is not stored in "var/www", then just change those parameters in this block of your conf file in your apache configuration. This can be found in /etc/apache2/sites-enabled/myproject.conf (on linux)

4
  • I set DocumentRoot to "/var/www/public/" and Directory "/var/www/"> but whenever I go to localhost, it takes me to localhost/dashboard which mean that it still take me to /opt/lampp/htdocs/
    – zyydoosh
    Mar 14, 2020 at 17:06
  • May be I should hint that there isn't myproject.conf in the directory you specified, no conf file to my project specifically, there is only 000-default.conf
    – zyydoosh
    Mar 14, 2020 at 17:09
  • and also <VirtualHost *:80> not 8000, and when I changed it to 8000 and write in browser localhost:8000 it said "unable to connect", and when I return it back to 80 it takes me to localhost/dashboard
    – zyydoosh
    Mar 14, 2020 at 17:11
  • 1
    I think this link might help you more: howtoforge.com/tutorial/install-laravel-on-ubuntu-for-apache Mar 15, 2020 at 13:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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