Page 1 of 1

Php freshy

Posted: Sun Sep 05, 2010 4:29 am
by phpBrandNew
Hi, I am totally new in PHP. I downloaded PHP 5 and I got PHP manual, PHP.ini and Licence in All Programs. How do I start ? or am i downloading wrongly ? Where do I type my code ?

Re: Php freshy

Posted: Sun Sep 05, 2010 10:37 am
by McInfo
The easiest way to get started with PHP is to use a pre-packaged bundle like XAMPP. Uninstall the PHP you have installed; then download and install XAMPP.

It's best if you install it somewhere other than the "Program Files" folder, and, ideally, to a path without spaces, such as "C:\xampp". I like to install it to "C:\dev\xampp\v1.7.3". I use the "dev" folder to keep all of my development stuff together and the "v1.7.3" folder so I can have multiple versions of XAMPP.

Re: Php freshy

Posted: Wed Sep 08, 2010 12:57 am
by phpBrandNew
I have installed xampp in C: and Apache is running. I created a file and saved as hello.php in C:\xampp\Apache. I browse as http://localhost/hello.php. I got object not found. Which part I did wrongly ?

Re: Php freshy

Posted: Wed Sep 08, 2010 8:48 am
by phpBrandNew
Finally I solve the problem. The path is c:\xampp\htdocs\xampp\hello.php. I place hello file in c:\xampp\hello.php, it gave me object not found.
My question : Why it is c:\xampp\htdocs\xampp\hello.php and not c:\xampp\hello.php ?

Re: Php freshy

Posted: Wed Sep 08, 2010 9:06 am
by Apollo
C:\xampp is where the xampp program files and settings are installed. This is not necessarily the same (in fact, something entirely different) as your http root dir: the main dir with browsable content which is published by your local webserver.

Your apache config file specifies a 'DocumentRoot' folder, that's the folder you need.

Re: Php freshy

Posted: Wed Sep 08, 2010 10:56 am
by phpBrandNew
Where to see Apache configuration ?

Re: Php freshy

Posted: Wed Sep 08, 2010 11:08 am
by mikosiko
probably in
[text]c:\xampp\apache\conf\httpd.conf[/text]

the XAMPP guide/examples could be useful to read since it cover a lot of questions that you can have.

http://www.apachefriends.org/en/xampp-windows.html#1157

Re: Php freshy

Posted: Wed Sep 08, 2010 1:50 pm
by McInfo
Put your PHP files in the "C:\xampp\htdocs" folder. The "C:\xampp\htdocs\xampp" folder is for the site with the orange background that you get redirected to when you go to "http://localhost/".

Re: Php freshy

Posted: Wed Sep 08, 2010 2:14 pm
by califdon
Apache web server (like all web servers) has a particular directory specified as the "Document Root". It cannot "see" ANY files that are not somewhere in the directory structure from there on down. This is a security requirement to protect your server host. You can specify the Document Root to be anywhere you want, by editing the configuration file httpd.conf and restarting Apache. For a beginner, it is usually better to accept the default Document Root, rather than changing it, but you should take a look at httpd.conf anyway, so you can learn what kinds of things can be customized for Apache. It's a BIG file, with LOTS of comment lines to explain what everything does. You can also find a lot of information online on configuring Apache.