Home>Article>Backend Development> Integration of php and apache, configuration of virtual directories, and configuration of virtual hosts

Integration of php and apache, configuration of virtual directories, and configuration of virtual hosts

Christopher Nolan
Christopher Nolan Original
2016-08-08 09:25:50 1357browse
Integration of php and apache:

1. Add

LoadModule php5_module "D:/appserv/php/php5apache2_2.dll"

PHPIniDir "D: /appserv/php"

AddType application/x-httpd-php .php .phtml

2. Change the php.in-development file to php.ini

3. In php.ini You can specify the corresponding function module

Here we specify the extension library path of php

extension_dir = ".../php-5.3.5/ext"


Configure the virtual directory:


#direcotory is equivalent to the welcome page
DirectoryIndex index.html index.htm index.php
#Your site alias
Alias /myblog "D:/myblog"

#This is the access permission setting
Order allow,deny
Allow from all


Log out documentroot path #DocumentRoot


The steps to configure a virtual host are as follows :

1. Enable httpd-vhosts.conf

in the httpd.conf file

# Virtual hosts Virtual hosts

Include conf/extra/httpd-vhosts.conf

2. Make configuration in the httpd-vhosts.conf file


#Configure our own virtual host

DocumentRoot "d:/myblog"
#Configure the welcome home page here
DirectoryIndex index.html index.htm index.php

Options FollowSymLinks
#Do not allow others to modify our page
AllowOverride None
#Set access permissions
Order allow,deny
Allow from all

Relevant configuration in php.ini:

Enable support for Mysql

extension="php_mysql.dll"

extension="php_mysqli.dll"

Open the support gallery

extension=php_gd2.dll

Set the default time zone

date.timezone = Asia/Shanghai

Use socket

extension=php_sockets.dll

Use php extension function

extension=php_exif.dll

Use tag

short_open_tag = Off/On

Do not prompt Notic information

error_reporting = E_ALL & ~E_NOTICE

The above has introduced the integration of PHP and Apache, configuring virtual directories, and configuring virtual hosts, including all aspects. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn