To enable local PHP files (on disk) to open in a browser..
sudo apt install apache2 php7.0
- to test apache to see if it's running, get your ip address at eg eth1
ifconfig
- then load it in a browser, e.g.
192.168.1.80
- open the apache conf file
sudo geany /etc/apache2/apache2.conf
- scroll down to around line 164, then add this segment to the directory part of file
starting with <Directory />
-----------------------------
<Directory /home/-user-/-webdir->
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
------------------------------
save the file
- edit the files in /etc/apache2/sites-available/ and change the Document root
sudo geany /etc/apache2/sites-available/000-default.conf
sudo geany /etc/apache2/sites-available/default-ssl.conf
set DocumentRoot to /home/user/wherever-you-keep-your-website/
save the file
restart apache
sudo service apache2 restart
and note any errors that occur!
- use "localhost" in a browser to open your Document root dir
Mysql
Some websites recomment installing LAMP - Linux apache mysql php - but this is a huge download and lots of disk space once installed.
The above method works just fine for viewing php files.
But if you need to set up a server you most likely will need mysql as well, like so...
sudo apt install mysql-server php-pear php5-mysql
you will set upa mysql p/w during the install
then setup mysql by running:
mysql_secure_installation
enter your p/w then answer Y to all (not to change p/w)
service apache2 restart