Sunday, 9 February 2014

Creating Your First Php File

Creating Your First Php File
My First Php
This is a tutorial for creating our first in php file. We installed Xampp for Windows so, Now we are at the stage Xampp is running well and phpmyadmin works so we can work on database system in our local machine. We see our Xampp control panel apache and MySQL starts and stops in the services. In this services we focus on apache and MySQL which we use most frequently.

This tutorial is based on how to create your first file of php and also see its output. We will see phpinfo function in this and hope you can find great info in that ok. So go head and we need open up folder shown in Screenshot, its Xampp folder in C:\ drive C:\xampp by default its install xampp in c drive and it also depends in which drive you had setup your Xampp depends upon you by default its in c:\ drive. In Xampp folder you can see many folders, in that php folder installation folder where you can see all dll files php.ini files. Later in this tutorial, i will show you details about php.ini.


localhost
C:\xampp
htdocs is the folder i want you to focus as you can in Screenshot because we are creating our first php file which will be in this folder. Now let open browser you know now we are running our php files locally on our local machine so in browser we don’t need to write localhost\htdocs\ourfile.php because htdocs is our root directory where our file should be now lets go to htdocs folder and create file myfirstfile.php. Remember, when you create file your extension must be .php.

htdocs
htdocs
There are many text-editor depends on you which one you want to use. Text-editor such as notepad is the best example. I am using conTEXT, you can use notepad++ also. Now opening conTEXT, creating file and i will save it save as root as C:\xampp\htdocsdefault path for saving file and running it on local machine. So creating myfirstfile.php, now you can see local machine in browser open localhost/myfirstfile.php shown in screenshot3. We had only written data in file and it shows in the browser. In this way, we can access our files on browser by help of Xampp root directory.

myfirstfile.php
MyFirstFile.php
In screenshot 4, it is ConTEXT text editor software. Screenshot 5 shows in file>save as will save file name myfirstfile.php. .php is extension of php file will run that file on Xampp localhost on our webserver.

notepad++
Screenshot4
Files
Screenshot5
When i click save its automatically index highlighting. Index highlighting is it highlight php codes such as construction , string , variables, etc. This is the reason why i am using ConTEXT as my text editor. You can see in screenshot6 index highlighting is on. You can also modify index highlighting from option in ConTEXT software.

php Code
Screenshot6
Now see in browser our file localhost/myfirstfile.php, we press enter and this file will loaded in browser. Because its php file you should write html tags in it. Now simply, we write DATA in our php file and you can see in screenshot3 it shows in browser.
So in this way you can create folder directory root in it. So for creating our first file we had done this now our php file tags displayed in screenshot 8.

<?php
<?php ?>
<?php

?>
Its just similar  to how we write  html Codes.

<html>



</html




No comments:

Post a Comment

Thanks For Comment Will get you Soon..

About Me

Welcome to Extra Tutorials! My name is Mohammed and I am the 22 year writer, website developer, and photographer behind the blog. Thanks for visiting! Tutorials Jackpot… In addition to Developer, I love to develop websites and I love to write. Starting a php Blog was inevitable for me. What began as a simple way to share all of my Tutorials with friends and family has developed into my Part time job.

Mohammed Padela

WHAT IS PHP PROGRAMMING

WHAT IS PHP PROGRAMMING
WHAT IS PHP PROGRAMMING

Follow Us

Popular Posts

Designed ByBlogger Templates