How to install PHP, MySQL and Apache in Windows?

For new programmer, I hope this guide can quite help your work.
A. Download
Download PHP (non-msi installer!!), MySQL (msi installer), MySQL Tools, Apache (msi installer), Phpmyadmin and FileZilla Server
B. APACHE
- Create sub directory and install Apache in sub-directory like "C:/Web" (Type localhost as server name, then test using http://localhost in web browser).
If you're not sure, go to My Computer, choose Manage, click > Services and Applications > Services to see whether the server work. - Modify "C:\Web\conf\httpd.conf":
DocumentRoot 'C:/Web/htdocs'
DirectoryIndex index.php index.html - Add these code at end of the file:
- #Enable PHP processing
LoadModule php5_module "c:/Web/php/php5apache2_2.dll"
#.php files should be processed as PHP
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
AddHandler application/x-httpd-php .php
#Where to find php.ini
PHPiniDir "C:/Web/php" - Open it up and find the line that says: extension_dir = "./"
and change it to extension_dir = "C:\Web\php\ext"
Find the line that says: ;session.save_path = "/tmp"
and change it to session.save_path = "C:\WINDOWS\temp" - Restart Apache server to take effect.
C. PHP
- Unzip PHP in directory "C:/Web".
- Right click on "My Computer", then choose "Property". Click on the "Environment Variables" then click "Path" and "Edit". Go to the end of that line and add ";C:\Web\php;", then click OK. Restart your computer so that this change will take effect.
- Modify "C:\Web\php\php.ini":
extension_dir = "C:/Web/php/ext"
Uncomment, extension=php_curl.dll
Uncomment, extension=php_mcrypt.dll
Uncomment, extension=php_mysql.dll
Uncomment, extension=php_mysqli.dll - Restart your Apache server.
- Create phpinfo.php file contain:
<?php
phpinfo();
?> - Upload phpinfo.php to "C:/Web/htdocs".
D. MySQL
- Install MySQL server and MySQL Tools by default.
- Download Phpmyadmin and unzip to "C:/Web/htdocs".
- Modify "config.inc.php":
$cfg['blowfish_secret'] = '1234567890'; // change to random string of your choice - Create at least one user in MySQL Tools for 5.0/MySQL Administrator.
- If you're not sure, go to My Computer, choose Manage, click > Services and Applications > Services to see whether the MySQL server work.
E. FTP server
- Download FileZilla Server and install by default.
- Create at least one user, by click Edit > Users. Enable the account, password and tweak other settings.
F. Install Ioncube and Zend Optimizer
G. Install PEAR
Download PEAR Package, extract and replace PEAR folder in PHP package with your PEAR package.
H. Done
That's it! go to "http://localhost/phpinfo.php" to test your server.
***Other Useful Tips
Modify php.ini ini your server to get best performance:
max_execution_time = 600 ; Maximum execution time of each script, in seconds
max_input_time = 300 ; Maximum amount of time each script may spend parsing request data
memory_limit = 128M ; Maximum amount of memory a script may consume (32MB)
error_reporting = E_WARNING & ~E_NOTICE
log_errors = Off
upload_max_filesize = 100M
| < Prev |
|---|