Zend studio+phpnow+zend Debugger Build PHP server debugging environment Steps _php Tutorial

Source: Internet
Author: User
Tags php server php development environment
This is mainly to do ASP. NET development, but sometimes also come into contact with PHP, and I think PHP has a lot of source code worth learning, we are not learning PHP code, but to learn the idea of the implementation of the source, or to avoid strong call as an algorithm.

As a non-professional PHP developer, want to more easily read and understand a PHP function module running details, build a PHP debugging environment, and then single-step debugging program, in order to master the program throughout the process is particularly important.

First, prepare the installation files

1, PHPnow-1.5.6. "Phpnow is Win32 under the green free Apache + PHP + MySQL Environment Kit package. Easy to install, fast build PHP environment. ”

2, ZendDebugger-5.2.14. Zend's PHP debugging tool or plugin. Http://downloads.zend.com/pdt/server-debugger/ZendDebugger-5.2.14-cygwin_nt-i386.zip

3, zendstudioenterpriseedition-v5.5.0. It is said that PHP industry's most famous IDE, do not know the Eclipse plugin-based PHP development environment, there is time to play a bit more.

Second, the configuration program

1, install Phpnow. Unzip the installation package Phpnow-1.5.3.zip to a place, like I unzip to "D:\soft\PHP", and then double-click the PHP folder "Setup.cmd" to start the installation, the middle of the installation to MySQL will prompt you to enter the database user name and password , local testing is usually set to "root". After the installation is completed, enter the following address in the browser HTTP://127.0.0.1/, if successful, you will see the following screen:

Note: If your system has IIS installed before, and IIS is running, to stop IIS first, or port 80 will conflict, although the "pncp.cmd" tool can modify the Apache port, but it is not recommended to change this.

2, install Zenddebugger. unzip the Zenddebugger-5.2.14-cygwin_nt-i386.zip to the Phpnow installation directory, which is "D:\soft\PHP" and then Zenddebugger-5.2.14rc9-cygwin_ Nt-i386 folder name changed to Zenddebugger such a short file name, into the Zenddebugger directory, we can see the following file structure:

Now to rename the X_x_x_comp folder in the folder to php-x.x.x, such as "5_2_x_comp" renamed to "php-5.2.x", because my test environment is php5.2, so I can only change "5_2_x_comp" this folder. The change here is to wait for a moment to configure it in php.ini.

Now go to the PHP installation directory to modify the PHP configuration file, this file is usually named "PHP.ini", so that the server can properly load our module. But this Phpnow environment PHP configuration file is not called "php.ini", but "Php-apache2handler.ini", how can we know the current Web server using the PHP configuration file name. Here is a way: in the "D:\soft\PHP\htdocs" directory, create a phpinfo.php file, and enter the content " ", and then open the browser can see the following information, the anti-white display path is the current PHP configuration file is located in the path:

Note: The PHP configuration file referred to here is the PHP configuration file that the website relies on, not the php.ini file under the Zend Studio directory mentioned below (Zend Studio also comes with several different versions of PHP), such as:

Modify the "D:\soft\PHP\php-5.2.9-2-Win32\php-apache2handler.ini" file. Open the file with Notepad, move the sidebar scroll bar to the bottom, and at the end of the document you can find the following configuration nodes:

Append at its tail:

Zend_extension_manager.debug_server_ts= "D:\soft\PHP\ZendDebugger"
Zend_debugger.allow_hosts=127.0.0.1/32,192.168.0.8/24
Zend_debugger.expose_remotely=always

It should end up like this:

Explain:

(1); zend_extension_ts= "D:\soft\PHP\ZendDebugger\5_2_x_comp\ZendDebugger.dll" This is my comment, because this setting zend_extension_ts repeat, There is no coexistence with Zendoptimizer.

(2), zend_extension_manager.debug_server_ts= "D:\soft\PHP\ZendDebugger", here refers to the directory on the line, PHP will automatically according to their own version to find the following php_x_x_ X such folder under the DLL file, which is why we have to rename the Zenddebugger under the list of reasons.

(3), zend_debugger.allow_hosts=127.0.0.1/32,192.168.0.8/24, here behind the 192.168.0.8 to your own IP on the line, you can look like the following to see their IP address:

The following "32", "24" Do not change, they are not the directory name, but the subnet mask type code, "32" for "255.255.255.255", "24" for "255.255.255.0".

Open in Browser: http://127.0.0.1/phpinfo.php, if you can see the following information indicates the installation is successful, pay attention to the last line "with Zend Debugger v5.2.14, Copyright (c) 1999-2008, by Zend Technologies ". Back to HTTP://127.0.0.1/we found Zend Optimizer support in the Component support box or "yes", which means that we zend Debugger and Zend Optimizer are co-operating (there are many tutorials on the web that do not coexist, That's not perfect).

3, install Zend Studio. Unzip the Zendstudioenterpriseedition-v5.5.0.270.rar, execute the extracted files after the Win_setup.exe file, the default way next down, so that the Zend Studio successfully installed on the C drive. Run it and then close it, because the default is English, we go to Chinese. In the C drive (that is, the Zend Studio installation disk), search for the file "Desktop_options.xml", such as.

After finding it, open it with Notepad and find:


 

Change the above en to zh and save it, then mark the file as "read-only" (Zend studio automatically restarts at certain times to change the default setting to "read-only" it is powerless). In addition, like the following coding options can also be modified according to the actual situation:


 

For example , you can change this option when you use Zend Studio to open code files to find Chinese garbled characters.

Three, start debugging

From the Start menu, find "Zend development environment (Zend Studio)" and run it. Create a new project, and in this project introduced a development good source package, I here the source package in "D:\soft\PHP\htdocs\cms", this CMS is the SupeSite7.0 program, in the new project debugging options set Imaging, where the debug Server The URL can also be an address such as 127.0.0.1, as long as several settings are synchronized:

 

In addition, the Debug tab of the Tools menu preferences is also set to:

Now check:

If successful, a successful connection with Debug server is displayed. dialog box.

Open the SupeSite7.0 source project, select Zend Studio built-in browser, and in the Address bar input: http://127.0.0.1/cms/batch.search.php, here I show SupeSite7.0 search page code debugging. Now you press the "Scale Bug" button on the left side of the browser (you can choose a different debug range from the inverted triangle), directly into the batch.search.php page debug (if the batch.search.php page is not in the editing state, that is not open, direct debugging will automatically open, and if you use the F11 statement by execution, the current debug page contains the external code file will also be opened.

After pressing the Debug button, go directly to the source code, the cursor is positioned in the first statement (here I did not set breakpoints and debug the program in F5 mode), as follows:

Now let's test it. Click a button to submit the form value and capture it. Like that, click the "Search" button and look at the keyword "What's CMS?" Is how it is handled. The order of your operation must look like this: open http://127.0.0.1/cms/batch.search.php-> input keyword "What is CMS?" , click the "Search" button, click the "Scale Bug" button on the browser toolbar.

After commissioning we can see "What is CMS?" What variables are stored and processed. Such as:

At this point, the entire Zend studio+phpnow+zend Debugger server debugging environment has been built and demonstrated the use of the method.

http://www.bkjia.com/PHPjc/714946.html www.bkjia.com true http://www.bkjia.com/PHPjc/714946.html techarticle This is mainly to do ASP. NET development, but sometimes also come into contact with PHP, and I think PHP has a lot of source code worth learning, we are not learning PHP code, but learning the implementation of the source ...

  • Related Article

    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.