Configuration of Zend Studio 6.1.2 under Fedora

Source: Internet
Author: User
Tags execution functions variables php file php server php code php debugger zend
Zend Studio is a very powerful tool for our phper, and he can often make our work more inefficient, today to record the daily use of very useful configuration, to help more phper improve the efficiency of the work.

1, configure the server.

If we want to be able to quickly debug, it is essential to integrate the server and the Zend. There are many portals to configure the server, such as we can enter from preferences/php/php server, or we 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 of the server access, this if we configure the server locally, we can go to (/etc/httpd/conf.d/vhost) to set up the local project domain name, of course, can not forget to set up hosts (in/etc /hosts).

After the configuration is completed, if you need to debug the page, we only need to click the "Run" icon, the first time will pop up an address dialog box waiting for us to confirm, and then click on the Zend Studio directly to see the results of the operation of the code, this is very useful for the logically important pages Because we don't have to switch to the browser as usual, click F5 to refresh and view the results.

2, create PHP project.

I found that under Fedora, if you create a general project, PHP functions will not have an automatic code hint, and then found a long time and did not find where to set. But if you create a project as PHP project, then we can enjoy the thrill of code hints.

One of the more important benefits of creating PHP project is that when our projects become larger and bigger, we can easily jump between classes and functions, requiring only two keystrokes "Ctrl+left click".

3, DEBUG.

debugging PHP is not always convenient because it is interpreted as an executive language, but we can improve the situation by Zend Studio Debug. The Debug Settings window can be found in Window/preferences/php/debug.

Some of the default configurations:

PHP Debugger: The default use of Zend Debugger, we need to install Zend Debugger to use. Zend Studio 6.1.2 is installed by default and can be viewed through window/preference/php/debug/installed debuggers.

Zend Debugger configuration process requires a dummy.php file, which is the role of the specified server to establish a debugging script session, the file name is best not modified by default.

PHP server: Select the server that we created before.

PHP Executable: Select the appropriate PHP version, if you need to add a new project, can be found in window/preference/php/php executable.

Finally there are two input and output character encoding configuration, this is good by default, the following can be debugged.

Zend Studio debugging allows us to set breakpoints, step through, and detect variables and parameters, each of which illustrates several different debugging methods.

3.1 PHP Code native debugging (PHP Script local debugging).

Allows us to debug through Zend Studio's built-in debugger, which we can use to check for problems in the program before we deploy to the server. Local debugging requires that the code exist in the working directory, while debugging locally back to the default PHP executable environment 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 for debug configuration, or mail select Debug as ... /Debug configurations for configuration.

3.1.4 If you do not set a breakpoint, you can also debug by selecting Break at in the configuration.

3.1.5 If necessary, we can also add variables to the debug code, and then the run jumps to the debug view. In the debugging attempt, we can control the execution of the program by clicking "Resume", "Step into", and we can also observe the variable change in the variable window.

3.2 PHP Code remote Debugging (PHP Script sqlremote debugging).

This option allows us to debug files in the working directory using the Zend Debugger installed on the server. With this feature, we must install Zend Debugger on the server.

The process of debugging is basically similar to 3.1, and now Zend Debugger installation on the server to do some instructions.

Configuring remote debugging First you need to make sure that you have Zend Debugger installed on your server, which you can download from the following address: Http://www.zend.com/en/products/studio/downloads.

According to the environment of their own system to choose the appropriate distribution package, I choose here is zenddebugger-5.2.14-linux-glibc23-i386, after decompression is a few directories and a dummy.php file and some other instructions. Choose the right folder based on your current PHP version (you don't know you can use php-v to view it, this requires you to put the PHP command into the environment variable), find the zenddebugger.so path, and add it to php.ini, format 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 the dummy.php to your working directory when you are done, and then restart the server. This time, if we use Phpinfo () to view the server situation, we will be able to see the Zend Debugger this item.

3.3 Debug PHP Web page.

This option allows us to debug the code located on the server so that we can fully test the health of the code.

3.4 URL Debugging.

Used to debug the code on the remote server and debug it by entering a URL, so the file is not required to exist locally.

3.5 Toolbar debugging (Toolbar debugging).

This should be a relatively new product, and now that you are installing Zend Studio, you will be prompted to install Firefox Toolbar so that you can easily invoke some of the debugging methods provided by Zend in the browser.

4, Code hints (code hints).

Code hints help us find variables, call functions, Find object members, reference files, etc., can greatly improve the speed of development, when used under win, code hints by default is open. Used under Feodra, in my experience, code hints can work in PHP engineering. In Zend Studio 7.0, you need CTRL + SPACE to bring up code hints.

5, performance analysis (profile).

Through the performance analysis, we can find the bottleneck in the code, so as to improve the execution efficiency of the code. Profile provides us with similar statistics and analysis, and I think that if you use the Firebug profiles feature, you will not be unfamiliar with this feature of Zend Studio.

Of course, Zend Stduio in use there will be a variety of ways to improve efficiency, such as the setting of shortcut keys, I can not sum up, as long as we usually in use can have enough mind, more use Zend help, if it is in will not also learn to solve problems through Google, The efficiency of our development is bound to improve rapidly, thus becoming Senior phper.



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.