Lab 1 Hello World in PHP CSN Class Lab Activity No. 1
Lab 1 – Hello World 1. Install XAMPP on your computer 2. Open the XAMPP control panel and start the Apache service (C:\xampp\xampp- control.exe) 3. Click the Admin button. XAMPP will start the browser and open localhost/xampp. 4. For new installation, click the Language preferred (English) 5. Click the phpinfo() link 6. Find the value of DOCUMENT_ROOT
Lab 1 – Hello World 7. Using the file explorer, open the folder specified in the DOCUMENT_ROOT setting. 8. Under that location, create your own folder. Ex. DOCUMENT_ROOT\nuarinfs 9. Using a text editor, create a file and save it as lab1.php under the directory specified by the DOCUMENT_ROOT setting.
Lab 1 – Hello World 7. Type the following code: 1. echo ' '; 2. echo ' Hello World. Today is ', date('m/d/Y'), ' '; 3. echo 'Your lucky numbers are ', mt_rand(1,31), ' and ', mt_rand(1,31), ' '; 4. echo ' '; 5. echo ' ';
Lab 1 – Hello World 11. Using a web browser, open your lab1.php If using different port number (ex. 8080) Replace nuarinfs with your own folder name 12. Debug your code if necessary and refresh the page. 13. Upload your lab1.php using the file manager File Manager File Manager
Lab 1 – Hello World 11. Upload your lab1.php using the file manager File Manager File Manager Good Luck and Happy Coding!