Building a PHP development environment
The third section of the Experiment a PHP development environment to build
This experiment is common to Windows95 and above versions of Windows operating system machines.
0. Purpose of the experiment
(1) Rapid deployment of Windows under the development environment, to meet the learning, the use of PHP for development and service environment needs.
(2) Deepen the understanding of B/S procedure working principle
1. Preparation of the experiment
(0) Knowledge Preparation: How Web programs work (section I of this chapter)
(1) The PHP server environment requires the following 3 server-side system software
? Web server Software: Apache 1.3.14
? PHP language interpreter software: PHP 4.0.4
? database Server Software: MySQL 3.23.43
(2) Development tool Software:
Notepad: Windows comes with.
UltraEdit10 Simplified Chinese version (compressed package file: Uedit10.zip)
Macromedia Dreamweaver mx Chinese version: Installed
Note: PHP related software, the acquisition of development tools: download on the Web page of my website.
My site: http://www.sunshoulong.cn or Http://211.64.32.2/dsks
(3) Operating system software: Windows on both server and client
Specifically to the Texas College Computer Lab Environment, please do in the Windows Professional environment
(Win98 has been set up, is for later chapters of the study use, no experimental significance)
(4) Path description in the experiment
To illustrate the simplicity of the problem, the path is a relatively simple example path, but has been tested. When actually used, the path can be set according to its own needs completely.
Installation and configuration of 2.PHP
(1) Installation
① Php-4_0_4-win32.rar Decompression to d:\php
② move the Php4ts.dll under D:\php to the C # operating system installation directory \system
③ Copy the php.ini-dist under d:\php to the C # operating system installation directory, renamed to PHP.ini
Note: The operating system installation directory, the exact location of table 3;php.ini is the PHP configuration file.
Table 3: Operating system installation directory
Operating system operating system installation directory
Windows95windows
Windows98windows
Windows mewindows
Windows XPWindows
Windows NT Series Winnt
Windows 2000 Series Winnt
Windows 2003windows
(2) configuration: By modifying the parameters in the php.ini to achieve. For MySQL, there is no need to configure any special requirements. Since PHP is already configured for MySQL in php.ini, it is generally not necessary to modify it.
Installation and configuration of 3.Apache
(1) Install software: Double-click Apache_1_3_14_win32.exe, follow the prompts, install to D:\apache, that is, complete the installation.
(2) Configuration service: Click [Start]->[program]->[Apache Web server]->[management]->[Edit configuration], Open the Apache configuration file httpd.conf, configure it as indicated in table 4, and save it after completion.
Attention:
The so-called "modify", that is, the parameters already exist in the file, modify its parameter value, the so-called "add", the missing parameters and parameter values in the file to the corresponding location in the file, in order to save trouble, it can also be placed in the last of the file
? For each configuration to work, you must remove the # sign (the comment symbol) at the beginning of the line
The description is in the line order of the httpd.conf file.
Table 4, the path, address, hostname, mailbox, etc., in the actual configuration, please according to their own circumstances
? Make sure to save after each configuration change and start or restart the Apache service, the latest configuration will only work
Table 4 Apache configuration parameter settings
Example path: PHP installation path ――d:/php; publish document (i.e. file) home directory ――d:/www
Ordinal parameter name and parameter value operation function
①bindaddress server machine IP or localhost (127.0.0.1) modification for address binding (Specify server address)
②loadmodule php4_module D:/php/sapi/php4apache.dll Adds a PHP language interpreter that indicates that PHP is configured as an Apache module (Apache module)
③port 80 Modify the specified Apache communication port to provide Web services externally
④serveradmin server administrator mailbox (such as abc@abc.com) modify the administrator's mailbox that is sent back to the client browser when an error occurs
⑤servername server's computer name modification indicates the host name
⑥documentroot "D:/www" modifies the publishing document home directory that provides a Web service to the client
⑦ Modify the publishing document home directory definition, where the value of the directory should be consistent with the ⑥
⑧scriptalias/php/"d:/php/"
AddType application/x-httpd-php. php
Action application/x-httpd-php "/php/php.exe" adds a path that indicates the PHP script language name and the PHP scripting language interpreter
Indicates the php script extension
Indicates the PHP script interpreter (PHP works as a non-module)
⑨directoryindex index.php Modify the specified default document (home page document, only the document that responds with the server address is requested)
Description
①: localhost refers to the server machine native. If the machine does not have a network cable, select localhost, or you may be prompted to say that the address could not be found.
⑦ above description: This should is changed to whatever you set DocumentRoot to
A sample of the Apache configuration file is available on the teaching website for reference.
(3) Installation and launch of Web services
? Install Apache Service
Register Apache in the Windows operating system service. Click: Start program? Apache Web Server? Apache as a service? Install service. The service only needs to be registered once.
? launch Apache Service
Click: Start program? Apache Web Server? Apache as a service? Start service, starting services. You can also stop and restart the service.
Description
In Windows2000 Professional or Windows XP, you can also get started by using the Control Panel? Management tools? Services, starting, stopping and restarting Apache services as needed.
4. Test Apache support for PHP
(1) Test objectives: Check whether they work together properly
(2) test method
① write a test script in Notepad or uedit, saved as d:\www\index.php, with the following:
Echo Phpinfo ();
?>
Note: index.php is configured as the default document for Apache
Phpinfo () is a PHP built-in function for displaying PHP and Apache configuration information.
② in the browser type/HTTP//Your machine's IP address or localhost (127.0.0.1), after the return to display similar to Figure 9 of the PHP configuration page (under the example of Win98), your configuration to achieve the above test target, Apache and PHP can work together If you do not see a similar screen, the configuration is incorrect, and your Apache will not be able to recognize the PHP script, you need to change the configuration.
Figure 9 Apache Configuration succeeded (php in Figure 4.3.4 for example)
5.MySQL Software Installation and service start-up
(1) Installation
After extracting the Mysql-3.23.43-win.zip, double-click Setup.exe and follow the prompts to install.
Depending on the specified installation path, the installation can take the following ways:
① default installation: The installation path is not specified during the installation process, using the silent c:\mysql. Install it this way and press the "next" button to complete it.
② Custom Installation: Specify your own installation path (for example: D:/mysql) during installation, rather than using the default c:\mysql. After the installation is completed, a configuration file is required to make a special statement to the operating system of MySQL information. To do this: Create a file with Notepad or Uedit My.ini save it in your operating system installation directory, the file content is as follows
[Mysqld]
basedir=d:/mysql/
datadir=d:/mysql/data/
Note: This experiment uses the custom installation method
(2) Start the service program
Double-click d:\mysql\ Winmysqladmin.exe under the bin (MySQL service program), which will register and start the MySQL service program in the background service of the operating system (by default, the service is started automatically each time the operating system starts, you can change its startup mode in the Windows2000 service)
(3) MySQL database connection test: Through the MySQL client program Mysql.exe, test its connection with the service program is normal, the service program is able to work properly.
Start the client program Mysql.exe: Under command prompt or MS-DOS, enter D:\mysql\bin, type the command MySQL enter.
If you see a result similar to the following:
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is server version:3.23.43
Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the buffer.
Mysql>
Indicates that the test was successful.
Type exit Enter to exit the connection to the MySQL server
At this point, we have successfully completed the PHP script interpreter software, Web server software Apache, database server software MySQL deployment. For operating system software and development tools software, the reader can complete the deployment itself.
This is the end of the experiment.
Preach Wisdom Podcast PHP training, providing relevant PHP tutorials
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.