|
|
#1 |
|
Swine Buddy
Join Date: Apr 02
Location: Langley, Berks, UK Mode: Restructuring
Posts: 4,833
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
PHP Tutorial: Installation
Installing PHP, MySql and Apache on Windows N.B: This tutorial contains images. Over a dial up connection, it will take approximately 90 seconds to download all supported images. It is often useful to have an installation of PHP on your local system for testing purposes. This tutorial will show you how to install and configure your own web server with PHP and MySql in a Windows environment. I will also show you how to secure your installation to ensure that no one but you can gain access to it. Prerequisites
Last edited by visualAd; Mar 26th, 2005 at 05:20 AM. |
|
|
|
|
|
#2 |
|
Swine Buddy
Join Date: Apr 02
Location: Langley, Berks, UK Mode: Restructuring
Posts: 4,833
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Download & Install
MySql
Download & Install Unlike Microsoft Access, MySql comes in two parts. The database server and the client, which connects to the server.
Last edited by visualAd; Mar 28th, 2005 at 12:27 PM. |
|
|
|
|
|
#3 |
|
Swine Buddy
Join Date: Apr 02
Location: Langley, Berks, UK Mode: Restructuring
Posts: 4,833
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Testing the Installtion
Testing the Installtion
The installation and configuration is now complete and you should now be able to connect to the server. Fire up the command prompt via the Start Menu: Start Menu --> Programs --> Accessories --> Command Prompt Now enter the following command line to connect to your database server using the MySql client: Code:
mysql -h localhost -u root -W -p You should see the above if the installation has been successful. You should note the purpose of the following command line switches used to connect to the server: -h : the host name you are connecting with -u : the user name you are connecting with -p : tells the client to prompt for a password before attempting to connect. -W : you'll recall from step 9 of the installation that you disabled TCP/IP for the server. This switch tells the client to connect using a named pipe instead of via TCP/IP Finding your way Around You have now connected to the database server with the MySql client which was included with the installation. It is useful to get a feel for the command line interface by entering a few queries. All queries must end in a semi colon: SHOW DATABASES; - Will show all the databases on the server. The MySql database should only ever be accessed by the root MySql user as it contains all the information including passwords and permissions on how can access other databases. CREATE DATABASE [dbname]; - Will create a new database with the specified name. USE [dbname]; - Will change the database to that with the name specified. Once you have selected a database you can create and modify tables and index and execute queries on that database. DROP DATABASE [dbname]; - Will delete the database with the name specified. As user unfriendly as it may seem, there is no “Press Y to confirm” when you use this. Use it with caution as there is no going back once you have dropped a database. N.b: on a Windows system, database, column and table names are not case sensitive due to the fact the Windows NTFS and FAT 32 files systems are not case sensitive. However, UNIX file systems are case sensitive and hence MySql; and, as many web hosts will host their database on UNIX systems, it is advisable you use the following naming conventions to ensure your applications do not break when you port them to your web host:
Securing the Installation If you have followed the instructions above then you already have a secure MySql server installation. By only allowing connections via named pipes, only programs running on the local computer can access the server. Its now time to prepare and secure the server for use by PHP.
Last edited by visualAd; Dec 18th, 2005 at 02:59 PM. |
|
|
|
|
|
#4 |
|
Swine Buddy
Join Date: Apr 02
Location: Langley, Berks, UK Mode: Restructuring
Posts: 4,833
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: PHP Tutorial: Installation
Apache
Apache is a powerful HTTP web server. A web server enables you to host specific files which can be downloaded via HTTP (Hyper Text Transfer Protocol) and displayed in a web browser. As well as displaying files Apache allows you to invoke programs on the server and have their output (HTML) sent to the web browser. Apache will allow us to execute our PHP scripts. When a request is made for a PHP script Apache will run the PHP executable and feed in the requested script. PHP will process the script and finally Apache will send the output of the PHP executable back to the client who requested it. Download & Install N.B: Before installing Apache, ensure that all other web servers installed on the system, such as IIS have been turned off, otherwise you will be unable to start the web server.
Testing the Installation If you have Windows XP Service Pack 2 installed and the Internet Connection Firewall enabled, you may see a warning when Apache starts. This is because it is attempting to listen on port 80 for remote connections originating from any computer, whether it be on the local network or the Internet. I will show you how to disable this in the section on Securing the Apache Installation. To test the installation was successful, open your favourite web browser and enter the following URL: http://localhost/ You should see the Apache start page. This page will contain a link to a local copy of the Apache manual. Finding your way around The root installation directory C:\Program Files\Apache Group\Apache2 contains the following significant sub directories: bin – this directory contains all Apaches executable files cgi-bin – contains CGI programs / scripts which are executed by Apache. htdocs – contains the web pages for your site conf – contains Apaches configuration files. The main configuration file is called httpd.conf. Securing the Installation At this point we want to ensure that our web server is only accessible via the local machine and not to people from outside on the Internet. I strongly recommend that unless you are an advanced user, you follow these steps to prevent outside access.
Last edited by visualAd; Mar 26th, 2005 at 04:26 AM. |
|
|
|
|
|
#5 |
|
Swine Buddy
Join Date: Apr 02
Location: Langley, Berks, UK Mode: Restructuring
Posts: 4,833
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: PHP Tutorial: Installation
PHP
It is now time to install PHP. After installation, we will need to go back to the Apache configuration file and make some changes so it knows how to deal with PHP files. PHP is an HTML embedded server side scripting language. It allows you to introduce logic to what would otherwise be static web pages and create server side applications. Download & Install The latest version of PHP can be found at http://www.php.net/downloads/. At the time of writing there were two stable versions of PHP. PHP 4 and PHP5. For this tutorial we will be downloading the Windows Zip archive of PHP 5.0.3 You'll need to ensure you have a compression utility such as quickZip which can extract zip archives to view this file.
Configuring PHP Before running PHP for the first time we need to create a configuration file. PHP's configuration file is called php.ini.
Configuring Apache
Testing the Installation We should now be able to run PHP through the web server and connect to the MySql database server through PHP. Follow these steps to test whether or not the installation of PHP has been successful.
Next we need to write a script to test the database connectivity.
Securing the Installation Most of the steps we have already taken to secure our setup also filter through to PHP. Both PHP and Apache will however, run with administrative privileges. This means they will have access to any file on your system. To lock down the installation and ensure that only the Administrator can change the configuration:
Last edited by visualAd; Apr 27th, 2005 at 09:27 AM. |
|
|
|
|
|
#6 |
|
Swine Buddy
Join Date: Apr 02
Location: Langley, Berks, UK Mode: Restructuring
Posts: 4,833
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Congratulations Congratulations, you have now got a complete PHP installation on your system, ready for development of web applications. Good luck. Copyright: All Rights Reserved By Adam Delves If you have any comments, questions or suggestions regarding this tutorial please post them here. Sources MySql AB – http://www.mysql.com/ Apache Group – http://www.apache.org/ PHP.net - http://www.php.net/ Acknowledgements Thank you to Manavo11, Pino and NoteMe for proof reading the tutorial.
__________________
PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2 | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am. Random VisualAd: Spread happiness and joy. Rate good posts.
Last edited by visualAd; May 5th, 2005 at 06:31 AM. |
|
|
|
|
|
#7 |
|
New Member
Join Date: Aug 08
Posts: 1
![]() |
Re: PHP Tutorial: Installation
Hi , everything worked for me Exept http://localhost/db.php
when i enter Code:
### PHP Configuration LoadModule php5_module "c:/php/php5apache2.dll" AddType application/x-httpd-php .php # configure the path to php.ini PHPIniDir "C:/php" |
|
|
|
|
|
#8 |
|
Swine Buddy
Join Date: Apr 02
Location: Langley, Berks, UK Mode: Restructuring
Posts: 4,833
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: PHP Tutorial: Installation
If only I were able to read your mind. Unfortunately I cannot, so you are going to have to give me details of this mysterious error.
__________________
PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2 | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am. Random VisualAd: Spread happiness and joy. Rate good posts.
|
|
|
|
|
|
#9 |
|
Swine Buddy
Join Date: Apr 02
Location: Langley, Berks, UK Mode: Restructuring
Posts: 4,833
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Re: PHP Tutorial: Installation
P.s: please post this in the discussion thread: http://www.vbforums.com/showthread.php?t=330926
__________________
PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2 | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am. Random VisualAd: Spread happiness and joy. Rate good posts.
|
|
|
|
![]() |
|
||||||
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|