Lamp stack: A simple LAMP starter project

I recently started looking into what it takes to get PHP running on Glitch. None of the existing starter projects fulfilled all my expectations, so I decided to make one myself.

The projects is set up as a LAMP version of hello-sqlite. It also has a lot of comments in hopes that it can be used even if you are only a beginner at PHP.

Some noteable changes, compared to the lamp-poc project, are:

  • DocumentRoot (i.e. the folder where files are served from) is set to a specific folder instead of the app root. This makes it easier to control what files can be publicly accessed.
  • Apache logs are saved to the .data folder instead of the .apache2/log folder. This prevents them from being remixed and potentially leaking sensitive information.
  • Apache access logs have the correct IP instead of all logging as
  • Accessing a folder without trailing slash will no longer append port 3000.
  • The error httpd (pid X) already running should be fixed.
  • Several small security improvements.

Since lamp-poc was only a proof of concept there are of cause many more additions. These were just same of the most needed changes, in my opinion.


Curious, what did you do to fix this?

1 Like

The following piece of code, in the start script, does it:

if [ -f .apache2/ ]; then
  kill $(< .apache2/ &> /dev/null
  rm -f .apache2/

When Apache starts, the pid is stored in the file .apache2/ The script looks for the existence of that file, and if found, it kills the process and deletes the file.


Nice, thats pretty slick. Good idea for putting the site contents in a different folder too.


Sorry to bump, but where are the error logs stored in this new project? I can’t find them under /var/log/apache2 or ~/.apache2/logs

Apache logs are in ´~/.data/log/apache´

1 Like

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