Ubuntu (Linux) + XAMPP (lampp) + eclipse + PHP + xdebug complete development environment configuration method

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

First, install JRE or JDK. There are many methods on the Internet. Please search for them. I am lazy.

Next, install XAMPP. The installation method is as follows: assume that the installation path of XAMPP is/opt/lampp.

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

Install eclipse and install the integrated version of PDT, as shown in the following figure. Select all in one version of PDT.

Http://www.eclipse.org/pdt/downloads/

This is the easiest method. After the installation is completed, decompress the package directly to the desired directory address. Here, we assume that the package is installed in:/home/yourname/eclipse.

Some configuration steps before eclipse runs, see Part 1: http://unixfans.blogbus.com/logs/33942617.html

When running eclipse for the first time, you need to specify the address of the workspace. If you only want to develop PHP, you can specify the address of the workspace 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. Install xdebug next. Download the compiled xdebug remote file here. Pay attention to your version and system type.

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 = 9000
Xdebug. remote_handler = dbgp
Xdebug. profiler_enable = 1
Xdebug. profiler_output_dir = "/opt/lampp/tmp"

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

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

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.

 

Open eclipse and set xdebug in it,
Window-> preferences-> PHP-> debug,
PHP debugger select xdebug
Server select PHP default web server,
PHP executalbe point in and press add, in executable path press browse, select/opt/lampp/bin/php-5.2.8, php ini file path in/opt/lampp/etc/PHP. INI, name. Just give it a try. It's PHP. Select xdebug for PHP debuger and click OK.

In preferences, click General, web browser, and new to specify the external Firefox browser address:/usr/bin/Firefox

Add a PHP file below to test whether the PHP file is successful. Create a PHP project named "first" and create a PHP file named "first. php" in this project. Click "Next" to try it out. Select "new simple PHP File,
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: first
Server Debugger: xdebug
PHP 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. PHP

Select auto generate for the 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: // localhost/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.

 

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

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.