This page is intended for people who wish to use Apache server with PHP and Sqlite3 database.
The instructions below are for Linux Mint version 20.2 called Uma, and the latest version of PHP 7.4 that is included in the Software Manager. If you have version 20.3 see installing PHP 8.1
STEP 1: Select and install programs that are already included in the Software Manager
- Select Apache2 HTTP server and click the Install button to install it.
- Select Php7.4-sqlite3 and click the Install button to install it.
- Select Sqlite3 and click the Install button to install it.
- Optional: Select Sqlitebrowser and click the Install button to install it.
Run the following command in a Terminal window to install Apache PHP modules:
sudo apt install php libapache2-mod-php
Then you will get the following message:
The following additional packages will be installed:
libapache2-mod-php7.4
php7.4
php7.4-cli
php7.4-json
php7.4-opcache
php7.4-readline
After the installation of these programs, call http://localhost/ in a browser window to see if the Apache server is working.
STEP 2: Define the default location of the website for your Apache2 server
In the Apache server, the default directory of the website is /var/www/html
.
If you wish to change this location, edit the Apache configuration file by calling xed editor in a terminal window.
sudo xed /etc/apache2/sites-available/000-default.conf
Add a hash (#) sign at the beginning of the following line to mark it as a comment:
DocumentRoot /var/www/html
Add the following line after the commented out line:
DocumentRoot /The-location-of-your-website
Save the file and exit.
Edit Apache configuration file:
sudo xed /etc/apache2/apache2.conf
Towards the end of this file there is a series of lines with the following format:
<Directory ...> . . . </Directory>
To add the location of your website directory, add the following at the end of the list:
<Directory /The-location-of-your-website> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory> # The default file names to load, such as "index.htm". DirectoryIndex index.htm index.html
To reload these new definitions, stop the server.
sudo service apache2 stop
Restart the server.
sudo service apache2 restart
Finally, open a browser window and call http://localhost/ to see if the website is visible.