RUNNING A PHP SCRIPT UNDER XAMPP SERVER
BASICS SERVER CLIENT welcome.php <?php localhost/welcome.php <?php ?> header(‘content-type:text/html’); PHP echo “<u>PHP</u>”; RESPONSE <u> PHP </u> By default, output of PHP is raw data. By default, raw data is sent to client as a response. By default, the output-format of PHP is html.
BASICS SERVER CLIENT welcome.php <?php localhost/welcome.php <?php ?> header(‘content-type:text/plain’); <u>PHP</u> echo “<u>PHP</u>”; RESPONSE <u> PHP </u> By default, output of PHP is raw data. By default, raw data is sent to client as a response. By default, the output-format of PHP is html.
EXAMPLE 1 intro.php <?php header(‘content-type : text/plain’); echo “Introduction to PHP”; echo “\nWelcome \n To \n PHP”; ?> OUTPUT: Introduction to PHP Welcome To PHP
HOW TO RUN PHP SCRIPT UNDER XAMPP SERVER Create a folder named as “php programming” in C:\xampp\htdocs (where htdocs is the XAMPP web server root). Save your file intro.php at C:\xampp\htdocs\php programming. Go to start buttonAll programsXamppopen xampp control panelstart “apache” in XAMPP Control Panel”. Open web browser and type the following statement in address bar localhost\php programming\intro.php
EXAMPLE 2 intro2.php <?php header(‘content-type : text/plain’); echo “Welcome \n To \n PHP”; echo ‘Welcome \n To \n PHP’; ?> OUTPUT: Welcome To PHPWelcome \n To \n PHP
EXAMPLE 3 intro3.php <?php header(‘content-type : text/html’); echo nl2br(“Welcome \n To \n PHP”, false); ?> OUTPUT: Welcome To PHP