Sunday , 12 May 2013
You are here: Home » Tutorials » PHP » Working with files {PHP}
Working with files {PHP}

Working with files {PHP}

This lesson will bring you to the start of using PHP. In this one you will see where we need to place the files so the WAMP server can identify them and also the mode in which we will access them via web browser.

Don’t forget to subscribe to stay updated to our design news! Also take a minute to share this post with others using Social Bookmarks.

How to organize the files in the WAMP server

The WAMP server has been installed in “C:/wamp/” where we will go and will find the basic structure that the WAMP server will create after installation. Here we will find a folder named “www” – representing our working space, because the WAMP server finds it the main information folder. If we go in “C:/wamp/www” we will find a file named “index.php” – representing the file that the server access when we call it from a browser http://localhost/“. If we delete or replace the index.php file we lose the fast hyperlinks that the server offer us. I advice you from the begining not to delete or replace this file because you will have to access everything manual from your browser.

Accessing Files

Photo from Cumbu

To test the interpretation of the file on the server, we will open a browser web and enter http://localhost/index.php. Calling this we will be going to the main page of the server, the page that we accessed last lesson entering http://localhost/. I gave you this example to exemplify the fact that the server access the index files without specifing it.

Exercise 1

Enter in C://wamp/www/ folder and add a new folder named lesson1. Enter and create a new file called page.php – don’t write anything in this file. After this we access it from the browser entering http://localhost/lesson1/page.php/. The browser will return a blank page because we didn’t write anything in page.php file. If case we type just http://localhost/lesson1/ the browser will show us a list with the files from lesson1 folder, because the WAMP server doesn’t find any file named index.

We will stop here with this lesson. In the next one I will give you some free applications to edit the .php files.

About Daniel Rosca

PHP Developer, Back-End Developer, Web Games Developer. For more details visit http://www.danielrosca.com/

3 comments

  1. Brett Widmann

    This was a great article! You have a lot of interesting points.

  2. I am not sure the place you are getting your information,
    but great topic. I needs to spend a while finding out more or understanding more.
    Thanks for great info I was looking for this information for my mission.

  3. I’m really impressed with your writing skills and also with the layout on your blog. Is this a paid theme or did you modify it yourself? Either way keep up the nice quality writing, it is rare to see a great blog like this one today.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>