Skip to content

Instantly share code, notes, and snippets.

@zoliky
Last active July 9, 2023 17:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zoliky/2ec4d9401ebede67c6159f5b2ae5cb00 to your computer and use it in GitHub Desktop.
Save zoliky/2ec4d9401ebede67c6159f5b2ae5cb00 to your computer and use it in GitHub Desktop.
Installing Apache and PHP on Debian 12
Installation
------------
$ sudo apt install apache2 php php-mysql php-pgsql php-gd
Configure the firewall:
$ sudo ufw app list
$ sudo ufw allow 'WWW Full'
$ sudo ufw enable
Enable Apache Userdir:
$ cd
$ mkdir public_html
$ chmod 711 /home/zoliky
$ chmod 755 /home/zoliky/public_html
$ sudo a2enmod userdir
Edit the /etc/apache2/mods-available/php8.2.conf file with root privileges
and comment out the entire code section at the bottom of the file:
Before:
# Running PHP scripts in user directories is disabled by default
#
# To re-enable PHP in user directories comment the following lines
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
<IfModule mod_userdir.c>
<Directory /home/*/public_html>
php_admin_flag engine Off
</Directory>
</IfModule>
After:
# Running PHP scripts in user directories is disabled by default
#
# To re-enable PHP in user directories comment the following lines
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
#<IfModule mod_userdir.c>
# <Directory /home/*/public_html>
# php_admin_flag engine Off
# </Directory>
#</IfModule>
Restart Apache:
$ sudo systemctl restart apache2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment