The following are step-by-step instructions for creating your own PHP (PHP Hypertext Processor) applications on the Baruch linux lab server.
- Follow all of the instructions above on how to create a web (HTML) page.
Make sure you have created your test HTML page and that it works. - Change to the
public_html
directory using thecd
command as follows:
cd public_html
- Now you can create a new PHP page. For example, we will create a PHP page and name it:
mypage.php
Use the pico editor to create this simple PHP page. Type: pico mypage.php and then when Pico starts up, type in the following HTML and PHP text:<xmp style="font-family: 'Times New Roman'; white-space: normal; "><xmp><HTML> <BODY> <H1>This is my first PHP Page</H1> <P> Here is some text in my new PHP page <P> <?php echo '<p>Hello World from PHP</p>'; ?> <P> <?php echo 'Today is: '; echo date("F d Y"); ?> <HR> <P> Bye for now </BODY> </HTML> Save this file and exit pico. - Change the permissions of this file so others can read it:
chmod 644 mypage.php - To access this page while on Baruch's campus, the URL takes the form:
http://10.2.86.39/~username/mypage.php
- For example, if your username is
billg
and you made a page calledmypage.html
then your PHP URL is:http://10.2.86.39/~billg/mypage.php
- Note that you can also create subdirectories under your public_html directory for different projects and collections of pages.
No comments:
Post a Comment