|
|||
|
1. OpenSolaris 2008.05 Development Environment Setting Up Your AMP Development Environment Getting Sun Studio Express 5/08 |
Using NetBeans IDE for DevelopmentYou can use NetBeans IDE for Java/PHP/Ruby development. NetBeans IDE supports integrated configuration windows for managing web servers and databases directly from the IDE. Note that the version of NetBeans available in the official pkg repository may be of an older version than the one available through the NetBeans web site. The following sections shows you how you can configure NetBeans IDE 6.0 for your development needs. Setting Up Server EnvironmentWhat good is an IDE without integrated server/runtime support for web development? The NetBeans IDE supports various Java EE servers and other web servers for application deployment. You can have multiple servers configured in NetBeans irrespective of the server that will be used in your projects. Thus you can have Apache 2 Web Server configured for deploying PHP files, Apache Tomcat container configured for deploying Java based web applications or a WEBrick server for deploying Rails applications. Apache Web ServerTo configure Apache Web Server in NetBeans IDE, perform the following tasks: To Configure Apache Web Server in NetBeans IDE
Tomcat Web ServerWeb Stack comes with Tomcat 6.0 Servlet container for deploying your JSP based web applications. Some of the examples shown later in this document uses Tomcat in NetBeans. The NetBeans software for this release may not come bundled with the Tomcat server as Tomcat is already available in Solaris through Web Stack. But still you need to let NetBeans know where your Tomcat installation directory is to allow NetBeans manage Tomcat. To Configure Tomcat Web Server in NetBeans IDE
WEBrick ServerNetBeans IDE 6.0 comes bundled with WEBrick, the most widely used Ruby web server. WEBrick is started automatically on Rails project creation. There is a WEBrick console window that shows the output of the web server. No other manual configuration is required for the WEBrick server. For using Mongrel or any other server, update your gems by invoking Tools > Ruby gems. Languages and Application SupportThere is a widespread misconception that NetBeans is an IDE for Java development. In fact NetBeans IDE supports working with non-Java scripting languages like PHP, Ruby, and other such scripting languages. If you are using NetBeans IDE 6.0 in Solaris OS, you can work with any of these scripting languages supported by Web Stack. Note - Visit http://scripting.netbeans.org for more information on scripting support in NetBeans IDE 6.0. For Java DevelopmentUse NetBeans IDE for Java based development including web, enterprise, and mobile development. Please refer to http://java.netbeans.orgfor on overview of supported features. For PHP DevelopmentPHP is an interpreted, dynamic, web page scripting language. NetBeans IDE 6.0 has support for PHP editing and debugging through an add-on component called PHP plug-in. The plug-in supports PHP5 and the following features:
Note - Supported Version – PHP 5.2.4 When you have downloaded and configured the plug-in, you should be able to create new PHP projects. However to run and debug your PHP projects, you will need:
For using PHP and Apache 2 through Web Stack, you do not need any additional configuration. Note - PHP language interpreter is integrated into the Apache Web Server. PHP module with MySQL and PostgreSQL database support is provided for Apache Web Server. If you need to configure PHP with Apache 2.2 worker MPM, then you need to use Apache 2.2 Web Server + PHP FastCGI. Some PHP modules are packaged with Web Stack package as extensions. Each of the modules has a respective INI file under /etc/php5/5.2.4/conf.d directory. These PHP extensions are enabled by default. Some custom third-party PHP extensions are not enabled by default. However, you can edit the PHP extension specific INI file for any specific configuration changes. For enabling debugging support in PHP, perform the following steps:
In the PHP tab, click Advanced Configuration to open the INI file for editing. To enable PHP debugger extension, edit the file /etc/php5/5.2.4/conf.d/xdebug.ini Available PHP ExtensionsIf you have installed the amp-dev package, some PHP modules are available as extensions. Each of the modules has a respective INI file under /etc/php5/5.2.4/conf.d directory. These PHP extensions are enabled by default. Some custom third-party PHP extensions are not enabled by default. However, you can edit the PHP extension specific INI file for any specific configuration changes. For a list of supported PHP extensions, refer to the Web Stack Getting Started Guide. DTrace SupportDTrace support is available for Apache Web Server, PHP, and MySQL. After starting Apache Web Server execute the following command as root user: dtrace -l | grep php You will see a list of DTrace probes. Get the SUNWDTraceToolkit package to try out some D Scripts. For Ruby/Rails DevelopmentNetBeans features plug-ins that provides an integrated development environment for building, running, testing, and debugging Ruby and Ruby on Rails applications. NetBeans supports Ruby project types including Ruby files, RSpec specification files, and YAML files. You can configure NetBeans to use the native ruby available through Web Stack. The IDE also supports Rake build tool integration and gives you access to the Interactive Ruby Shell. Note - If you need to use the Gem Manager, you must have gem installed, and the IDE must have write permission to your Ruby installation directory. /var/ruby/1.8/gem_home contains the Ruby gems repository. Configure the GEM_HOME environment variable to point to /var/ruby/1.8/gem_home to use this installation of Ruby gems. /usr/ruby/1.8/bin contains the Ruby executable as well as other utility programs. These programs are linked from /usr/bin. For example, /usr/ruby/1.8/bin/ruby is linked from /usr/bin/ruby1.8, and may be linked from /usr/bin/ruby if 1.8 is the latest version of Ruby installed on this system. Before proceeding to use NetBeans for Ruby, you need to set the environmental variable GEM_HOME. For sh -> export GEM_HOME=/var/ruby/1.8/gem_home For csh -> setenv GEM_HOME /var/ruby/1.8/gem_home Caution - For using gem, make sure you have direct access to Internet. If your system is behind a firewall or if it uses a proxy server, set the HTTP_PROXY variable. If you do not set the GEM_HOME environmental variable, NetBeans IDE will not work as the available gems cannot be enumerated if you are using a native Ruby environment. For this reason you need to set GEM_HOME for the gem repository to be accessible from the NetBeans IDE. Also the directory referenced by GEM_HOME should be writable. So make sure you execute the following command: $ chmod -R a+w/var/ruby/1.8/gem_home Ruby on Rails (RoR)Rails is a full-stack framework for developing database-backed web applications. Rails provide a pure-Ruby development environment. Ruby gems is the standard Ruby package manager. If you have successfully installed the ruby-dev package, ruby gems are already loaded. Hence you can install Rails and its dependencies by executing the following command: /usr/bin/gem install rails --include-dependencies You can also install rails directly from NetBeans IDE rather than invoking the gem command through command line. The Ruby on Rails environment is set up for the development. You can now use NetBeans IDE to create a Ruby on Rails project. When you create a project, the IDE creates the same folders and files that a rails command would create. Ruby GemsRuby Gems is a system for managing Ruby software libraries. Ruby code packaged in this manner is called a gem. Gems allow downloading, installing, and managing your Ruby libraries. Web Stack bundle in Solaris does not include a lot of bundled gems as you can use Ruby Gems to download and install additional gems. You can use the NetBeans interface for managing Gems. For more information on configuring Ruby Gems, refer to the documents at http://ruby.netbeans.org/. |
||
|