Php local

Tutorials >
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

sudo geany /etc/apache2/apache2.conf

starting with <Directory />

-----------------------------
<Directory /home/-user-/-webdir->
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
------------------------------

save the file 


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!



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