1

enter image description hereenter image description herescreenshot

I have no background in PHP, I don't have a public IP address nor a domain, but I want to create a website; to install LAMP I followed the instructions here, but my script does not seem to work.

I have tried adding a little space after the parenthesis symbol, but I get the error as the one on the image.

  • Not sure if this tutorial is correct. I don't see mod_php in there. Do you have libapache2-mod-php5 installed? Have you restarted Apache after installing php? Or reloaded: sudo service apache2 reload? – Benjamin Maurer Jan 29 '16 at 08:44
  • I tried with the additional space too. and I saw another post and I installed libapache2-mod-php. Let me try reload. I'll tell you in a moment – Ken Sandoval Jan 29 '16 at 08:47
  • Is the IP address I'm using correct isn't it? 127.0.0.1 – Ken Sandoval Jan 29 '16 at 08:48
  • The problem seems to be Apache here. If it was PHP to not be working either the source code or a blank page would be displayed, I don't remember exactly, but for sure not a 404. – kos Jan 29 '16 at 08:49
  • Can you see the Apache test? it worked but not the php – Ken Sandoval Jan 29 '16 at 08:52
  • Reload didn't work, Did you see the second image? – Ken Sandoval Jan 29 '16 at 08:56
  • Where did you put the .php file? It should be in the DocumentRoot directory and readable by apache. – cylgalad Jan 29 '16 at 08:59
  • Ok, then you're probably putting in the wrong address. The root directory for Apache in the latest versions is /var/www/html. That corresponds to 127.0.0.1. If you put the file in say /var/www/html/phptest you'll need to go to 127.0.0.1/phptest/phpinfo.php. – kos Jan 29 '16 at 09:01
  • This is Exactly what I did:

    Testing PHP5 and MySQL In order to test PHP script you need to create simple PHP script in directory /var/www/html. in this case I’ll create phpinfo.php:

    sudo touch /var/www/html/phpinfo.php sudo nano /var/www/html/phpinfo.php Add the following line into file /var/www/html/phpinfo.php

    Save and Test the php script you have made from web browser by typing in address bar http://ip_address/phpinfo.php. It will appear like screenshot on below.

    – Ken Sandoval Jan 29 '16 at 09:02
  • Would you do a sudo service apache2 restart please and try it again – Benjamin Maurer Jan 29 '16 at 09:11
  • I did the mv command and it says that the file already exists in that directory /var/www/html/phpinfo.php. – Ken Sandoval Jan 29 '16 at 09:11
  • restart did not fix it, What about the command sudo touch /var/www//html/phpinfo.php. Could have that one affected something? – Ken Sandoval Jan 29 '16 at 09:18
  • Meh. What does sudo apache2ctl -M | grep php give ya? Trying to find out if php5_module was loaded. My suspicion: apache2ctl -M won't list php5_module. I think the tutorial is bogus. If php5_module wasn't installed automatically, it can't work. See this tutorial, where they install it: https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-14-04 – Benjamin Maurer Jan 29 '16 at 09:23
  • Sorry guys. I fell asleept. it was 330am here in costa rica. by the way I am talking through the stack exchange mobile app. is cool in case yiu are away from yhe computer. Now, here is what I sm going to do. 11 am going to start it all over. I will havve to use another tutorial. do you guys have any better? but I have questions because I am interested in building my dynamic website...: I was asking people that use Amazon AWS an I Also asked google cloud platform services about ehat – Ken Sandoval Jan 29 '16 at 14:21
  • I waz asking about what I can do woth their services. but if I sss able to build my own website and host it myself it would be great. do.you guys think I could do it using the Ubuntu server LAMP pñatfotm only? or you suggest somehting better? – Ken Sandoval Jan 29 '16 at 14:24
  • Put 127.0.1.1 UBUNTUSERVER in /etc/host to suppress the message from the first screenshot - http://askubuntu.com/questions/811098/when-i-run-a-sudo-command-it-says-unable-to-resolve-host/811113#811113 – pa4080 Dec 09 '16 at 16:13

1 Answers1

1

enter image description here

  • I found what the error was!.
  • The Address I was putting was the loopback one, I typed the Static from the Server I finally got it.
  • That was the solution.
  • Thank you very much for posting this. Right now I am having exactly the same problem. Could you please tell me, wheat "the Sttic from the Server" means, and where can I find it? – Adrian Ciarli Mihai Dec 09 '16 at 16:06