Wednesday, May 13, 2009

Exercise 06

1. In this exercise with can call up and examine some environment variables on the server.

I have done my exercise at local computer, installed with Apache Server version 2.0.63, MySQL version 5.0.51a and PHP version 5.2.5. I tried to examine the environment variable using the following codes as given in study guide:

The same code by replacing with $REMOTE_ADDR $SERVER_NAME, or $PHP_SELF

The output would be “You are connected from:” without the value of the environment variable of $REMOTE_ADDR. The reason might be due to the difference in OS platform or the version of PHP. I search the internet and able to find out the right programme codes for printing the environment variable as follows:
echo “
”;
?>

The result of the output is: You are connected from: 127.0.0.1.
Then I revise the codes as following:
echo “
”;
?>
The output is: “The Server Name is: localhost”
By examining the environment variable “PHP_SELF”, I then change the code as:
echo “
”;
?>

The output is: “The Name of PHP File is: /ITC594/ex6.php”



2. Create a web application called "hello_world.php" which contains in the body.

The program codes of Hello_World.php are as follows:


$myvar = “Hello World!”;
echo $myvar;
?>


View Hello_World.php using browser with a link:
http://localhost/ITC594/hello_world.php
The output is: Hello World!

No comments:

Post a Comment