Go to ZendFramework framework programming 2 (software installation and environment configuration)

Source: Internet
Author: User
Software installation and environment configuration 1. after WindowsServer2003WindowsServer2003 is installed, it is best to install all system patches through WindowsUpdate on the Internet, including its latest SP patch package. Although this does not have a fatal impact on learning, however, we recommend that you do this. Because IIS is not installed in Windows2003 by default, you must install iis6through "add and delete programs" after installation. Software installation and environment configuration

1. Windows Server2003
After Windows Server2003 is installed, it is best to install all the system patches through Windows Update, including its latest SP patch package. Although this does not have a fatal impact on learning, however, we recommend that you do this. Because IIS is not installed in Windows 2003 by default, you must install the IIS6.0 component by adding and deleting programs.
Note that you must also enable the "Enable parent path" option of "main directory"-"configuration"-"option" of IIS6.0. Set "all unknown ISAPI extensions" in "Web service extensions" to "allow"-because our test environment will allow php and IIS to be integrated as "ISAPI. The "include files on the server" service extension does not seem to affect script commands such as PHP require.
Once again, because our ZF learning and code debugging are mainly performed in the Apache environment, the above IIS configuration has little to do with our ZF learning, but when we use it as additional knowledge, these configurations are required only when ZF is demonstrated in IIS.

2. install MySQL for Windows
The database is installed on the same machine as Windows2003. Mysql-5.0.41-win32is a setup.exe file. double-click it to make some choices, and then press "next" to complete the installation. Finally, enter the configuration process immediately. For our learning, how to configure mySQL has little impact. We recommend that you select the "myISAM" format for the database. Remember the user root password.
Before configuring nySQL, you must disable the firewall and anti-virus software on the server, such as 360 security guard. otherwise, database creation may fail. If you have any questions, uninstall mySQL and try again.

3. Apache for Windows
I chose the Apache for Windows version of the apache_2.2.8-win32-x86-openssl-0.9.8g.msi. Installation Path: C: PRogram FilesApache Software FoundationApache2.2.

3.1 because the IIS service itself occupies port 80, I chose Apache to use port 8080. In this way, a machine can run two types of Web services for our testing. In a real production environment, Apache is enabled on port 80 by disabling or not installing IIS. To modify the Apache port, open the C: Program FilesApache Software FoundationApache2.2confhttpd. conf file in the text editor and change Listen 80 to Listen 8080.
Note that httpd. conf is the configuration file of Apache and will be modified frequently in the future. After the file is modified, you must restart the Apache service to make the configuration take effect. Pay special attention to this. (If anyone wants to restart the machine, the Apache service will reinitialize it again-but I believe PHP programmers are not so stupid)

3.2 modify the default homepage file of a website
Add index. php to the DirectoryIndex of the following httpd. conf code. Separate multiple homepage files with commas:


DirectoryIndex index.html, index. php

3.3 The Apache2.2 folder contains many folders, including two important folders:
Conf contains the configuration file httpd. conf;
Htdocs is the default place for storing webpage files. The default folder for storing webpage files can be modified using the DocumentRoot statement of httpd. conf, but the default one is used in our test.

3.4 Apache virtual host configuration
To test a large number of applications, we need to create virtual hosts so that applications can run separately on independent websites.
Remove the default website, that is, add a comment symbol before the following configuration statement # (you can also delete this statement ):
# DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"
Then, enter the following statement: NameVirtualHost *: 8080

ServerAdmin webmaster@mydomain.com

DocumentRoot "C: Program FilesApache Software FoundationApache2.2htdocs"

ServerName localhost

ErrorLog "logs/localhost-error.log"

CustomLog "logs/localhost-access.log" common


You can access the local website with http: // localhost: 8080/on the server. for example, if the content of an index. php file is as follows, the basic configuration information of the server can be displayed:
Phpinfo ();
?>
Configure the VM (by domain name phpchina1.com ):

ServerAdmin any@any.com

DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/phpchina1.com"

ServerName phpchina1.com

ErrorLog "logs/phpchina1.com-error. log"

CustomLog "logs/phpchina1.com-access. log" common


Save and restart the service. add a statement to the hosts file on a machine or server on the LAN.
<服务器ip> Phpchina1.com
You can access the website in the form of http://phpchina1.com: 8080.
Note:
PHP documents cannot be accessed until Apache and PHP are correctly integrated.
You cannot perform ZF tests before configuring ZF correctly. In fact, there are several important configuration steps before running the ZF code.

4. PHP installation and configuration
We chose PHP 5.2.5. After obtaining the php-5.2.5-win32.zip file, extract it to the following folder:
C: usrlocalphp-5.2.5.for_Apache2.2php-5.2.5.bin
Your path can be different from here. I have created such a deep path because many PHP versions are installed on my machine.
Configurations required by PHP:
PHP configuration is completed by editing php. ini. For the first time, we copied
C: usrlocalphp-5.2.5.for_Apache2.2php-5.2.5.bin
Under the php. ini-recommended file to generate a php. ini file, and then specify the extension_dir path:
Extension_dir = "C: usrlocalphp-5.2.5.for_Apache2.2php-5.2.5.binext"
Open the comment of the following statement to enable ZF to support mySQL databases:
Extension = php_pdo.dll open pdo
Extension = php_pdo_mysql.dll open pdo_mysql
For PHP to support more extensions, you can remove their annotations. for example, to support the graphic function, you can open
Extension = php_gd2.dll
By the way, for security, register_globals = Off, which is disabled by default. The PHP extension we developed can also be copied to the ext folder and called in the form of extension = myphp_ext.dll.

5. Zend Framework:
Obtain the zendframework-1.5.1.zip package, extract the content of the library folder, and copy the library folder to the following folder:
C: Program FilesApache Software FoundationApache2.2htdocs
The final folder path format is:
C: Program FilesApache Software FoundationApache2.2htdocslibraryZend *.*

6. Integration of PHP with Apache and mySQL
Add the statement at the end of the http. conf file: # integrate mySQL

LoadFile "C: usrlocalphp-5.2.5.for_Apache2.2php-5.2.5.binlibmysql.dll"

# Integrate PHP5

LoadModule php5_module "C: usrlocalphp-5.2.5.for_Apache2.2php-5.2.5.binphp5apache2_2.dll"

AddType application/x-httpd-php. php

AddType application/x-httpd-php-source. phps

# (Specify the location of the php. ini file)

PHPIniDir "C: usrlocalphp-5.2.5.for_Apache2.2php-5.2.5.bin"
If it is PHP6, it is like:
LoadModule php6_module "... Php6apache2_2.dll"
Note that the above LoadModule statement must load the dll file corresponding to the current PHP and Apache versions. Configuration error cannot work.
Note: after saving the http. conf file, you must restart the Apache service to make the configuration take effect.

So far, we should be able to run common non-Zend Framework PHP code on our virtual host. Unfortunately, we still cannot start our Zend Framework journey. Due to the special design of ZF, we also need to make some additional configuration for Apache. This is also the reason why I do not recommend running ZF applications on IIS, because Apache can run ZF applications after several settings, and IIS can only use third-party software. Furthermore, in everyone's mind, IIS and PHP and ZF are not Golden Partners. in the programmer's mind, technology must also be right.

We can see the first ZF example at the end of the next part.

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.