Friday, April 25, 2014

PHP Tutorial Four :Create a First PHP File


Last tutorial we know how to install xampp in our computer. Now we create a php file and write php code. First we will go to our browser. Write in address bar "localhost" and press enter. We see xampp information in our browser.

Now we go to server root folder and create a php file. Go to the xampp folder where we install xampp software. Generally it install in C driver. So we go to in C drive and see the xampp folder. In xampp folder we see many files and folders.
Here we see "htdocs" folder. It is root folder in this side. In browser's address bar we only write "localhost/filename.php" or "localhost/foldername". Cannot write htdocs.








Now we create a php file in htdocs folder. So go to this folder. Write click in blank space. Click "New" > Click "Text Document".

Create A PHP File in server


Now we write file name in this document. In file name we write "firstfile.php". Write .php because it is file extension. Then press enter. If press the enter we see a message. The massage says : "If you change a file name extension, the file may become unusable. Are you sure you want to change it?" We click "Yes", because we went to change the file name extension.


Change the file name with extension


We see the file icon is changed. It will be depended computer default text editor software. My computer default text editor software is "conTEXT". So my file icon is conTEXT software.

Now we open this file in our browser. In address bar we write "localhost/firstfile.php". Then press enter. We see a blank document, because I could no write something in my file.


Browse First php file in browser


Now we open the file in text editor. I use Notepad++ software for text edit. Click this file in right button and click the "edit with notepad++". Write something here in text editor. I write "Welcome to my site". Then save (ctrl+S) this file. Go to the browser and refresh the page. We see here "Welcome to my site."

Some text in php file



So our php file creating is completed. Next tutorial we know "How to write php code".

No comments :

Post a Comment