(1) PHP essay---with old Han Co (24-34)---Apache, PHP Introduction, the environment of the building

Source: Internet
Author: User
Tags php introduction phpmyadmin

The Chinese name of ◇php is the hypertext preprocessor (hypertext preprocessor).

◇php is currently maintained and commercialized by the Zend Company.

◇ide-> integrated development environment.

◇b (browers)/s features

b/S Advantages: 1, low development cost 2, easy to upgrade 3, easy to use users, there is a small failure

b/S disadvantage: 1, security less than 2, the client can not change, subject to browser restrictions

◇ Learning Web Development, you need to install a Web server (run Web server Software on a machine, call this machine a Web server), and then develop the appropriate Web resources in the Web server for users to use browse access.

◇ The purpose of installing the Web server is that the browser needs to fetch the data from the Web server.

◇ commonly used servers such as Apache (cross-platform, free, open source software), Nginx (developed by Russia), IIS,TOMCAT,LIGHTTPD (developed in Germany, characterized by lightness)

◇apache is the default on 80 port monitoring. When the Web server is running, if it is a network service, the specification of the network service must be listening on a port, which is port 80.

◇ About ports:

1, a computer's port number is 1-65535.

2, in the actual development, we often use "Netstat-an" to see which ports on the machine are listening, if you find an abnormal port monitoring, you can close the port. You can also use "netstat-anb" to see what program is listening on what port.

3, a port on a machine, can only be monitored once, can not be monitored by other applications. In the "1-1024 port" do not take possession, the other ports can be self-allocated.

4, Apache can modify the port , or listen to multiple ports .

◇ How to configure Apache:

The Apache software is configured in httpd.conf (the file is equivalent to Apache's brain) file, which is in Conf in the Apache installation directory.

◇ modified Apache Port: in httpd.conf: Listen bayi modified to restart the Apache service if you want to listen to multiple ports, you can write Listen Listen 8 1 Listen Listen 83

◇Apache directory structure, it is modular design :

◇/bin/is used to store Apache commands

◇/cgi-bin/This directory holds common commands under Linux

◇/conf/Storing configuration Files httpd.conf

◇/error/Error logging

◇/htdocs/the folder where our site is stored (by default), if there are multiple endpoint sites, you can sort by folder

◇/icons/Store icon

◇/logs/logs related to Apache services

Modules for ◇/manual/apache

◇MPM: Multi-module Management APR: Portable Runtime Library

◇ forward slash: "/" backslash: "\" two backslash equivalent to a forward slash effect.

◇apache Configuring the virtual directory:

◇1, add a node code to the httpd.conf, adding a virtual directory node: <ifmodule dir_module>...</ifmodule>

◇2, logoff documentroot path: #DocumentRoot ...

◇ How to set up the first page: Add your website to Diretoryindex in the virtual directory node above.

◇ about Apache access Rights Management:

<directory D:/myblog>//Permissions settings for files in this folder

Order Allow,deny//indicate, first allow to reject again

Allow from all//here represents the allowed rules, meaning that all websites are allowed access,

</Directory>

◇ Configuration of Virtual host:

◇ 1, enable httpd-vhost.conf: Enabled in httpd.conf

Virtual hosts, #Virtual hosts

#Include ..... Include ...

◇2, locate the httpd-vhost.conf to configure your own virtual host:

<virtualhost 127.0.0.1:80>

DocumentRoot "D:/myblog"//IP pointing to the file address

DirectoryIndex index.html//First page

<Directory>

...

</Directory>

</VirtualHost>

◇3, modify the Hosts file

In the last line in the \etc\hosts file, you can set the corresponding relationship between the IP address and the domain name

visit the time, now their own server query the URL, if no query to, will go to the external network to query.

◇ the steps to publish a website:

1, first buy a domain name 2, buy a public network server 3, the local written files sent to the server 4, and then on the public network server configuration

The port number of the ◇mysql is 3306,phpmyadmin is a graphical tool for managing the MySQL database (Web version), which can be appserver to set up the WAMP Setup program.

◇apache will only handle static pages by default, and will not interpret PHP files.

◇ Install the Wamp step (install one, test one):

◇1, install Apache, test by visiting http://localhost/, whether it works!

◇2, install PHP, just unzip the compressed files.

◇3, configure PHP:

◇1, in the Apache conf directory, add the following code

#让apache载入php处理模块
LoadModule PHP5 Module C:/myenv/php-5.3.5/php5apche2_2.dll
#用于指定PHP的ini文件, this file is some configuration of PHP
Phpinidir "c:/myenv/php-5.3.5"
#这个配置表示如果有资源是 *.php, then it's handled by PHP.
AddType application/x-httpd-php. php. phtml

◇2, change the php.ini-development file name to PHP.ini

◇3, specifying the extension path extension_dir=~php installation path in php.ini/ext

◇4, restart Apache, test with the phpinfo () function.

◇4, install MySQL, fool installation, and finally change to Utf-8

◇1, enable Mysql,mysqli: Find Extension=php_mysql.dll and Extension=php_mysqli.dll in php.ini to enable it and restart Apache

◇2, use $conn=mysql_connect ("localhost", "root", "root") to test the connection.

◇5, installation phpMyAdmin:

◇1, unzip the package directly into the Htdocs directory

◇2, then direct access to the phpmyadmin/index.php page, user name root, password root

◇ Configure a discuz forum on your own development environment:

◇ Prepare a Discuz source code,

◇1, Discuz extracted out into the htdocs, and then discuz in the upload folder files all copied out to the Discuz folder

◇2, set the user name and password of the administrator in the global file under the Config folder: admin, admin

◇3, and then find founder in Global, the value is changed to admin.

◇4, setting the value of Short_open_tag for php.ini is 0

◇ distinguish different sites by multiple ports of one IP (the first solution is differentiated by port)

◇1, first develop your own website D:/myweb

◇2, configure our httpd.conf file, enable virtual hosts (remove "#")

◇3, configure our httpd-vhost.conf, under/conf/extra/directory, configure a <virtualhost *.*.*.*:80> ... </Virtualhost>

◇4, add the corresponding relationship between IP and domain name in the Hosts file, establish the address and domain name relationship at the bottom of c:/windows/system32/drivers/etc/hosts, such as 192.168.0.1 www.abc.com

◇5, if you need to add a different virtual host, only need to add a <virtualhost *.*.*.*:81> in step 3rd ... </Virtualhost>

◇6, adding 81 listener ports in httpd.conf Listen 81

◇7, and then add the corresponding relationship between the IP and the domain name in the Hosts file 192.168.0.1 www.def.com and so on

◇ by ServerName port to distinguish different domain names, (the second option)

◇1, developing a new site: d:/myblog2

◇2, add configuration in httpd-vhosts.conf file (at this time the configuration differs from the above configuration) in <virtualhost *:80> ServerName www.abc.com </Virtualhost> Then add a <virtualhost *:81> ServerName www.def.com </Virtualhost> other two files (httpd.conf and host file configuration same as above)

(1) PHP essay---with old Han Co (24-34)---Apache, PHP Introduction, the environment of the building

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.