手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

Ubuntu下Netbeans+PHP开发环境的配置

[日期:2011-10-13] 来源:Linux社区  作者:programape [字体:大 中 小]

点击这里从官网下载Netbean,按照官网的指示完成安装。

在netbeans下新建php项目,项目属性里按下图设置:

关键要勾选copy files from sources folder to another location

这个选项使得netbeans的项目文件会被放到localhost的索引下,这样才能从localhost里访问编写的网页了。

同样,在run configuration里要如下设置:

在url里要设置好路径,其中programmer是Ubuntu的用户名,要根据不同情况更改。index.php是网站首页,也是运行php项目首先打开的文件。

这时通常会面临另一个问题:当网页链接到php文件时,浏览器会自动下载php文件而不是打开它。从ubuntu forum上找到了解决方法,问题出在要修改 /etc/apache2/mods-available/php5.conf 文件,如以下代码所示:

  1. # To re-enable php in user directories comment the following lines   
  2. # (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it   
  3. # prevents .htaccess files from disabling it.   
  4.         
  5. # <IfModule mod_userdir.c> #Comment out this line  
  6.     #   <Directory /home/*/public_html> #comment out this line  
  7.     #        php_admin_value engine Off #comment out this line  
  8.     #    </Directory>  #comment out this line  
  9. #</IfModule>  #comment out this line  
之后重启apache web server:sudo /etc/init.d/apache2 restart

这样就能让浏览器从localhost打开而不是下载php文件了。

linux
相关资讯       Ubuntu教程  NetBeans 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款