Home  >  Article  >  Backend Development  >  Basic applications of PHP and Apache

Basic applications of PHP and Apache

不言
不言Original
2018-07-28 10:29:242098browse

The content shared with you in this article is about the basic applications of PHP and Apache. The content is very detailed. Friends in need can refer to it. I hope it can help you.

In order to learn more about the interaction between the server and the front-end, use wampserver to build a local Apache MySQL PHP running platform. The following is a brief introduction to the basic use of Apache and PHP.

1. By configuring the virtual host, you can set the root directory separately.

Apache implicit access to index.php

Function 1: Root directory change
Change: DocumentRoot, Directory

Basic applications of PHP and Apache

Function 2: To realize the management of multiple websites, here is the interception of Jingdong
What is a virtual host.
Configuring the root directory
1. Open Virtual hosts in http.conf
2. Add the directory to httpd-vhosts.conf
The directory path here must be the same as the Directory in http.conf level directory. The JD.com webpage of the local server implemented in these two steps was written by myself.

3. Change the local DNS and guide the browser to access the local server written by yourself
Open C:WindowsSystem32driversetchosts
Visit www.jd.com. According to the resolution address written by DNS, go to the local Apache and check the path in DocumentRoot in
httpd.conf. If the httpd.vhost option in httpd.conf is turned on, it will jump to the virtual host, and the ServerName corresponds to jd.com. Then index to the DocumentRoot path here. .

PHP syntax

1. The beginning of $ variable name
2. Ordinary array, associative array (key-value pair format, which is a two-dimensional array)
$persons=array(

         array("username"=>"赵涛","sex"=>"男"),
         array("username"=>"周冠伟","sex"=>"男"),
      );

3. echo output string
print_r output array var_dump()

Original: where dynamic data is needed, php is used (JSP does this)
Disadvantages: front and back The coupling is too deep.

Related recommendations:

Summary of Redis cluster building tutorial

How to install and configure Memcached on CentOS7 system

The above is the detailed content of Basic applications of PHP and Apache. For more information, please follow other related articles on the PHP Chinese website!

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