Installing Apache PHP and MySQL
PHP and MySQL are usually associated with LAMP (Linux, Apache, MySQL, PHP).
However, most PHP developer ( including me ) are actually using Windows when
developing the PHP application. So this page will only cover the WAMP ( Windows,
Apache, MySQL, PHP ). You will learn how to install Apache, PHP, and MySQL
under Windows platform.
The first step is to download the packages :
- Apache : www.apache.org
- PHP : www.php.net
- MySQL : www.mysql.com
You should get the latest version of each packages. As for the example in
this tutorial i'm using Apache 2.0.50 ( apache_2.0.50-win32-x86-no_ssl.msi
), PHP 4.3.10 ( php-4.3.10-Win32.zip ) and MySQL 4.0.18 ( mysql-4.0.18-win.zip
).
Now let's start the installation process one by one.
- Installing Apache
- Installing PHP
- Modifying Apache Configuration
- Installing MySQL
- Modifying PHP Configuration File
Installing ApacheInstalling apache is easy if you download the Microsoft Installer ( .msi I'm using Windows XP and installed Apache as Service so everytime I start Click the Next button and choose Typical installation. Click Next one more To see if you Apache installation was successful open up you browser and
By default Apache's document root is set to htdocs For example, if you want to put all your PHP or HTML files in C:\www DocumentRoot "C:/Program Files/Apache Group/Apache2/htdocs" and change it to : DocumentRoot "C:/www" After making changes to the configuration file you have to restart Apache Another configuration you may want to change is the directory index. Suppose you want apache to use index.html, index.php DirectoryIndex index.html index.php main.php Now whenever you request a directory such as http://localhost/ |
Installing PHPFirst, extract the PHP package ( php-4.3.10-Win32.zip ). I extracted the Next, move the php4ts.dll file from the newly created php directory into
Side Note : Thanks to Shannon Tang for pointing this out |
Modifying Apache ConfigurationApache doesn't know that you just install PHP. We need to tell Apache about LoadModule php4_module php/sapi/php4apache2.dll The first line tells Apache where to load the dll required to execute PHP Now restart Apache for the changes to take effect ( Start <?php phpinfo(); ?> phpinfo() is the infamous PHP function which |
Installing MySQLFirst extract the package ( mysql-4.0.18-win.zip ) to a temporary directory, Open a DOS window and go to C:\mysql\bin and C:\mysql\bin>mysqld-nt --console InnoDB: The first specified data file .\ibdata1 did not exist: InnoDB: a new database to be created! 040807 10:54:09 InnoDB: Setting file .\ibdata1 size to 10 MB InnoDB: Database physically writes the file full: wait... 040807 10:54:11 InnoDB: Log file .\ib_logfile0 did not exist: new to be created InnoDB: Setting log file .\ib_logfile0 size to 5 MB InnoDB: Setting log file .\ib_logfile1 size to 5 MB Now open another DOS window and type C:\mysql\bin\mysql if your installation is successful you will see the MySQL client running C:\mysql\bin>mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 to server version: 4.0.18-nt Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> Type exit on the mysql> prompt to quit the MySQL client. Now let's install MySQL as a Service. The process is simple C:\mysql\bin>mysqladmin -u root shutdown C:\mysql\bin>mysqld-nt --install C:\mysql\bin>net start mysql The MySQL service was started successfully.
Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> |
Modifying PHP Configuration File ( php.ini )PHP stores all kinds of configuration in a file called php.ini.You Some of the configurations are :
register_globalsBefore PHP 4.2.0 the default value for this configuration is On error_reporting and display_errorsSet the value to error_reporting = E_ALL during The reason to use E_ALL during development is so you can catch most of However, after production you should change the value to E_NONE so PHP One important thing to note is that you will also need to set the value extension and extension_pathPHP4 comes with about 51 extensions such as GD library ( for graphics creation The value of extension_path must be set to Don't forget to add that last slash or it won't work After specifying the extension_path you will session.save_pathThis configuration tells PHP where to save the session data. You will need max_execution_timeThe default value for max_execution_time is If you think your script will need extra time to finish the job you can PHP have a convenient function to modify PHP configuration in runtime, |
No comments:
Post a Comment