Changes

Jump to: navigation, search

OPS335 Lab 6

21 bytes added, 10:22, 23 March 2020
Creating a PHP Script
'''Perform the following steps:'''
#Rename '''Copy''' the '''index.html''' file to as '''index.php''' and modify it to contain:<br><source>Hello, this is a web page on vm1.youruserid.ops and the current time is <?php system("date"); ?>!</source>
<ol><li value="2">On your host machine, again refresh your in the web-browsermanually add '''/index.php'''. Notice that in a web browser the ''index.php'' file isn't treated as a default page and the contents don't contain the date, but instead are displaying the text in the php code you entered into the index.php file (refer to above code).</li>
<li>The reason this occurs is that the PHP interpreter hasn't been installed on your vm by default.</li>
<li>Install the php package on your vm1 machine, and restart your webserver. NOTE: The php package comes with a working default Apache configuration so you don't need to enable it manually.</li>
<li>Refresh the webpage for in your web-browser on your host machine. You should now notice that you see the date instead of the call to the date command. Refresh your webpage several times to see how the time changes. This is simply a "trivial example" of dynamic web content does it does provide a simple demonstration of how scripting languages can be used to create more dynamic webpages.</li>
</ol>
572
edits

Navigation menu