PHP debugging environment configuration for Eclipse development

Source: Internet
Author: User
Tags php debug
I recently used PHP for development and was not very depressed about debugging. I found an article on the Internet to set up the environment. some of the articles are outdated, and many of them are not mentioned, it is difficult for Cainiao like me to write an article here. I hope it will help you in the installation process. Refer to the article chain... SyntaxHighlighter. all ();

 

I recently used PHP for development and was not very depressed about debugging. I found an article on the Internet to set up the environment. some of the articles are outdated, and many of them are not mentioned, it is difficult for Cainiao like me to write an article here. I hope it will help you in the installation process. Reference: http://www.2cto.com/kf/201111/111881.html

The final version I selected is as follows:

 

APACHE: httpd-2.2.21-win32-x86-no_ssl.msi

PHP: php-5.2.17-Win32-VC6-x86.msi

Eclipse: eclipse-php-galileo-SR2-win32.zip

ZendDebugger: ZendDebugger-v5.2-cygwin_nt-i386

 

 

The download link is as follows (you can select another version later ):
1. download Apache from here
2. PHP. download it here. Note that VC6 corresponds to the apache platform and VC9 corresponds to the IIS platform. pay attention to the difference between thread security (ts) and thread security (CTS) in the version ), select the appropriate version when installing zenddebugger, and configure the file accordingly.
3. download Eclipse IDE for php from here
4. Zend Debugger, download it here

 

 

1. install software

 

1. install apache

 

You only need to install it step by step. after the installation is complete, apache will be started. at this time, enter http: // localhost/in the browser

It works!

 

Indicates that apache is successfully installed.

 

 

2. install PHP

 

You can install PHP extensions by default. otherwise

 

"Error trying access the local web service: GetObject Failed. You will need to manually configure the web server"

The reason is that the extension module cannot be found.

After installation, PHP automatically adds the following columns to the apache configuration file.

 

 

 

View plain

# Begin php installer edits-remove only on uninstall PHPIniDir"

LoadModule php5_module "php5apache2_2.dll"

# End php installer edits-REMOVE ONLY ON UNINSTALL

 

 

 

At this time, you need to complete the supplement. if the supplement is not found, use the command httpd-t in cmd to prompt that the php5apache2_2.dll module cannot be found. For example, my PHP is installed in C: \ Program Files/PHP. Note that "/" is used to separate paths, not "\"

 

 

 

View plain

# Begin php installer edits-remove only on uninstall PHPIniDir "C:/Program Files/PHP"

LoadModule php5_module "C:/Program Files/PHP/php5apache2_2.dll"

# End php installer edits-REMOVE ONLY ON UNINSTALL

 

Create a file index. php in the apache document directory and enter the following content:

 

 

Phpinfo ();

?>

 

Restart apache

 

Enter http: // localhost/index. php in the browser to display the PHP version information, indicating that PHP and apache have been successfully built.

 

 

 

II. DEBUG environment configuration

 

1. ZendDebugger

 

Find the corresponding version from the downloaded ZendDebugger and select it based on the PHP version (my PHP is 5.2, thread security). at this time, be sure to select thread security or unsafe and copy the corresponding ZendDebugger. dll to the apache installation directory, for example, I select ZendDebugger-v5.2-cygwin_nt-i386 \ 5_2_x_comp \ ZendDebugger. dll (thread security) to C: \ Program Files \ PHP. Add the following lines to php. ini (the path can be modified as needed)

 

 

 

View plain

Zend_extension_ts = C:/Program Files/PHP/ZendDebugger. dll

Zend_debugger.allow_hosts = localhost, 127.0.0.1

Zend_debugger.expose_remotely = always

Copy dummy. php to the apache document directory.

 

 

2. configure Apache

 

For example, if I place all Eclipse projects under E: \ EclipseWorkspace, modify Apache/conf/httpd. conf and add the following at the end of the file:

 

 

 

View plain

Alias/workspace/"E:/EclipseWorkspace /"

Options Indexes MultiViews

AllowOverride None

Order allow, deny

Allow from all

The advantage of doing so is that all php projects share an apache configuration (see how to set it below ).

 

3. eclipse configuration

Open Eclipse-> Window-> Preferences-> PHP:

Set PHP Executables-> Add as follows:

 

PHP Servers-> New, as shown in the following settings: note that the W in the Workspace is changed to w in lower case, so you can use the W in the original article if it is not convenient to capture the image. if you do not change the volume to debug the page

 

Note that the workspace is added to the URL bar. this is the directory alias added in httpd. conf.

PHP Debug, as shown in, select the appropriate Debugger and Server

 

So far, the configuration is complete.

Remember to restart Apache again.

Finally, create a test program to see how it works:

Create a new PHP Project named FirstPHPTest. of course, we use E: \ EclipseWorkspace as the Eclipse workspace directory.

Create a new PHP File in the project, such as using the index. php above.

When you right-click "Run As-> php Web Page" on index. PHP, the following figure is displayed:

Share:

 


Author sayo.net

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.