Debian (Linux) + XAMPP (lampp) + Zend studio + PHP + xdebug complete development environment configuration method.

Source: Internet
Author: User
Tags php debugger php web server

After three days of struggle, I finally installed the xdebug of the php development tool Zend studio in Linux as follows:

 

1. Install XAMPP. The installation method is as follows: assume that the installation path of XAMPP is/opt/lampp. The installation command is as follows:

Tar xvfz xampp-linux-1.4.7.tar.gz-C/OPT (details)Http://unixfans.blogbus.com/logs/34373510.html)

To avoid conflicts with other ports, in the httpd. conf file, configure listen to 18000. Use http: // 127.0.0.1: 18000/for later access

 

2. Install Zend Studio

After the installation is complete, decompress the package directly to the desired directory address. Here, we assume that the installation is at:/home/yourname/Zend studio.

When running Zend studio for the first time, you need to specify the workspace address. If you only want to develop PHP, you can specify the workspace address to:/opt/lampp/htdocs, because this is the Apache docs address in XAMPP, the added PHP file can be run directly in the browser. But the disadvantage is that you should be careful when deleting files. Otherwise, the original files in the htdocs folder in XAMPP will be deleted. Alternatively, you can use the ln command to link the workspace to the htdocs folder.

The above two installations are relatively simple, and you can simply decompress them.

 

3. Install xdebug.

When I first install the http://xdebug.org/docs/install according to the xdebug official method, running xdebug in Zend studio always prompts 57% debug session, and there are also the following prompts when starting Apache:

& Quot; xdebug requires Zend engine API version 220090626.
The Zend engine API version 220060519 which is installed, is outdated ."

Download the compiled xdebug remote file here. Pay attention to your version and system type.

Link: http://aspn.activestate.com/ASPN/Downloads/Komodo/RemoteDebugging

After the download, J copies the xdebug. So file to your lampp folder. The path in this article is as follows:/opt/lampp/lib/PHP/extensions/

Open PHP. ini and edit it. The path is/opt/lampp/etc/PHP. ini.

Add the following code snippet to the penultimate line of this file. Note that zend_extension and xdebug. profiler_output_dir correspond to the installation address of your lampp. I will highlight them in red here.

[Xdebug]
Zend_extension = "/opt/lampp/lib/PHP/extensions/xdebug. So"
Xdebug. remote_enable = true
Xdebug. remote_host = 127.0.0.1
Xdebug. remote_port = 19000
Xdebug. remote_handler = dbgp
Xdebug. profiler_enable = 1
Xdebug. profiler_output_dir = "/opt/lampp/tmp"

Note that the port number I entered here is 19000, not the default 9000. Port 9000 is likely to be occupied, and thus the 57% debug session is always prompted when running xdebug in Zend studio.

Save and exit. Now, xdebug has been installed. If XAMPP has been enabled, restart.

Log on to http: // 127.0.0.1: 18000/XAMPP, click phpinfo () on the Left bar, and find the "xdebug" keyword. If you have xdebug details, the installation is successful.

Reference diagram:

 

There is a small problem here: official site instructions in the document: http://www.xdebug.org/docs/install#configure-php

Add the following line to PhP. INI: zend_extension = "/wherever/you/Put/IT/xdebug. so "(for non-threaded use of PHP, for example the CLI, CGI or Apache 1.3 Module)

Or: zend_extension_ts = "/wherever/you/Put/IT/xdebug. So" (for Threaded usage of PHP, for example the Apache 2 work MPM or the ISAPI module ).

Although the apache version in my XAMPP is 2.2.11, xdebug cannot be loaded using the zend_extension_ts statement. Please test it by yourself. If zend_extension_ts cannot be loaded, use zend_extension like me.

 

4. Open Zend studio and set xdebug in it,

Window-> preferences-> PHP-> Debug: Select xdebug for PHP debugger. Note that the port of xdebug is still 19000. See Figure 5. Select default web server for PHP server. See Figure 5. Note: The Apache IP and port must be configured in the same way as that of XAMPP. I will configure it as http: // 127.0.0.1: 18000/in the future, when debugging PHP files using xdebug, a URL address will be displayed. The previous server path cannot be changed, that is, the http: // 127.0.0.1: 18000/if you can set the debug information for each file in debug-> debug configuration, you can also delete the file by selecting the PHP script-> XX file, and right-click to delete the file. 6, PHP executalbe point in and then press add, executable path by browse, select/opt/lampp/bin/php-5.2.8 php ini file path in/opt/lampp/etc/PHP. ini php debuger select xdebug. Click OK to see Figure 7. Test: Add a PHP file below to test whether the PHP file is successfully added. Create a PHP project named first, and create a PHP file named first in this project. PHP: Click Next and try it out. Select New Simple PHP file and enter the following code: <! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml" XML: lang = "en" lang = "en">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = iso-8859-1"/>
<Title> basic PHP page </title>
</Head>
<Body>
<P> This is standard HTML. </P>
</Body>
</Html> Save, right-click first. php, properties, run/debug settings, click New, and select PHP Web server. Name: firstserver Debugger: xdebugphp server: Default ...... In the file column, enter the relative path of the created PHP project. If the absolute path of the Project is/opt/lampp/htdocs/First/first. PHP, enter/First/first in this column. check auto generate for php URL. Click Apply. OK. Right-click first. php and run as PHP Web page to view the results. Normally, a Firefox window is automatically opened at http: // 127.0.0.1: 18000/First/first. PHP. The page content is: this is standard HTML. the same is true if you want to try Debug. The debug as PHP Web page will remind you whether to switch to the debug perspective. Click Yes to enter the debug mode. You should be familiar with other ides. If you want to switch back to the PHP editing perspective, click the PHP icon in the upper-right corner to return the perspective. 8. For details about Web browser in preferences, click General, web browser, and new. If you specify the external Firefox browser address:/usr/bin/Firefox, you can also install Google browser, reference Figure :----------------------
Thanks:

The following authors and websites are helpful to the completion of this article:

Http://unixfans.blogbus.com/logs/34375330.html

Http://blog.sina.com.cn/s/blog_4dda073c0100bikk.html

Http://www.ibm.com/developerworks/cn/linux/l-xampp/

Http://www.latenightpc.com/blog/archives/2008/05/24/a-complete-lamp-development-environment-xampp-eclipse-pdt-and-xdebug

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.