Use eclipse + PDT + xdebug + PHP + Apache to prepare the PHP script and webpage development environment
Installation Process:
1. Choose to install the following software in the new 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 should have three folders under/etc/PhP5/: apache2, CLI, and Conf. D. We should modify apache2 and CLI.
Under PHP. ini. Under Conf. D, there is an xdebug. ini file that records the xdebug file path. Ha. I am not a veteran, and some experts will not mention 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 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.