Lab03-PHP01 V1.02 - updated
Lab03-PHP01 V1.02 - updated
PHP
1. All the labs for this subject will be performed in Windows platform. However, you
are welcome to use any other platform you are familiar or comfortable with.
3. Once the download has been completed, install the XAMPP with administrator
rights.
4. If you received the following error, please make sure that the installation directory of
XAMPP is C:\xampp
- Reference: https://stackoverflow.com/questions/26208848/xampp-installation-on-
win-8-1-with-uac-warning/26209109
-
6. Skip this step and the following step if you do not have VMware Workstation
installed on your machine. You will receive the following error when you try to start
apache. This happens because the VMware and Apache is using the same port which
would result in the error.
7. To change the port, I would recommend changing the Vmware port instead of the
apache port number. Refer the following reference and make the changes accordingly.
- Reference: https://stackoverflow.com/questions/21182512/how-to-stop-vmware-
port-error-of-443-on-xampp-control-panel-v3-2-1
8. Click Start for Apache and MySQL, you should see “status change detected: running”
for both module/services.
9. To verify the Apache installation, open a browser, type in http://localhost.
Screenshot the output.
11. To view the php version and settings installation, create a basic phpinfo.php page
to view the settings of the php installed.
14. To check the settings and version, go to your browser, and type
http://localhost/phpinfo.php If you have done everything correctly, you should see a
page containing all the php information. Screenshot the output
Creating a Basic Php Script
15. Create a simple php script as given below. Replace the name with your own name.
** Notes: You can insert HTML code in Php, but you cannot insert Php code in HTML.
Reference: https://www.quora.com/Does-PHP-go-into-the-HTML-code
17. You may utilize the previous file, and type in the following code. Replace “chew”
with your own name. Screenshot the output of the following code.
** Note: you will not see a new line from your browser view because the new line is only
generated in the html context, a new line in the html context does not make a different.
** To make the newline visible in the html, you can either use the <br> tag or <pre> </pre>
tag
Reference: https://stackoverflow.com/questions/12410695/new-line-n-in-php-is-not-working