Setup a LAMP server on desktop pointed to localhost with symlink access[webdev]

Hi everyone, I’m having trouble installing a LAMP server for web development localy on my machine. I know that there are guides in the forum, but nothing so far to setup proper permissions and getting access to files to easily modify php, html etc and be able to see the changes at localhost/ in the browser.

I’ve installed apache php (no mariadb because i don’t use it).

Help anyone ?
And is there any use doing it through containers such as podman or docker ?If so, anyone to help guide through setup ?

See if this tutorial can help you on account of permissions issues… :arrow_down:

Caution: It’s a very long read, but I think you’ll find the chapter on extended permissions ─ and particularly, SGID ─ quite interesting. :wink:

2 Likes

docker exemple:

install docker-compose package :wink:

create in home directory and cd mkdir ~/www/project1/
create sub-dir in “project1” : ./www and ./sql (./www is the http project root)
create one docker-compose file config docker-compose.yml in “project1” (sometime create also a custom dockerfile)

version: '3'

services:
    web:
        image: webdevops/php-apache:7.2
        #doc config at https://dockerfile.readthedocs.io/en/latest/content/DockerImages/dockerfiles/php-apache.html#
        # or if i use my dockerfile, replace "image" line by whereis my dockerfile:
        #build: ./mydocker/.
        ports:
            - "80:80"
        volumes:
            # mount my home "./www" dir in docker contener
            - ./www:/app
        environment:
            PHP_MEMORY_LIMIT: 940M
            PHP_DISPLAY_ERRORS: 0
            PHP_MAX_EXECUTION_TIME: 600
            APPLICATION_GID: 1000
        links:
            - sql9:sql9
    sql9:
        image: mysql:5.5
        volumes:
            # mount my home "./sql" dir in docker contener
            - ./sql:/var/lib/mysql
        ports:
            - "3306:3306"
        environment:
            - MYSQL_ROOT_PASSWORD=root
            - MYSQL_DATABASE=manjaro_bb
    myadmin:
        image: phpmyadmin/phpmyadmin
        ports:
            - "8080:80"
        links:
            - sql9:sql9
        environment:
            - PMA_HOST=sql9
            - PMA_USER=root
            - PMA_PASSWORD=root 

run server : docker-compose up
only first run is long : download images (linux+apache+mysql)
one docker-compose.yml by project and all projects at localhost in manjaro host as phpmyadmin(here port 8080) and mysql cli (mysql -h127.0.0.1 -P 3306 -D manjaro_mydb -u root -p)


APPLICATION_GID: 1000 so if our id is the same : no permission problem

2 Likes

@papajoke cheers !!

To be noted:

  • don’t use tabs in yml
  • install docker, docker-compose and enable docker sudo systemctl enable docker & sudo systemctl restart docker
  • run docker-compose with sudo : sudo docker-compose up
    And after that, it couldn’t setup user www_web_1…

Is there a definite guide to setting up a LAMP server for web dev on localhost ?

In the end, after looking at the how to permissions in Unix/Linux, I followed :

And made the necessary changes mentioned at the end of the commentaries. No need for a symlink after all.

I’ll try and get the docker to work with podman for fun and see if it’s any better then my current setup.
Thank you @papajoke and @Aragorn !!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.