Msg#: 3858014 posted 4:36 am on Feb 26, 2009 (gmt 0)
I want to use PHP as the scripting language in HTML and I want to view the results offline to verify the PHP code.. I tried searching on google but I am a bit confused. The results tell that I ll have to install Apache first and then download and configure PHP with it. Now I already have XAMPP control panel installed on my system for using Joomla and it comes with apache and PHP I guess..
DO I need to download and install Apache and PHP separately or I can use it from XAMPP.
And how to configure exactly ? I have just started out..
Msg#: 3858014 posted 4:58 am on Feb 26, 2009 (gmt 0)
XAMPP is Apache, PHP, MySQL and Perl bundled together. If that's already installed on your PC, then you're set. Check the XAMPP website [apachefriends.org] (or Google of course) for configuration options and help. I personally install Apache, PHP and MySQL from source code so I am not familiar with this distribution, but alot of people use it. You can also find plenty of Apache & PHP tutorials out there, plus apache.org [apache.org] and php.net [php.net] have as much information as you'd want about them.
One thing you should be mindful of, is that PHP is a server side language that (among other things) can provide content for the user, whether that's (X)HTML, XML, plain text, etc. It's not in HTML. HTML is just a markup language that browsers use to format a document. One of the typical tasks that PHP can perform is to read records from a database (such as MySQL), take that data and use it to create a webpage on-the-fly. So the HTML is actually in the PHP script.
Here's a quick breakdown of a typical client / server transaction with Apache and PHP: 1) The user requests a webpage via the URL (e.g. example.com/index.php) 2) The server (Apache) receives the request and looks for the document. If that document is one that is recognized as a specific application type (in this case PHP), the Apache PHP module will parse the file and perform whatever task is coded there. In doing so, let's say it creates an HTML document with certain information just retrieved from a database. 3) Apache then returns the dynamically created HTML document to the user. 4) The user's browser determines the content type based on the formatting in the returning document and displays the content.