Local lamp stack ubuntu 20.04

Hi,

I used this article to setup a local lamp stack for wordpress and general php development on my pop os desktop.

However, when i try to go and create a laravel project inside /var/www/html i get an error:

command: composer create-project laravel/laravel=“8.4.*” laravel

error: [ErrorException]
mkdir(): Permission denied

Is this because we changed the ownership of this html folder to www-data for user and group?

How can i change this to be better suited for local development?

If I run the above command with sudo then I’ll have to keep developing with sudo.

Any alternatives that are better suited for local development?

Thank you.

You can grant permission to additional users with setfacl.

sudo apt install acl
sudo setfacl -R -m u:your_username:rwx /var/www/html/

www-data is still the owner of this directory.

1 Like

Thank you.

I am running into another issue that I am not sure about. I set up the acl as you had suggested.

These are the permissions on my /var/www/html directory:

drw-rwxr–+ 2 www-data www-data 4096 Nov 30 19:23 html/

And i have two files within this directory:

-rw-r–r--+ 1 www-data www-data 10918 Nov 30 14:41 index.html
-rw-r–r--+ 1 www-data www-data 23 Nov 30 14:51 info.php

But, when I go to the browser and type in either

localhost or localhost/info.php

It gives me this error:

Forbidden

You don’t have permission to access this resource.

Apache/2.4.41 (Ubuntu) Server at localhost Port 80

If possible, could you please tell me what I’m doing wrong here.

Thanks.

This has been resolved. I think this was due to my apache configuration. Thank you for the acl guidance that is great. I am able to work on my code without changing ownership.

Best.