Preparation of PHP development environment

Source: Internet
Author: User
PHP development environment construction section 3 Experiment 1 PHP development environment construction this experiment is common to Windows 95 and later versions of Windows operating system machines. 0. tutorial purpose (1) to quickly deploy the development environment in Windows to meet the development and service environment requirements for learning and using PHP. (2) deepen understanding of BS program working principles 1. Experiment Preparation (0) knowledge preparation: Web program working principles (section 1 in this chapter) (1) PHP development environment construction
Section 3 Experiment 1 setting up a PHP development environment
This tutorial is applicable to Windows 95 and later versions.
0. tutorial purpose
(1) ability to quickly deploy the development environment in Windows to meet the development and service environment needs of learning and using PHP.
(2) deepen understanding of the working principles of B/S programs
1. Test preparation
(0) knowledge preparation: How Web programs work (section 1 of this chapter)
(1) the PHP Server environment requires the following three server-side system software:
? Web server software: Apache 1.3.14
? PHP interpreter software: PHP 4.0.4
? Database server software: MySQL 3.23.43
(2) development tools and software:
Notepad: comes with Windows.
UltraEdit10 simplified Chinese version (compressed package File: uedit10.zip)
Macromedia Dreamweaver MX Chinese version: Installed
Note: PHP-related software and development tools are available for download on the relevant webpage on my website.
My website: http://www.sunshoulong.cn or http: // 211.64.32.2/dsks
(3) operating system software: both the server and client are Windows
For details about the computer room environment of the computer department of Dezhou University, please do it in Windows 2000 Professional environment
(It has been set up in Win98 and is intended for later chapters, with no lab significance)
(4) path description in the experiment
For the sake of simplicity, the path is a simple example path, but it has been tested. In actual use, you can set the path as needed.
2. install and configure PHP
(1) installation
Unzip php-4_0_4-win32.rar to d: \ php
② Move 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 and rename it php. ini.
Note: the operating system installation directory is shown in Table 3. php. ini is the configuration file of PHP.
Table 3: operating system installation directory
Operating system installation directory
Windows95windows
Windows98windows
Windows mewindows
Windows XP Windows
Windows NT series winnt
Windows 2000 series winnt
Windows 2003 windows
(2) configuration: modify the parameters in php. ini. For MySQL, configuration is not required unless otherwise specified. Because PHP has configured MySQL in php. ini, you do not need to modify it.
3. install and configure Apache
(1) install the software: Double-click apache_1_3_14_win32.exe and install it under d: \ apache as prompted.
(2) configure the service: click [start]-> [program]-> [Apache Web Server]-> [Management]-> [Edit configuration], open the Apache configuration file httpd. conf, configure according to Table 4 prompts. Save the configuration after completion.
Note:
? The so-called "modify" means to modify the parameter value of an existing parameter in the file; the so-called "add ", add the missing parameters and parameter values in the file to the corresponding location in the file. to save trouble, you can also put them at the end of the file.
? To make the configuration at each place take effect, you must remove the # sign (comment symbol) at the beginning of the line.
? The description is in the order of the httpd. conf file.
? Table 4 contains the path, address, host name, and mailbox. perform the following operations based on your actual configuration.
? You must save the configuration changes and start or restart the Apache service. The latest configuration takes effect.
Table 4 Apache configuration parameter settings
Example path: PHP Installation Path-d:/php; publishing document (that is, File) main directory-d:/www
Operation of parameter name and parameter value
① BindAddress: bind the IP address of the server or localhost (127.0.0.1) to the address (specify the server address)
② LoadModule php4_module d:/php/sapi/php4apache. dll add the PHP interpreter used to specify the module (Apache module) in which PHP is configured as Apache.
③ Port 80: modify the communication Port for Apache to provide Web services externally
④ ServerAdmin server administrator mailbox (such as abc@abc.com) modify when an error occurs back to the client browser administrator mailbox
⑤ Modify the computer name of the ServerName server specifying the host name
⑥ DocumentRoot "d:/www" indicates the main directory of the publishing document that provides Web services to the client.
7. Modify the definition of the release document's main directory. The Directory value must be consistent with that in section 6.
Using ScriptAlias/php/"d:/php /"
AddType application/x-httpd-php. php
Add Action application/x-httpd-php "/php/php.exe" to specify the PHP script language name and PHP script language interpreter path
Specify the PHP script extension
Specifies the PHP script interpreter (which works when PHP is not working in a module)
Modify ⑨ DirectoryIndex index. php to specify the default document (homepage document, which only responds to requests from the server address)
Note:
①: Localhost refers to the local machine of the server. If no network cable is inserted on the machine, select localhost. Otherwise, the system may prompt that the address cannot be found.
Note: This shoshould be changed to whatever you set DocumentRoot
The teaching website contains samples of Apache configuration files for reference.
(3) Web service installation and startup
? Install the 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.
? Start Apache service
Click Start? Program? Apache Web Server? Apache as a service? Start Service. You can also stop and restart the service.
Note:
In Windows Professional or Windows XP, can I start? Control panel? Administrative tools? To start, stop, and restart the Apache service as needed.
4. test Apache's support for PHP.
(1) purpose: to test whether the two can work normally.
(2) test method
① Write a test script in Notepad or uedit and save it as d: \ www \ index. php. the content is:
Echo phpinfo ();
?>
Note: index. php is configured as the default Apache document.
Phpinfo () is a PHP built-in function used to display PHP and Apache configuration information.
② Input http: // your machine's IP address or localhost (127.0.0.1) in the browser, and press enter to display the PHP configuration page similar to Figure 9 (take Win98 as an example ), it indicates that your configuration has reached the above test goal, and Apache and PHP can work normally. If no similar picture is displayed, the configuration is incorrect. in this case, your Apache cannot recognize the PHP script, you need to change the configuration.

