php:php-apache-on-windows
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
php:php-apache-on-windows [2016/05/16 06:46] – [step by step install] admin | php:php-apache-on-windows [2022/10/29 16:15] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 10: | Line 10: | ||
* vs2013 | * vs2013 | ||
* vs2015 | * vs2015 | ||
- | ==== Step by step install ==== | + | ==== Basic Steps to install ==== |
- | - Step1: Install PHP package for **thread safe** (thread safe version **contain apache2 module**) with extra options | + | (PHP 5.6 and Apache 2.4 compiled with VC11) |
- | - Step2:Install Apache version base on **apache2 module** which contain in PHP package from http:// | + | - Install Visual C++ Redistributable for Visual Studio 2012(VC11) http:// |
+ | - Install PHP package for **thread safe** (thread safe version **contain apache2 module**) with extra options | ||
+ | - Install Apache version base on **apache2 module** which contain in PHP package from http:// | ||
apache_2.2.14-win32-x86-no_ssl.msi | apache_2.2.14-win32-x86-no_ssl.msi | ||
Network Domain: home-vn.com.vn | Network Domain: home-vn.com.vn | ||
</ | </ | ||
- | - Step3: test apache by go to link http:// | + | - Test apache by go to link http:// |
=> It works! | => It works! | ||
</ | </ | ||
- | - Step4: | + | - Change configure of httpd.conf for calling PHP as module< |
AddType application/ | AddType application/ | ||
DirectoryIndex index.php index.htm index.html | DirectoryIndex index.php index.htm index.html | ||
Line 25: | Line 27: | ||
LoadModule php5_module " | LoadModule php5_module " | ||
</ | </ | ||
- | - step5: | + | - Change config of php.ini for loading modules which connecting to MySQL server(**must change extension_dir**):< |
extension_dir = " | extension_dir = " | ||
[PHP_MYSQLI] | [PHP_MYSQLI] | ||
Line 32: | Line 34: | ||
extension=php_pdo_mysql.dll | extension=php_pdo_mysql.dll | ||
</ | </ | ||
- | - Step6: create | + | - Create |
<?php | <?php | ||
phpinfo(); | phpinfo(); | ||
?> | ?> | ||
</ | </ | ||
- | - Step7: | + | - Modify httpd.conf to enable mod rewrite:< |
LoadModule rewrite_module modules/ | LoadModule rewrite_module modules/ | ||
</ | </ | ||
+ | ==== Install Apache from binary directory ==== | ||
+ | - Step1: Download Apache binary from http:// | ||
+ | - Step2: Extract download file to drive C on windows. For example: | ||
+ | - Step3: Change **ServerRoot** config in **httpd.conf** If you extract Apache binary to another directory:< | ||
+ | ServerRoot " | ||
+ | </ | ||
+ | - Step4: Install httpd as an service:< | ||
+ | httpd.exe -k install | ||
+ | </ | ||
+ | httpd.exe -k uninstall | ||
+ | </ | ||
+ | - Step5: Run to test httpd:< | ||
+ | httpd.exe | ||
+ | </ | ||
+ | ==== Config virtual host on Apache ==== | ||
+ | - Step1: Edit httpd.conf to add new config file for virtual host:< | ||
+ | # Virtual hosts | ||
+ | Include conf/ | ||
+ | Include conf/ | ||
+ | </ | ||
+ | - Step2: create file **conf/ | ||
+ | < | ||
+ | DocumentRoot " | ||
+ | ServerName dacsan.babies.vn | ||
+ | DirectoryIndex index.php index.html index.htm | ||
+ | < | ||
+ | Options Indexes FollowSymLinks MultiViews | ||
+ | AllowOverride all | ||
+ | Order Deny,Allow | ||
+ | Allow from all | ||
+ | </ | ||
+ | SetEnv APPLICATION_ENV development | ||
+ | ErrorLog " | ||
+ | CustomLog " | ||
+ | </ | ||
+ | < | ||
+ | DocumentRoot " | ||
+ | ServerName baotam.vn | ||
+ | DirectoryIndex index.php index.html index.htm | ||
+ | < | ||
+ | Options Indexes FollowSymLinks MultiViews | ||
+ | AllowOverride all | ||
+ | Order Deny,Allow | ||
+ | Allow from all | ||
+ | </ | ||
+ | SetEnv APPLICATION_ENV development | ||
+ | ErrorLog " | ||
+ | CustomLog " | ||
+ | </ | ||
+ | </ | ||
+ | ==== Some errors and fix ==== | ||
+ | - Error 1:< | ||
+ | </ | ||
+ | * 2.2 configuration:< | ||
+ | Order allow,deny | ||
+ | Allow from all | ||
+ | </ | ||
+ | * 2.4 configuration:< | ||
+ | Require all granted | ||
+ | </ | ||
+ | - Error2: | ||
===== Install XAMPP ===== | ===== Install XAMPP ===== | ||
refer: https:// | refer: https:// |
php/php-apache-on-windows.1463381215.txt.gz · Last modified: 2022/10/29 16:15 (external edit)