Goals: Ubuntu with Eclipse + pdt + xdebug + php + apache preparation of php scripts and web development environment installation process: 1, in the new Ubuntu choose to install the following software apachephp5php5-cliphp5-xdebug after installation, (You may need to start apache: sudo/etc/init. d/apache2start. You can try to enter the URL http in firefox.
Objective: To use Eclipse + pdt + xdebug + php + apache in Ubuntu to prepare the php script and webpage development environment
Installation Process:
1. Choose to install the following software in the new Ubuntu version.
Apache
Php5
Php5-cli
Php5-xdebug
After installation, (you may need to start apache: sudo/etc/init. d/apache2 start. You can try to enter the URL: http: // localhost in firefox to check whether it works. The webpage should be visible.
2. Install eclipse + pdt
Eclipse is the most powerful IDE and the most difficult IDE to use. (This is my opinion. Do not quarrel with me)
After half a day of preparation, I finally downloaded PDT 1.0.3 All-In-One (Linux GTK). No way, I had to install it myself.
Suggestion: if you are a beginner in eclipse like me, use all-in-one. If you need to use C ++, install a separate C ++ version. If you need other languages, install a separate eclipse. The method is stupid and a waste of space, but it is relatively simple. No way. I am a newbie.
3. Add XDEBUG to PHP. ini.
Php. ini contains three folders in/etc/php5/: apache2, cli, and conf. d. We should modify php under apache2 and cli. ini. in conf. d. There is an xdebug. the INI file records the xdebug file path. ha, I'm not a veteran. Some experts don't say this.
Use the superuser to open the above two php. ini files and add the following code:
[Xdebug]
Xdebug. remote_enable = 1
Xdebug_remote_host = "localhost"
Xdebug. remote_port = 9000
Xdebug. remote_handler = "dbgp"
Zend_extension =/usr/lib/php5/20060613 + lfs/xdebug. so
4. Modify the default website path of apache.
Of course, it is better to create another virtual directory, but the computer we use is generally not a server. The modification method is as follows:
Open the preparation file with the superuser, path:/etc/apache2/sites-available/default
Modify the path to the place where your php project is stored. I don't know much about it either. I modified the following two parts:
DocumentRoot/home/fsp/workspace/pdt/
/Home/fsp/workspace/pdt/is the path for storing PHP projects.
5. Restart apache
Sudo/etc/init. d/apache2 restart
6. Open eclipse, create a PHP project, create a PHP webpage, and add two codes.
Echo phpinfo ();
Save and test the tracing result in firefox. Pay attention to the path here. You must find the file. For example, my
Http: // localhost/phptest/newfile. php
7. Prepare an eclipse Browser
Open eclipse, find window-> preferences-> general-> web browser, and check whether there is any browser. If not, add it. Of course, it is firefox.
8. Prepare running and debugging options
Window-> preferences-> PHP-> php executables-> add-> Settings are as follows:
Php5
/Usr/bin/php5 (note that you should select php5 here, not php, because we install php5-xdebug)
9. Continue to prepare debug (trouble)
Window-> preferences-> PHP-> run/debug-> perspectives-> you can find php scripts and php web pages.
, Respectively set their debug and run the program.
10. After the PHP script is created, debug and run it.
Open Run-> Open Debug Dialog, select the name and environment required for debugging, and check carefully.
Then you can perform one-step debugging.