- Tools used to illustrate php+apache server +dreamweaver+mysql database
- Download install good Wamp, can be directly online Baidu download, in order to facilitate, I put a Baidu cloud link. Wamp Download: Link: http://pan.baidu.com/s/1jH6FbtO Password: Zeo6
Download and install, no big problem, all the way to the return. One step is to choose a browser, default IE, if you want chrome, you can change it
- PHP Environment Setup
An integrated development environment, also known as an IDE environment. Web server +php Interpreter + database are all configured, directly with can, do not need us to configure.
Wamp environment refers to: windows+apache+mysql+php, if the previous computer installed IIS will conflict with Apache
- wamp Directory introduction
Open Wamp installation directory, you can see the following folder
1) www directory: is the default Web site root directory, All sites must be placed under this directory or sub-directory, when we visit it will be like this
/HTTP localhost/ Access to the site's root directory www
HTTP://LOCALH ost/test/test.html This access is the WWW directory below, the test folder below, the test.html file
2) MySQL directory: Under the Wamp installation directory, there is a directory sibling with the WWW folder, This is the folder for our MySQL database.
in the MySQL directory there is also a folder called data, this is the MySQL server above the database directory, Data below each file corresponds to a database, built in a folder is built
A database, we can also do so, A classmate built a database, B students want to take over, at this time we can directly in a classmate's data directory, the folder directly copied over to use
Put it under the corresponding folder of Class B.
- Modify the Wamp configuration file (for example, modify the port number, modify the root of the Web site)
1) Modify the Wamp port number
Double-click to run our Wamp, Click our small semicircle icon:
In the page select Config files--httpd.conf this is the Apache main configuration file
Right click into this file, open later is such a page
The # number on the left is a comment, Not effective, ctrl+f search for Listen, search, search to a Listen80 without the #,
What is the meaning of this sentence, that is, our Apache is now listening to the 80 port, if you want to change it to another port, here to modify the line. Feel free to change, but do not have conflict, after the change, Ctrl+s save, but now still can not use, need us to restart Apache, we can double-click Small semicircle, select, Apache---Restart Service, You can also double-click the small semicircle--restart all Serveice
2) to modify the Apache root directory, do not use the WWW directory, change to another
or click the small semicircle, select Config files--httpd.conf--Search document, this appears: DocumentRoot "D:/wamp/www" the directory to change the line.
Some other configuration, we can own Baidu search: Apache configuration file httpd.conf Description, according to his changes can be. In addition, Php:php_ini Core configuration option description, you can also Baidu
3) A big difficulty in PHP: How to view or modify the PHP configuration file--php.ini php All configuration is here to
- how PHP Works
The user enters the URL in the client browser: http://www.xxx.com/test.php------> Enter, sends the request to the Apache server---->apache receives the request, will look for test.php ( If it does not exist, it will return a 404 error, the resource you requested does not exist; Test.php inside the script, Apache does not know, Apache will send it to the PHP interpreter, the PHP interpreter will be all PHP interpreted as HTML, and then send it to Apache, then Apache will send it to the client browser, the client browser will render the page rendered to User
- Build PHP development environment (no matter how to build, must be placed under the WWW directory, in order to build multiple sites, must be in the WWW directory to create sub-folders)
1) Use Dreamweaver to build a local development environment
Open Dreamweaver, select a site above the page--Create a new site
Site Name: logical site name, feel free to take, both English and Chinese can, we named Localweb. Local site folder: The physical site name, which must be placed under the WWW directory. Find the WWW directory---Create a new folder, create a new Localweb folder, select this folder, as our site's root directory (the logical site name and the physical site name do not have to write the same, the two are written to facilitate our management). :
It is not finished at this time, we need to click on the server-select the lower left corner of the plus sign, fill in our basic server settings.
Server name: Pick up. Connection method: Select local/Network. Server folder: Select the one we just built. Web URL Inside: http//localhost, this path access to the root directory of our site (www folder), if we do not modify the port number, just write it, if we change the port number 80 to 8888, we have to write: http://localhost : 8888, if not modified, do not change.
Attention!!!!!!!!!!!!! http://localhost just to the WWW directory, because we build the site is Localweb, the new site is also the name, so we should write the Web URL
Http://localhost/localWeb,
After clicking Save, note that there is one more step, because we are local testing, so we need to remove the remote check mark, the test to check the checkmark.
How do you know our site is set up?
after the site is set up, in our current site below, create a new test.php, the contents of this write:
<?php
Phpinfo ();//Read PBP configuration file php.ini
?>
Then run it, if the following page appears to be built.
We can look at the HTML structure of the page, we can see that our test.php on a line of code, the result of our HTML there are so many, we can know that our browser is not able to parse PHP, test.php must be parsed by PHP before it can be revealed. The source code and the code after the translation are completely different, and this is done for security.
2) Use Dreamweaver to build our remote site.
: Site name at random, we call him remote site, local site folder is also optional, because we are the remote server above the file download to local, so it doesn't matter.
Then select the Server column, as shown below,
Remember this step is completed, the remote that column needs to check, the test that column also needs to be called. Such a remote site is built. Below we test to change. , the down arrow is to download the contents of the remote site to local, the upper arrow is uploaded to the server.
Next we do a test, under the current site to create a new test.php page, the content is as follows:
<?php
Header ("Content-type:text/html;charset=utf-8");
echo "Haha, a php page";
?>
After writing, use the browser to run, Note!!! This file must be uploaded to the server before it can be previewed and is under the domain name bound to the space.
(3) H-builder build the local development environmentIn the open window, select-File-New--web project, the following page appears
Note: The difference between H-builder and DreamweaverH-builder has a self-brought internal Web server!!! Project name or logical site name, location or physical node nameNOTE!!!!! Attention!!!
In this way, after we've created it, the directory will become like this: Wamp/www/phpstudyhbuilder/phpstudyhbuilder That is, repeating the phpstudyhbuilder (i.e., two) in other words, we have to write this:
This will automatically create a new Phpstudyhbuilder directory under the WWW directory!!!! Finish writing this direct click to complete. Site finished, we and just like Dreamweaver, get a test.php test file, the content is the same. Since H-builder comes with a built-in server, if we use our own open is like this, as
At this point we want to use our own Apache server, we need to do this click the browser Chrome chart---Web server settings----external Web server settings, create a new external server, let this external server specify the address of our Apache server
Select New
And then the stuff inside is so written, just write localhost
After writing to confirm, now or not, need to switch. Turn on our server settings again and change
All set to localhost so you can use our Apache.
Use Apache+dreamweaver (or h-builder) to build a PHP development environment