Putting PHP to practical use

Posted 30 September 2012 - 06:46 PM

I understand the concepts, syntax, and many of the functions of php. The problem I have run in to is in actually putting php to work on a project. I have no experience in web development, and a few things would be helpful, if someone would be so kind.

1. If someone could explain how to upload html/php files to a xampp run apache server, which is my localhost.
2. If someone could suggest some very simple/beginner projects for me to practice on. My main issues in understanding php is how to get it to interact with a mySQL database (although I am versed in mySQL).

As far as question one, I have "googled it", and have come up with suggestions to save it to the htdocs folder as the index page/another page. Then you could edit in a link on the index page. This doesn't work for me... When I try to save a new index page, my computer tells me, "that directory does not exist."

As far as the second one goes, it may sound like an odd request. I don't understand how to apply php, however, so it is difficult for me to conceptualize how to get a project done. I can write code, but everything that I have written so far has been purposeless. The most complicated thing I've done was automate dice rolls with modifiers for a game I play.

This inability to put my knowledge (although it is not extensive by any means) to good use has frustrated me to no end. Any help would be appreciated!

Replies To: Putting PHP to practical use

Re: Putting PHP to practical use

Posted 30 September 2012 - 07:02 PM

POPULAR

Quote

1. If someone could explain how to upload html/php files to a xampp run apache server, which is my localhost.

If it's a local server, then there is no "upload" required. All you have to do is save the files in the correct location. By default, if I recall, XAMPP servers it's files from the "C:\xampp\htdocs" folder. Any file you put in there will be accessible via Apache.

To access files via Apache on a local server, you type in http://localhost/file.php, which would then show you the PHP file located at: C:\xampp\htdocs\file.php.

Keep in mind that if you go to a directory, like http://localhost/dir/ then Apache will (normally) show the file named "index.html", or "index.php", inside that folder. In this case: C:\xampp\htdocs\dir\index.php (or .html)

Quote

2. If someone could suggest some very simple/beginner projects for me to practice on.

Simple blogs are always a popular project for new PHP coders. They don't have to be horribly difficult to create, so it servers as a nice way to get the experience required to start larger projects.

Re: Putting PHP to practical use

To access files via Apache on a local server, you type in http://localhost/file.php, which would then show you the PHP file located at: C:\xampp\htdocs\file.php

I would say that it shows you the results of the PHP interpreter's processing of file.php. That's a critical distinction from the contents of that file, and one that beginners really need to pay close attention to if they want to avoid many typical beginner mistakes.

Re: Putting PHP to practical use

Posted 01 October 2012 - 09:07 AM

Thank you all for the replies!
@ Atli
That's exactly my issue though. I have tarted to save a file in the htdocs and it will not save. It give me the message "that directory does not exist."
Thanks for the suggestion! I'll see if I can do some research into how to go about getting a blog up and running.

Re: Putting PHP to practical use

Posted 01 October 2012 - 11:14 AM

Tanrou, on 30 September 2012 - 06:46 PM, said:

Also, any suggested reading is also welcome!

Read an ebook. At the very least it should help you get PHP/Apache up and running. I could recommend one that I'm reading right now. It covers a fairly large area of subjects and you can jump from chapter to chapter as you like to explore each subject. You said that one of your problems was interacting with MySQL databases, I believe that's covered in length in one chapter, I believe it was Chapter 19 (Introducing PDO). It also mentions it briefly in chapter 14 (using MySQLi) but that chapter wasn't anything close to helping me out with MySQL, don't know about you.

The book's name is: "Beginning PHP and MySQL - From Novice to Professional" and the author is W. Jason Gilmore. I think there are also a fair bit of comprehensive guides here on D.I.C., but personally I know I prefer to read e-books when I'm just getting familiar with something. Guides are something I'd refer to once I'm into the language a bit more.