Jump to content

Creating, Saving and Recalling Script


Lineman

Recommended Posts

Have just installed PHP5 on my computer which runs a Linux OS.

Now i want to start learning. I have just made a simple HTML page with:

 

<?php

print "Hello World! <br>";

print "Hello World!";

?>

 

Would someone like to explain how and where i might save the HTML file and how to recall it so that i can view the contents. Thanks

Link to comment
Share on other sites

You need to save it with the php extension within your apache document root. You should be able to find this by issuing...

 

grep ServerRoot /etc/apache2/httpd.conf

 

Either that or locate the httpd.conf file manually. Some distros put things in different locations. What distro are you using?

 

From there, you simply need to call http://localhost/scriptname.php from your browser.

Link to comment
Share on other sites

I have installed via a terminal:

 

1) apache2,

2) php5,

3) mysql-server,

4) php5-mysql.

 

I am running Ubuntu "Gutsy Gibbon 7.10".

 

After installing the above i typed: http://localhost into the Web browser's address bar and saw a page with, apache2-default on it.

 

I did manage to navigate to where the apache2-default folder is located and when i opened it clicked on an html file called index.html and was rewarded with the text "It works"?

 

Have saved an html page with an .php extension but i can't work out how to place it in the apache2-default folder.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.