How do I set up a localhost website?
First you need to install Apache 2 and PHP (since you are using index.php)
sudo apt-get install php5 apache2
That will install both apache2 and PHP
That should work after you installed it. Also, you don't need to make index.php executable. It just needs to be readable.
Related videos on Youtube
SimplySimon
Personal details Ex-Lorry Driver, Singer, Poet, Artist, Photographer, Caravanner, programmer, Walker, Reader, Techie, Website Hobbyist & Dad September 2014 saw my beautiful wife and I, selling our house and taking to the roads in a caravan for 4.5 years to 'do Europe' 47 countries accessible by caravan.
Updated on September 18, 2022Comments
-
SimplySimon over 1 year
I have created a simple index.php file which I have places in
/var/www/
next I changed the permissions of the file withsudo chmod +x index.php
I then ran Chromium and typed in localhost to the address bar. Chromium then reports that it's connection attempt to localhost was rejected. The website may be down or your network may not be properly configured.
I have a strong feeling that I have not configured something (or anything) as it should be configured.
I have searched through a number of posts before adding this question and could not find the answer.
Can someone point me in the right direction please
do I need to install LAMP?
Update 1
the following lines appear in my /etc/hosts file:
127.0.0.1 localhost 127.0.1.1 simon
-
llt almost 11 yearsHave you installed apache2? If not, check my answer.
-
-
SimplySimon almost 11 yearsI am currently installing as suggested, to remove the executable permission, do I need to enter
chmod -x index.php
? -
SimplySimon almost 11 yearsI answered that question by trying it :) Thank you so much for your help. It's not easy being a novice, but I'm learning!
-
llt almost 11 yearsThat's good to know. Keep learning and applying what you learn :)