VBox+Netbeans——Linux下的PHP开发环境

来源:互联网 发布:国际歌在中国禁止知乎 编辑:程序博客网 时间:2024/05/22 16:43

虚机使用VirtualBox比VMWare的感觉要好些。


一、VirtualBox

运行virtualBox的autorun时出现问题,解决:

sudo apt-get install dkms build-essential linux-headers-$(uname -r) 


二、Eclipse PHP

先试着安装Eclipse,遇到各种问题,把workspace目录放到/var/www/html目录下,解决了一些问题。但最终还是没解决。后来又安装了Zend提供的Eclipse,问题依旧。放弃!sudo apt-get install dkms build-essential linux-headers-$(uname -r) 

Installing Eclipse PHP

Install Zend plugin:

http://code.google.com/p/zend-sdk/wiki/ZendSdkEclipsePlugin


三、NetBeans

看到网上有很多网友盛赞netbeans,于是安装了一个

1. 安装NetBeans


1)下载sh文件,

https://netbeans.org/downloads/

2) 执行安装

下载完后执行: chmod +x netbeans-7.3-linux.sh; ./ netbeans-7.3-linux.sh;

开始安装,提示jdk找不到,后来在/usr/jvm/lib/jd****,找到好几个版本,但netbeans还是提示版本过低。

于是:下载了jdk最新版jdk_1.7.0_21。然后一路安装下去。

3)运行

安装完后,到安装目录(默认:/usr/local/netbeans-7.3/bin/)下,双击netbeans图标启动netbeans

4)创建一个PHP项目

创建后,source folder默认目录是在/var/www下,而不是/var/www/html,更改httpd conf 文件中有“/var/www/html”的两处,为““/var/www”。即可正常运行。

或者不改httpd conf文件,更改项目对应的source folder和project folder也可。


Debuger好像还有点慢,等等看如何,再等很久,还是waiting,呵呵,看来有问题。这么解决:


2. 安装xdebug

https://github.com/xdebug/xdebug


1) Unpack the tarball: tar -xzf xdebug-2.2.x.tgz.  Note that you donot need to unpack the tarball inside the PHP source code tree.Xdebug is compiled separately, all by itself, as stated above.2) cd xdebug-2.2.x3) Run phpize: phpize   (or /path/to/phpize if phpize is not in your path).4) ./configure --enable-xdebug (or: ../configure --enable-xdebug   --with-php-config=/path/to/php-config if php-config is not in your   path)5) Run: make6) cp modules/xdebug.so /to/wherever/you/want/it7) add the following line to php.ini:   zend_extension="/wherever/you/put/it/xdebug.so"
   #The following is my config:
   zend_extension = /usr/lib64/xdebug.so   xdebug.remote_enable=on   xdebug.remote_log="/var/log/xdebug.log"   xdebug.remote_host=localhost   xdebug.remote_handler=dbgp   xdebug.remote_port=9000
8) Restart your webserver.(since php is part of webserver)9) Write a PHP page that calls "phpinfo();" Load it in a browser and   look for the info on the xdebug module.  If you see it, you have been   successful!

按照上述步骤完成后,发现phpinfo页面多了xdeug的表格,表明成功

但是遗憾的是netbeans的debug按钮们依然是灰色的。无法debug;查看日志:/var/log/httpd/error_log,发现里面竟然有selinux,到/etc/sysconfig/security里disabled掉selinux,然后重启系统。还是没解决。


把php.ini文件中的端口改为9001,重启httpd;然后把netbeans的端口也改为9001。ok!

很奇怪,于是又把php.ini和netbeans--debug--options-php-debug中的端口改回为9000. 也可以正常工作了。

至此,netbeans下的php运行,debug都ok。


在ubuntu上安装netbeans出现 UI initialize 错误。根据stackflow上的提示

aptitude purge openjdk-6-*

aptitude install openjdk-7-jdk

it works.


C++

1) After creating a C++ project, you need set include path. It's easy.

2) unseen folder created by yourself. Don't worry. If you crating a class, you can select folder, and then you'll see your created folder.

3)"unsolvde path"

I want to use class pair in <utility>, it hints me unsolved includes in <utility>. Please select the warned "include", and then click mouse. Recursively clicing "include", last you'll see it could not find "#include <bits/c++config.h>"


zhxue@ubuntudev:~$ sudo find / -name *c++config.h
/usr/include/c++/4.7/i686-linux-gnu/bits/c++config.h
/usr/include/c++/4.7/i686-linux-gnu/64/bits/c++config.h

add "/usr/include/c++/4.7/i686-linux-gnu/bits" into C++ include path.


Ruby
下载ruby插件:
http://plugins.netbeans.org/plugin/38549
点plugin——Downloaded——Add Plugins,选中所下载的23个nbm文件,点击install。遇到问题:
The plugin named org.jruby.jruby is needed and not found.
重新选择所有文件,而不仅仅是nbm,这样可以吧org.jruby.jruby.jar选上,再点击就ok了。


原创粉丝点击