Installing Web Server: Apache, PHP, and MariaDB
Install the following Apache, PHP and MariaDB applications and dependecies.
sudo apt install php php-apcu php-bcmath php-cli php-common php-curl php-gd php-gmp php-imagick php-intl php-mbstring php-mysql php-zip php-xml mariadb-server -y
Enable the following modules in Apache.
sudo a2enmod dir env headers mime rewrite ssl
Enable the following modules in PHP.
sudo phpenmod bcmath gmp imagick intl
Run MySQL Secure Installation.
sudo mysql_secure_installation
Disable Apache’s default site.
sudo a2dissite 000-default.conf
Restart Apache.
sudo systemctl restart apache2
PHP Configuration
Open PHP’s ini file.
sudo nano /etc/php/8.3/apache2/php.ini
Use the search function in your text editor to find these setting and make the following changes (matching them except for your timezone if different and your desired upload file size).
Where I state to “un-comment” a field, I’m referring to removing the semicolon preceeding it.
memory_limit = 512M
Maximum upload file size. (In this example, the maximum file size is 10,240 megabytes or 10 gigabytes. Yours can be smaller or larger.)
upload_max_filesize = 10240M
max_exectuion_time = 360
Maximum size of POST data must match that of upload file size.
post_max_size = 10240M
Un-comment and add your timezone. Click here to find your timezone.
date.timezone = America/Los_Angeles
Un-comment.
opcache.enable = 1
Un-comment.
opcache.interned_string_buffer=16
Un-comment.
opcache.max_accelerated_files=10000
Un-comment.
opcache.memory_consumption=512
Un-comment.
opcache.save_comments=1
Un-comment.
opcache.revalidate_freq=2
Save file and exit editor. Then restart Apache.
sudo systemctl restart apache2