What is PHP
PHP stands for Hypertext Preprocessor . It is a open source general-purpose scripting language . PHP is suitable for web development and it can be embedded into HTML .
To run php code on local server you have some minimum requirements .
- One local server such and IIS7 or Apache
- Database such as MySql database
- PHP code editor such as notepad , notepad ++ , Dreamweaver
Xampp is one solution to install apache server and mysql database . So first step is download and install XAMPP .
Steps to Run PHP on XAMPP
To run php on XAMPP you need some simple steps . First step is , install XAMPP on computer and run XAMPP control panel .
Check your localhost is working
To check that your local server is working , Go to your web browser .
Type http://localhost in web browser and hit enter button . If XAMPP is installed and working well then xampp default page is displayed .
Create PHP File
Create a sample .php file in notepad++ or any php creator . Copy the following code in notepad and save it as sample.php file . Save sample.php file on xampp> htdocs folder .
<!DOCTYPE > <html> <head> <title>Example</title> </head> <body> <?php echo "Hi, I'm a PHP script!"; ?> </body> </html>
Save PHP File under htdocs Folder
Suppose you installed XAMPP on c drive . Go to c: drive , then go to xampp folder . Find htdocs folder under xampp folder . Create a new folder name mywebsite .
Save sample.php under mywebsite folder . Type the address in your address bar http://localhost/mywebsite/sample.php and run .
Know your php page is running of your local xampp server .
For more details see the video