ubuntu 16.04 openjdk安装配置 、phpEclipse插件安装、配置Xdebug

13 篇文章 0 订阅
本文介绍了在Ubuntu 16.04环境下如何安装配置OpenJDK 1.8.0_91,详细步骤包括Eclipse中安装PHP开发工具PHPEclipse以及设置Xdebug 2.4。在安装过程中,可能会遇到新建PHP工程失败的问题,可以通过选择新的工作空间或使用命令行清理Eclipse来解决。Xdebug的安装通过编译安装并修改php.ini完成,但在使用Eclipse时遇到了编辑器无法打开的异常,需要寻求解决方案。
摘要由CSDN通过智能技术生成

相关环境:
ubuntu16.04
php7.0
Xdebug2.4
openjdk version “1.8.0_91”

openjdk的安装及配置

#安装openjdk:
edemon@linux:~\$ sudo apt install default-jre
edemon@linux:~$ whereis jvm
jvm: /usr/lib/jvm
edemon@linux:~$ cd /usr/lib/jvm
edemon@linux:/usr/lib/jvm$ ls
default-java  java-1.8.0-openjdk-amd64  java-8-openjdk-amd64
edemon@linux:/usr/lib/jvm/java-1.8.0-openjdk-amd64$ ls
ASSEMBLY_EXCEPTION  docs     jre  man      THIRD_PARTY_README
bin                 include  lib  src.zip

#修改配置文件:
edemon@linux:/usr/lib/jvm/java-1.8.0-openjdk-amd64$ sudo gedit ~/.bashrc

#加入内容:
export JAVA_HOME=/usr/lib/jvm/usr/lib/jvm/java-1.8.0-openjdk-amd64 
export JRE_HOME=${JAVA_HOME}/jre  
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib  
export PATH=${JAVA_HOME}/bin:$PATH
edemon@linux:/usr/lib/jvm/java-1.8.0-openjdk-amd64$ source ~/.bashrc
edemon@linux:/usr/lib/jvm/java-1.8.0-openjdk-amd64$ java -version
#出现下面内容则正确:
openjdk version "1.8.0_91"
OpenJDK Runtime Environment (build 1.8.0_91-8u91-b14-0ubuntu4~16.04.1-b14)
OpenJDK 64-Bit Server VM (build 25.91-b14, mixed mode)
#测试:
edemon@linux:~/Documents/java_space$ cat t.java
import java.util.*;  
public class t {
    public static void main(String[] args) {
         System.out.println("hello");
    }
}
edemon@linux:~/Documents/java_space$ javac t.java
edemon@linux:~/Documents/java_space$ ls
hello.java  t.class  t.java
edemon@linux:~/Documents/java_space$ java t
hello

Eclipse 上装插件

#安装eclipse:
edemon@linux:~\$ sudo apt install eclipse

PHPEclipse相关URL :
PHPEclipse - http://download.eclipse.org/tools/pdt/updates/3.7
help—-install new software
workwith右边——add。输入name和URL.
这里写图片描述

安装成功后,重启即可。
这里写图片描述
pdt的快速上手:
http://www.eclipse.org/pdt/help/html/quick_start.htm

但是在建立php工程出现:
The selected wizard could not be started.
Plug-in org.eclipse.php.ui was unable to load class org.eclipse.php.internal.ui.wizards.PHPProjectCreationWizard. An error occurred while automatically activating bundle org.eclipse.php.ui (272).
这里写图片描述
简单,只要我们新建一个文件夹,在使用这个文件夹作为php工作空间即可
或者:
edemon@linux:/usr/share/applications$ eclipse -clean
OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
新选一个工作空间即可。
但不能正常的新建php文件,应该是少了某些步骤

相关URL:
http://www.2cto.com/kf/201406/307800.html
http://www.linuxidc.com/Linux/2011-09/43031.htm

安装xdebug

(最开始安装xdebug2.1出现编译错误,换用一个高版本的2.4: )
tar -zxvf xdebug-2.4.0.tgz -C Xbug2.4 #解压到Xbug2.4
cd Xbud2.4
cd ./Xbug2.4
cd xdebug-2.4.0
sudo apt-get install php7.0-dev
phpize
make ./configure
sudo ./configure
sudo make
make test
sudo make install
sudo cp ~/Downloads/Xbug2.4/xdebug-2.4.0/modules/xdebug.so /usr/lib/php/7.0/
sudo gedit /etc/php/7.0/apache2/php.ini #配置php.ini
加入:
 zend_extension = /usr/lib/php/7.0/xdebug.so
sudo /etc/init.d/apache2 restart
打开phpinfo有出现:
这里写图片描述
相关反馈效果:

edemon@linux:~/Downloads/Xbug2.4/xdebug-2.4.0$ make test

Build complete.
Don't forget to run 'make test'.


=====================================================================
PHP         : /usr/bin/php7.0 
PHP_SAPI    : cli
PHP_VERSION : 7.0.4-7ubuntu2.1
ZEND_VERSION: 3.0.0
PHP_OS      : Linux - Linux linux 4.4.0-22-generic #40-Ubuntu SMP Thu May 12 22:03:46 UTC 2016 x86_64
INI actual  : /home/edemon/Downloads/Xbug2.4/xdebug-2.4.0/tmp-php.ini
More .INIs  :   
CWD         : /home/edemon/Downloads/Xbug2.4/xdebug-2.4.0
Extra dirs  : 
VALGRIND    : Not used
=====================================================================
TIME START 2016-06-08 11:24:21
=====================================================================
No tests were run.

edemon@linux:~/Downloads/Xbug2.4/xdebug-2.4.0$ sudo make install
Installing shared extensions:     /usr/lib/php/20151012/

  +----------------------------------------------------------------------+
  |                                                                      |
  |   INSTALLATION INSTRUCTIONS                                          |
  |   =========================                                          |
  |                                                                      |
  |   See http://xdebug.org/install.php#configure-php for instructions   |
  |   on how to enable Xdebug for PHP.                                   |
  |                                                                      |
  |   Documentation is available online as well:                         |
  |   - A list of all settings:  http://xdebug.org/docs-settings.php     |
  |   - A list of all functions: http://xdebug.org/docs-functions.php    |
  |   - Profiling instructions:  http://xdebug.org/docs-profiling2.php   |
  |   - Remote debugging:        http://xdebug.org/docs-debugger.php     |
  |                                                                      |
  |                                                                      |
  |   NOTE: Please disregard the message                                 |
  |       You should add "extension=xdebug.so" to php.ini                |
  |   that is emitted by the PECL installer. This does not work for      |
  |   Xdebug.                                                            |
  |                                                                      |
  +----------------------------------------------------------------------+

edemon@linux:~/Downloads/Xbug2.4/xdebug-2.4.0$ sudo /etc/init.d/apache2 restart
[ ok ] Restarting apache2 (via systemctl): apache2.service.

但是后来使用eclipse新建php工程文件时出现过java.lang.NullPointerException,以及Could not open the editor: The editor class could not be instantiated. 这些问题实在不知怎么解决。。谁能解决它们请留言,谢谢。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值