




















































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Find all details on scripting languages
Typology: Lecture notes
1 / 92
This page cannot be seen from the preview
Don't miss anything!
Week- 1 Date:
1. Installation of IIS/WAMP/XAMPP/LAMP web server and configure apache modules and php extensions. Introduction:- XAMPP is a free and open source cross-platform web server solution stack package developed by Apache Foundation, Consisting mainly of the Apache HTTP Server, MySQL database and interpreters for scripts written in the PHP. It is a simple, lightweight Apache distribution that makes it extremely easy for developers to create a local web server for testing and deployment purposes. Services needed to set up a web server – Server application (Apache), Database (MySQL Database), and Scripting language (PHP). XAMPP is also cross-platform, which means it works equally well on Linux, Mac & Windows. Windows web server deployments use the same components as XAMPP, it makes transitioning from a local test server to a live server extremely easy as well. Xampp Server uses Open SSL [Secure Sockets Layer] support. Xampp Server execution requires both Apache & MySQl Modules to be Started. Web Services run with Default URL(Uniform Resource Locator) address with https://127.0.0.1 (or) https://localhost. Xampp Services essentially require to configure with server details such as Server- name, User-name, Password, Database. System Requirements : Software Installations requires XAMPP Sever Software ( Open Source ) & Latest version of Web Browser (Google Chrome/Mozilla Firefox/ Internet Explore /Safari, etc.). In Addition to this hardware support is required with free space of 1 Giga Byte is essential with sufficient dedicated RAM (Min 1GB) for fast processing or execution. In Windows Environment :- Steps for setting up Xampp Server and Execution.
Step 1 :- Run Xampp Server Software (Open Source Software ) from local drive. Step 2 :- Click on Next to Continue installation Process.
Step 5 :- Installation Process continues. Step 6 :- Click on Finish to complete Setup.
Step 7 :- After Installation , Open Local Disk [ Where Xampp is Installed ] & find Xampp Folder [While extraction of server files, where installation is carried out ]. Step 8 :- Open Xampp Folder & Click on Xampp Control icon.
Step 11 :- Click on Start to Run MySQL Server Engine/Module. Step 12 :- Open htdocs folder.
Step 13 :- Create a New Folder with desired name or Roll number [ Ex :- Rollnumber ] Here we save all PHP programs, To execute or Run on Server. Step 14 :- Open a Text Document & write sample PHP program and save file with desired filename with Extension of .php [Example :- addition.php ] & Choose All Files while Saving at Save as Type.
Step 17 :- Choose Tool phpMyAdmin to visit MySQL Database Step 18 :- MySQL Database
Step 19 :- To execute programs, Open Web Browser and type url as localhost/folder name [ Ex:- localhost/jeevan ]. where all the programs saved in directory will display, Click on filename.php to execute. [ Ex:- addition.php ]. Step 20 :- Sample output for addition.php program.
PHP - The if…else Statement. if...else statement - executes some code if a condition is true and another code if that condition is false Syntax if ( condition ) { code to be executed if condition is true; } else { code to be executed if condition is false; } Source Code :-
**Output:-** For Value 75, You have Passed [ Default ] For Value 35, You have Failed For Value 85, You have Passed **Result:-** Hence the program executed successfully. PHP - The if…elseis…else Statement. if...elseif....else statement - executes different codes for more than two conditions Syntax if ( condition ) { code to be executed if this condition is true; } elseif ( condition ) { code to be executed if this condition is true; } else { code to be executed if all conditions are false; } Source Code :-
**Output:-** For Value 35, Sorry! you have Failed [ Default ] For Value 55, Congts! You have Passed in Second Class For Value 85, Congts! You have Passed in First Class **Result:-** Hence the program executed successfully.default: echo "Your favorite color is neither red, blue, nor green!"; } ?> Output:- For empty Value Your favorite color is neither red, blue, nor green! [Default] For Value red, Your favorite color is red! [Default] For Value blue, Your favorite color is blue! For Value green, Your favorite color is green! Result:- Hence the program executed successfully.
2(b). Write a PHP program to illustrate the use of Looping Statements. Aim:- To write a PHP program to execute Looping statements. Program description:- while - loops through a block of code as long as the specified condition is true do...while - loops through a block of code once, and then repeats the loop as long as the specified condition is true for - loops through a block of code a specified number of times foreach - loops through a block of code for each element in an array PHP – The while Statement. while - loops through a block of code as long as the specified condition is true Syntax:- while ( condition is true ) { code to be executed ; } Source Code:-
"; $x++; } ?> **Output:-** The number is: 1 , The number is: 2 ,The number is: 3 **Result:-** Hence the program executed successfully. PHP – For Loop. for - loops through a block of code a specified number of times Syntax:- for ( init counter; test counter; increment counter ) { code to be executed; } Source Code:-
"; } ?> **Output:-** The number is: 1 The number is: 2 The number is: 3 The number is: 4 The number is: 5 **Result:-** Hence the program executed successfully. PHP – For-Each Loop. foreach - loops through a block of code for each element in an array Syntax:- foreach ($ array as $ value ) { code to be executed; } Source Code:-
"; } ?> **Output:-** Red Green Blue Yellow **Result:-** Hence the program executed successfully.