Php freshy

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
phpBrandNew
Forum Commoner
Posts: 36
Joined: Thu Sep 02, 2010 12:51 am

Php freshy

Post 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 ?
User avatar
McInfo
DevNet Resident
Posts: 1532
Joined: Wed Apr 01, 2009 1:31 pm

Re: Php freshy

Post 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.
phpBrandNew
Forum Commoner
Posts: 36
Joined: Thu Sep 02, 2010 12:51 am

Re: Php freshy

Post 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 ?
phpBrandNew
Forum Commoner
Posts: 36
Joined: Thu Sep 02, 2010 12:51 am

Re: Php freshy

Post 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 ?
User avatar
Apollo
Forum Regular
Posts: 794
Joined: Wed Apr 30, 2008 2:34 am

Re: Php freshy

Post 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.
phpBrandNew
Forum Commoner
Posts: 36
Joined: Thu Sep 02, 2010 12:51 am

Re: Php freshy

Post by phpBrandNew »

Where to see Apache configuration ?
mikosiko
Forum Regular
Posts: 757
Joined: Wed Jan 13, 2010 7:22 pm

Re: Php freshy

Post 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
User avatar
McInfo
DevNet Resident
Posts: 1532
Joined: Wed Apr 01, 2009 1:31 pm

Re: Php freshy

Post 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/".
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Php freshy

Post 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.
Post Reply