Configuration of ZendStudio6.1.2 in Fedora

Source: Internet
Author: User
Tags php server php debugger
ZendStudio is a very powerful tool of PHPer. with ZendStudio, we often get twice the result of our work. today we will record the useful configurations in daily use, to help more PHPer improve work efficiency. 1. configure the service

Zend Studio is a very powerful tool of PHPer. with Zend Studio, we often make our work easier. today we will record the useful configurations in daily use, to help more PHPer improve work efficiency.

1. configure the server.

If we want to perform debugging quickly, it is essential to integrate the Server and Zend together. There are many entry points for configuring the Server. for example, you can go to Preferences/PHP Server, or you can find the Configuration of Run Configuration/Server in the drop-down list of the Run button.

When creating a new Server, we need to specify the address accessed by the Server. if we have configured the Server locally, we can go to (/etc/httpd/conf. d/vhost) to set the domain name of the local project. of course, do not forget to set HOSTS (in/etc/hosts ).

After the configuration is complete, if you need to debug the page, you only need to click the "Run" icon. the first time an address dialog box will pop up, waiting for confirmation, after that, you can directly view the code running result in Zend Studio. this is very practical for pages that are important to logic, because we do not have to switch to the browser as usual, click F5 to refresh and view the result.

2. create a PHP project.

I found that under Fedora, if you create a general project, PHP functions do not have automatic code prompts. after a long time of searching, I did not find any place to set it. However, if we create a Project as a PHP Project, we can enjoy the pleasure of code prompts.

One of the more important advantages of creating a PHP Project is that when our Project is getting bigger and bigger, we can easily jump between classes and functions, only two buttons are required: "Ctrl + Left Click ".

3. DEBUG.

Because it is an interpreted execution language, PHP debugging has never been very convenient, but we can improve this situation through Zend Studio Debug. The Debug settings Window can be found in Window/Preferences/PHP/Debug.

Some default configurations:

PHP Debugger: Zend Debugger is used by default. it can be used only after Zend Debugger is installed. Zend Studio 6.1.2 is Installed by default. you can view it through Window/Preference/PHP/Debug/Installed Debuggers.

A dummy. php file is required during Zend Debugger configuration. the file is used to create a SESSION for debugging scripts on the specified server. it is best not to modify the file name by default.

PHP Server: Select the Server we created earlier.

PHP Executable: select the appropriate PHP version. to add a new project, you can find it in Window/Preference/PHP Executable.

There are also two character encoding configurations for input and output. this is done by default. you can debug the code below.

Debugging of Zend Studio allows us to set breakpoints, step-by-step execution, detection variables, and parameters. The following describes several different debugging methods.

3.1 Local Debugging of PHP code (PHP Script Local Debugging ).

It allows us to debug through the Debugger built in Zend Studio. generally, we can use this item to check whether there is a problem in the program before deploying it to the server. Local Debugging requires that the code be stored in the working directory, and local debugging is back to the default PHP Executable environment that comes with Zend Studio.

The debugging process is generally:

3.1.1 set breakpoints in our code.

3.1.2 save the file.

3.1.3 click the arrow next to Debug to configure Debug, or select Debug As in the mail... /Debug Configurations.

3.1.4 if no breakpoint is set, you can select Break at first line in the configuration for debugging.

3.1.5 if necessary, we can also add variables in the debugging code, and then the running will jump to the debugging view. In the debugging attempt, we can control program execution by clicking "Resume" and "Step Into", and observe variable changes in the variable window.

3.2 Remote Debugging of PHP code (PHP Script Remote Debugging ).

This option allows us to use the Zend Debugger installed on the server to debug files in the working directory. To use this function, we must install Zend Debugger on the server.

The debugging process is basically the same as that of 3.1. now, I want to describe how to install Zend Debugger on the server.

To configure Remote Debugging, you must first ensure that Zend Debugger is installed on your server. you can download it from the address http://www.zend.com/en/products/studio/downloads.

Select the appropriate release package based on your system environment. here I select a ZendDebugger-5.2.14-linux-glibc23-i386, decompress a few directories and a dummy. php file and some other instructions. Select a suitable folder based on your current PHP version (you can use php-v for viewing if you do not know it, which requires you to put the PHP command into the environment variable) and find ZendDebugger. so path, and then add it to php. in ini, the format is zend_extension =/usr/lib/php/modules/ZendDebugger. so.

Add the following two lines of code at the same time:

Zend_debugger.allow_hosts = ip_addresses

Zend_debugger.expose_remotely = always

Copy dummy. php to the working directory, and then restart the server. At this time, if we use phpinfo () to view the server situation, we can see Zend Debugger.

3.3 debug the PHP webpage.

This option allows us to debug code on the server so that we can fully test the code running status.

3.4 URL Debugging.

It is used to debug code on the remote server and input a url for debugging. Therefore, the file does not need to exist locally.

3.5 Toolbar Debugging (Toolbar Debugging ).

This item should be a relatively new product. after Zend Studio is installed, you will be prompted whether to install Firefox Toolbar. some debugging methods provided by Zend can be conveniently called in the browser.

4. code prompt (code prompt ).

Code prompts help us find variables, call functions, find object members, reference files, etc., can greatly improve the development speed, when used in Win, the code prompts are opened by default. In Feodra, based on my experience, the code prompts need to be performed in the PHP project. In Zend Studio 7.0, you need Ctrl + Space to call up the code prompt.

5. performance analysis (Profile ).

Through performance analysis, we can find the bottleneck in the code to improve the code execution efficiency. Profile provides us with similar statistics and analysis. I think if you have used the Profile feature of Firebug, you should be familiar with Zend Studio.

Of course, there are also various ways to improve efficiency in Zend Stduio, such as the setting of shortcut keys, which I cannot summarize here. as long as we can have enough thoughts during use, use Zend Help for multiple purposes. if you do not need to learn to solve problems through Google, the efficiency of our development will be improved quickly, so that Senior PHPer is just around the corner.

Address: http://www.cnblogs.com/cocowool/archive/2009/07/29/1534522.html

 

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.