Figure 9 Apache configuration successful (PHP 4.3.4 is used as an example in the figure)

5. install MySQL software and start services
(1) installation
After unzipping mysql-3.23.43-win.zip, double-click setup.exe and install it as prompted.
Depending on the specified installation path, the installation methods are as follows:
① Default installation: The installation path is not specified during the installation process, and the default c: \ mysql is used. In this way, click "next" to complete the installation.
② Custom installation: during the installation process, specify your own installation path (for example, d:/mysql), instead of using the Mo c: \ mysql. After the installation is completed in this way, you need to create a configuration file to specifically declare MySQL information to the operating system. The specific method is: Use Notepad or uedit to create a file my. ini and save it in the installation directory of your operating system. the content of this file is as follows:
[Mysqld]
Basedir = d:/mysql/
Datadir = d:/mysql/data/
Note: This experiment adopts the custom installation method.
(2) start the service program
Double-click winmysqladmin.exe (mysql service program) under d: \ MySQL \ bin. this will register and start the MySQL service program in the background service of the operating system (by default, the service is automatically started every time the operating system starts. you can change the startup mode of the Windows2000 service)
(3) MySQL database connection test: use mysqlclient program mysql.exe to test whether the connection to the Service Program is normal and whether the service program works properly.
Start the client program mysql.exe: at a command prompt or MS-DOS, enter d: \ mysql \ bin, type the command mysql press Enter.
If the following result is displayed:
Welcome to the MySQL monitor. Commands end with; or \ g.
Your MySQL connection id is 26 to server version: 3.23.43
Type 'help; 'or' \ H' for help. Type '\ C' to clear the buffer.
Mysql>
The test is successful.
Type exit and press enter to exit the connection with the MySQL server.

So far, we have successfully completed the deployment of PHP script interpreter software, Web server software Apache, and database server software MySQL. You can deploy the operating system software and development tool software on your own.

This experiment ends now.
Php Training for Chuanzhi podcasts and relevant php tutorials

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.