Once you are done downloading the Apache installer, installing it on a Windows XP SP2 machine is as simple as double clicking the installer and following the on¬screen instructions. On advancing to the screen where it asks for the network domain and server, use localhost. The installer gives you an option of installing Apache
as a service or manual. For simplicity, in this tutorial, we will select manual. The next few screens are of no importance in this tutorial. So, let everything install in its defaUlt location, or in other words, keep clicking Next until you see the Finish screen.
Open the httpd. corif file-configuration for Apache¬located at C:\Program Files\Apache Group\Apache\ conf Search for where it says 'Port 80', and replace it with any port, Port 81, for instance. Next, download and install PHP from its installer executable, again by the same 'click Next' procedure. The PHP 5.2.x installer for Windows comes with a user-friendly installer, so simply follow the on-screen instructions. WPen it asks you for the Apache module, select the Apache 1.3.x module, followed by selecting the path for Apache configuration as C:\Program Files\ Apache Group\Apache\cO'nj\ On the next screen, make sure you select the following two options:
•Extensions --> PDO --> SQLite
•Extensions --> SQLite
... and proceed till you reach the Finish screen. Before ~ e test PHP, append the following lines at the bottom of the httpd.conjfile:
ISEGIN PHP INSTALLEP EDITS - REMOVE ONLY ON UN INSTALL LoadModu1e php5_module "C:/Program Files/PHP/php5apache.dll" PHPIniDir "C: /Program Files/PHP/"
'END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
Now to check if everything is okay, first run Apache.
At the command prompt, execute apache.exe as follows: If everything goes well, you shoUld see the following message:... else consider reinstalling. To test further, create a test.php with the same information as mentioned in the Linux installation section and place C:\Program Files\ Apache Group\Apache\htdocs. Fire up you favourite browser and point it to http:/test.php.You shoUld see a whole lot of listings like the one shown in the Linux installation.
Finally, we will now create the SQLite database. For simplicity, we will set up the database, add tables and then insert data using PHP forms. To create the database, unzip the SQLite zip file to extract sqlite3.exe to C:\. Now, to create the database named ify, at the command prompt specify a name (in our case ify) after the sqlite3 executable, as follows: The prompt will change to sqlite>. Now we are ready to issue SQL commands. Create a table named cusCdtls as follows:
sqlite> create table cust_dtls (ld INTEGER PPIMAP'! KEY AUTOINCPEf1ElIT, name nrchar (10) , date varchar (l0), location varchar (10) ,age integer I ; sq1i e> insert into cust_dt1s(name,dare,locarion,age) values ('LFY' ,'2007-09-01' , 'india' ,25) ;
sqlite> select' from cust_d 15; lILFYI2007-09-01IindiaI25.
If the command line output is similar to the one above, then your table and database have been created successfWly. Verify it by browsing to the root of your C drive, where you shoUld see a file called ify with no extensions. It is not necessary to give file extensions to SQLite database files.
Wrapping it up
In this tutorial we have compiled and deployed Apache,
PHP and SQLite -- both on Linux and Windows. Subsequently, we will play more with SQLite and create few PHP forms to enter and retrieve data. Till then, ciao!




Reply With Quote
Copyright Techfuels
Bookmarks