特殊:Badtitle/NS100:PHPEclipse:修订间差异
小无编辑摘要 |
小无编辑摘要 |
||
第2行: | 第2行: | ||
{{Languages|UbuntuHelp:PHPEclipse}} | {{Languages|UbuntuHelp:PHPEclipse}} | ||
'''Note:Eclipse is now available in the Universe repository.''' | '''Note:Eclipse is now available in the Universe repository.''' | ||
See : [[UbuntuHelp:EclipseIDE]] | See : [[UbuntuHelp:EclipseIDE|EclipseIDE]] | ||
== Notice == | == Notice == | ||
This installation guide will install | This installation guide will install PHPEclipse into an Eclipse installation in your home directory or in the /opt directory (depending of your [[UbuntuHelp:EclipseIDE|EclipseIDE]] installation method) | ||
PHPEclipse is able to controll MySQL as well as Apache, and using dbg as a debugger. See below for instructions on controlling Apache using PHPEclipse. | |||
== Automated Installation == | == Automated Installation == | ||
An automated installation of | An automated installation of PHPEclipse is available via the Eclipse Update Manager. | ||
<ol><li>Start Eclipse as root, ''$sudo eclipse'' or ''$sudo -s'' then ''#eclipse'' | <ol><li>Start Eclipse as root, ''$sudo eclipse'' or ''$sudo -s'' then ''#eclipse'' | ||
</li><li>Click on Help->Software Updates->Find/Install from file menu in Eclipse. | </li><li>Click on Help->Software Updates->Find/Install from file menu in Eclipse. | ||
第27行: | 第27行: | ||
== Installation == | == Installation == | ||
This document assumes you have a running Eclipse installed as described in [[UbuntuHelp:EclipseIDE]]. | This document assumes you have a running Eclipse installed as described in [[UbuntuHelp:EclipseIDE|EclipseIDE]]. | ||
PHPEclipse is a plugin to Eclipse and should be placed in the <code><nowiki>$HOME/opt/eclipse/plugins</nowiki></code> directory for the personnal installation or <code><nowiki>/opt/eclipse/plugins</nowiki></code> for the global installation. | |||
The | The PHPEclipse project is located at [http://www.phpeclipse.de/ www.phpeclipse.de] and you will find the zipped plugin files [http://sourceforge.net/project/showfiles.php?group_id=57621&package_id=70009 here]. | ||
* Download the latest release (PHPEclipse1.1.3-2005-01-29 when this document where written) to your favorite download directory. Then change directory to the eclipse directory (personnal installation): | * Download the latest release (PHPEclipse1.1.3-2005-01-29 when this document where written) to your favorite download directory. Then change directory to the eclipse directory (personnal installation): | ||
<pre><nowiki> | <pre><nowiki> | ||
第38行: | 第38行: | ||
$ cd /opt/eclipse | $ cd /opt/eclipse | ||
</nowiki></pre> | </nowiki></pre> | ||
* Unzip the previously downloaded | * Unzip the previously downloaded PHPEclipse plugin (use <code><nowiki>sudo</nowiki></code> if you used the [[UbuntuHelp:EclipseIDE|EclipseIDE]] global installation method): | ||
<pre><nowiki> | <pre><nowiki> | ||
$ unzip ~/your_download_dir/PHPEclipse1.1.3-2005-01-29.zip | $ unzip ~/your_download_dir/PHPEclipse1.1.3-2005-01-29.zip | ||
第50行: | 第50行: | ||
== Controlling Apache from Eclipse == | == Controlling Apache from Eclipse == | ||
=== Configuring Apache === | === Configuring Apache === | ||
The first thing you'll want to do is have a working Apache install see [[UbuntuHelp:ApacheMySQLPHP]] for details. The assumption is that you're installing Apache on a workstation that is seperate from your production web server. | The first thing you'll want to do is have a working Apache install see [[UbuntuHelp:ApacheMySQLPHP|ApacheMySQLPHP]] for details. The assumption is that you're installing Apache on a workstation that is seperate from your production web server. | ||
In your favorite text editor open <code><nowiki>/etc/apache2/sites-available/default</nowiki></code> change '''DocumentRoot''' to somewhere in your home directory: | In your favorite text editor open <code><nowiki>/etc/apache2/sites-available/default</nowiki></code> change '''DocumentRoot''' to somewhere in your home directory: | ||
<pre><nowiki> | <pre><nowiki> | ||
第59行: | 第59行: | ||
<Directory /home/<username>/work/> | <Directory /home/<username>/work/> | ||
</nowiki></pre> | </nowiki></pre> | ||
'''Note:''' the above is just an example of my work environment change the path accordingly. Also, the <code><nowiki>PHP Browser</nowiki></code> that is part of | '''Note:''' the above is just an example of my work environment change the path accordingly. Also, the <code><nowiki>PHP Browser</nowiki></code> that is part of PHPEclipse by default wants to open '''http://localhost/php/''your_script'''''. | ||
and reload Apache to recognize the new configuration: | and reload Apache to recognize the new configuration: | ||
<pre><nowiki> | <pre><nowiki> | ||
/etc/init.d/apache2 reload | /etc/init.d/apache2 reload | ||
</nowiki></pre> | </nowiki></pre> | ||
=== Configure | === Configure PHPEclipse for Apache === | ||
Now that we have Apache configured for our development environment we can configure | Now that we have Apache configured for our development environment we can configure PHPEclipse to control Apache. First open Eclipse and click on: | ||
<pre><nowiki> | <pre><nowiki> | ||
Window > Preferences > PHPeclipse Web Development | Window > Preferences > PHPeclipse Web Development | ||
</nowiki></pre> | </nowiki></pre> | ||
This opens the | This opens the PHPEclipse options dialog. | ||
First click on <code><nowiki>PHP External Tools</nowiki></code> there's two things to change <code><nowiki>Run PHP command</nowiki></code> and <code><nowiki>Parser command</nowiki></code>: | First click on <code><nowiki>PHP External Tools</nowiki></code> there's two things to change <code><nowiki>Run PHP command</nowiki></code> and <code><nowiki>Parser command</nowiki></code>: | ||
<pre><nowiki> | <pre><nowiki> |
2008年10月20日 (一) 00:19的版本
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/PHPEclipse }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/af | • {{#if: UbuntuHelp:PHPEclipse|Afrikaans| [[::PHPEclipse/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/ar | • {{#if: UbuntuHelp:PHPEclipse|العربية| [[::PHPEclipse/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/az | • {{#if: UbuntuHelp:PHPEclipse|azərbaycanca| [[::PHPEclipse/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/bcc | • {{#if: UbuntuHelp:PHPEclipse|جهلسری بلوچی| [[::PHPEclipse/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/bg | • {{#if: UbuntuHelp:PHPEclipse|български| [[::PHPEclipse/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/br | • {{#if: UbuntuHelp:PHPEclipse|brezhoneg| [[::PHPEclipse/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/ca | • {{#if: UbuntuHelp:PHPEclipse|català| [[::PHPEclipse/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/cs | • {{#if: UbuntuHelp:PHPEclipse|čeština| [[::PHPEclipse/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/de | • {{#if: UbuntuHelp:PHPEclipse|Deutsch| [[::PHPEclipse/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/el | • {{#if: UbuntuHelp:PHPEclipse|Ελληνικά| [[::PHPEclipse/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/es | • {{#if: UbuntuHelp:PHPEclipse|español| [[::PHPEclipse/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/fa | • {{#if: UbuntuHelp:PHPEclipse|فارسی| [[::PHPEclipse/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/fi | • {{#if: UbuntuHelp:PHPEclipse|suomi| [[::PHPEclipse/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/fr | • {{#if: UbuntuHelp:PHPEclipse|français| [[::PHPEclipse/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/gu | • {{#if: UbuntuHelp:PHPEclipse|ગુજરાતી| [[::PHPEclipse/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/he | • {{#if: UbuntuHelp:PHPEclipse|עברית| [[::PHPEclipse/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/hu | • {{#if: UbuntuHelp:PHPEclipse|magyar| [[::PHPEclipse/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/id | • {{#if: UbuntuHelp:PHPEclipse|Bahasa Indonesia| [[::PHPEclipse/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/it | • {{#if: UbuntuHelp:PHPEclipse|italiano| [[::PHPEclipse/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/ja | • {{#if: UbuntuHelp:PHPEclipse|日本語| [[::PHPEclipse/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/ko | • {{#if: UbuntuHelp:PHPEclipse|한국어| [[::PHPEclipse/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/ksh | • {{#if: UbuntuHelp:PHPEclipse|Ripoarisch| [[::PHPEclipse/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/mr | • {{#if: UbuntuHelp:PHPEclipse|मराठी| [[::PHPEclipse/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/ms | • {{#if: UbuntuHelp:PHPEclipse|Bahasa Melayu| [[::PHPEclipse/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/nl | • {{#if: UbuntuHelp:PHPEclipse|Nederlands| [[::PHPEclipse/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/no | • {{#if: UbuntuHelp:PHPEclipse|norsk| [[::PHPEclipse/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/oc | • {{#if: UbuntuHelp:PHPEclipse|occitan| [[::PHPEclipse/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/pl | • {{#if: UbuntuHelp:PHPEclipse|polski| [[::PHPEclipse/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/pt | • {{#if: UbuntuHelp:PHPEclipse|português| [[::PHPEclipse/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/ro | • {{#if: UbuntuHelp:PHPEclipse|română| [[::PHPEclipse/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/ru | • {{#if: UbuntuHelp:PHPEclipse|русский| [[::PHPEclipse/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/si | • {{#if: UbuntuHelp:PHPEclipse|සිංහල| [[::PHPEclipse/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/sq | • {{#if: UbuntuHelp:PHPEclipse|shqip| [[::PHPEclipse/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/sr | • {{#if: UbuntuHelp:PHPEclipse|српски / srpski| [[::PHPEclipse/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/sv | • {{#if: UbuntuHelp:PHPEclipse|svenska| [[::PHPEclipse/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/th | • {{#if: UbuntuHelp:PHPEclipse|ไทย| [[::PHPEclipse/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/tr | • {{#if: UbuntuHelp:PHPEclipse|Türkçe| [[::PHPEclipse/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/vi | • {{#if: UbuntuHelp:PHPEclipse|Tiếng Việt| [[::PHPEclipse/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/yue | • {{#if: UbuntuHelp:PHPEclipse|粵語| [[::PHPEclipse/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/zh | • {{#if: UbuntuHelp:PHPEclipse|中文| [[::PHPEclipse/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/zh-hans | • {{#if: UbuntuHelp:PHPEclipse|中文(简体)| [[::PHPEclipse/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:PHPEclipse | UbuntuHelp:PHPEclipse | {{#if: | :}}PHPEclipse}}/zh-hant | • {{#if: UbuntuHelp:PHPEclipse|中文(繁體)| [[::PHPEclipse/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:PHPEclipse|:PHPEclipse|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :PHPEclipse/zh | | {{#ifexist: PHPEclipse/zh | | {{#ifeq: {{#titleparts:PHPEclipse|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:PHPEclipse|1|-1|}} | zh | | }}
Note:Eclipse is now available in the Universe repository. See : EclipseIDE
Notice
This installation guide will install PHPEclipse into an Eclipse installation in your home directory or in the /opt directory (depending of your EclipseIDE installation method) PHPEclipse is able to controll MySQL as well as Apache, and using dbg as a debugger. See below for instructions on controlling Apache using PHPEclipse.
Automated Installation
An automated installation of PHPEclipse is available via the Eclipse Update Manager.
- Start Eclipse as root, $sudo eclipse or $sudo -s then #eclipse
- Click on Help->Software Updates->Find/Install from file menu in Eclipse.
- Select the radio button labeled, "search for new features to install".
- Click on the "New Remote Site" button.
- Enter a name, and the URL: http://update.phpeclipse.net/update/nightly
- Click on "Finish".
- A list of features will be presented, open the list and check the one labeled "phpeclipse".
- Click on "Next"
- Follow the onscreen instructions to finish the automatic install.
Ubuntu Feisty 7.04 Fix
When you try to edit a .php file using the PHPeclipse editor, you will get an error message that tells you to look in the log. This problem arises due to problem with the default JVM used in Feisty. To fix the problem:
- Close eclipse and at the bash prompt:
- sudo apt-get install sun-java6-jre libxext6-dbg
- sudo nano -w /etc/eclipse/java_home
- Insert /usr/lib/jvm/java-6-sun on the line above /usr/lib/jvm/java-gcj
- Close and save the file
Installation
This document assumes you have a running Eclipse installed as described in EclipseIDE.
PHPEclipse is a plugin to Eclipse and should be placed in the $HOME/opt/eclipse/plugins
directory for the personnal installation or /opt/eclipse/plugins
for the global installation.
The PHPEclipse project is located at www.phpeclipse.de and you will find the zipped plugin files here.
- Download the latest release (PHPEclipse1.1.3-2005-01-29 when this document where written) to your favorite download directory. Then change directory to the eclipse directory (personnal installation):
$ cd ~/opt/eclipse
or (global installation)
$ cd /opt/eclipse
- Unzip the previously downloaded PHPEclipse plugin (use
sudo
if you used the EclipseIDE global installation method):
$ unzip ~/your_download_dir/PHPEclipse1.1.3-2005-01-29.zip
(substitute your_download_dir
and zip file name to fit your system)
- The plugin is now installed but "Eclipse 3.x caches all plugin.xml files into a single repository for quicker loading. If you used eclipse before installing PHPeclipse, you should start eclipse once with the -clean option. This -clean forces Eclipse to rebuild that repository. This applies to anything that is installed into eclipse by unzipping it into its plugins folder.":
$ eclipse -clean
Next time you may start Eclipse your favorite way, without the -clean option.
Controlling Apache from Eclipse
Configuring Apache
The first thing you'll want to do is have a working Apache install see ApacheMySQLPHP for details. The assumption is that you're installing Apache on a workstation that is seperate from your production web server.
In your favorite text editor open /etc/apache2/sites-available/default
change DocumentRoot to somewhere in your home directory:
DocumentRoot /home/<username>/work and <Directory /home/<username>/work/>
Note: the above is just an example of my work environment change the path accordingly. Also, the PHP Browser
that is part of PHPEclipse by default wants to open http://localhost/php/your_script.
and reload Apache to recognize the new configuration:
/etc/init.d/apache2 reload
Configure PHPEclipse for Apache
Now that we have Apache configured for our development environment we can configure PHPEclipse to control Apache. First open Eclipse and click on:
Window > Preferences > PHPeclipse Web Development
This opens the PHPEclipse options dialog.
First click on PHP External Tools
there's two things to change Run PHP command
and Parser command
:
Run PHP command default is /apache/php/php change this to: /usr/bin/php Parser command default is /apache/php/php -l -f {0} change to: /usr/bin/php -l -f {0}
Note: you'll need the php5-cli package installed for this to work.
Add a line to /etc/sudoers
to allow admins to control apache2
without entering a password
sudo visudo Append the following line %admin ALL=NOPASSWD: /usr/sbin/apache2
Create a simple script to run apache2
via sudo
mkdir /home/<username>/bin vi /home/<username>/bin/apache2
#!/bin/sh sudo /usr/sbin/apache2 $*
Next click on Apache
under PHP External Tools
where we'll need to change the Apache
and Start Apache
values:
Change Start Apache to: -k start and Apache to: /home/<username>/bin/apache2
Then click Ok
to apply.
To start Apache from Eclipse simply click the Start Apache icon.
TODO
Write about controlling MySQL as well as using dbg. Note: this guide has been tested on Ubuntu 7.04 (Feisty) and Ubuntu 7.10 (Gutsy).