Writing a web application with PHP on the OpenSolaris OS is easy using the NetBeans IDE and the tools in Sun Web Stack. This article shows you how to create a simple PHP program in this environment. The intended audience is developers who are new to the OpenSolaris OS and Sun Web Stack. Contents
Requirements
In this tutorial, you use the OpenSolaris OS, the NetBeans IDE, and components of the Sun Web Stack to create a simple PHP program. Specifically, you will use PHP, the NetBeans IDE, and the Apache web server. Download the required software as follows:
For this tutorial, the author installed the OpenSolaris OS on Virtual Box 2.0.6, running on an Apple MacBook Pro with Mac OS X 10.5.5. Under Virtual Box, OpenSolaris was provided with a 20 GB fixed-size virtual disk and 1024 MB RAM. Virtual Box is free to download, but you don't need to use it to complete this tutorial. Instead, you can install OpenSolaris directly on your system's boot drive. About Sun Web Stack
Web Stack is closely associated with a the OpenSolaris SFWNV Project, and is focused specifically on web tier components. Sun Web Stack tunes these components for use on the Solaris and OpenSolaris operating systems. The components in Sun Web Stack are open source. You can use them to build and deploy web applications on the Solaris and OpenSolaris operating systems. Components available as part of the Sun Web Stack include:
Tutorial
In this tutorial, you use the NetBeans IDE and other components from the Sun Web Stack on the OpenSolaris operating system. In this environment, you create a "Hello World" program in PHP. The tutorial assumes that you have installed the OpenSolaris OS, as described in the Requirements section. The following steps assume that you are running in an OpenSolaris environment:
Installing Sun Web Stack
You can install Sun Web Stack from the command line or through the OpenSolaris graphical user interface (GUI). Instructions for a command-line installation can be found in the article Installing Sun Web Stack on OpenSolaris OS. This tutorial uses the GUI procedure. To install Sun Web Stack with the GUI:
Initializing Sun Web Stack
You will now initialize Sun Web Stack. Among other actions, initialization places Web Stack items in the Applications > Developer Tools menu. To initialize Sun Web Stack:
Note: If your Developer Tools menu doesn't have the items shown in the figure, restart the GUI by opening a Terminal window and typing the command Starting the Web Server
In this tutorial, your PHP application will be deployed on a local instance of the Apache web server. To start the web server from the GUI:
Configuring the NetBeans IDE
Before you create a PHP project in the NetBeans IDE, you must configure the IDE to use the Sun Web Stack version of PHP. To direct the NetBeans IDE to the Sun Web Stack PHP installation:
Creating a PHP Project in the NetBeans IDE
To create a PHP project in the NetBeans IDE:
Editing the index.php File
When you create the project, the NetBeans IDE creates an To edit the file in the IDE:
Running the Application
Your application is now ready to run. Choose Run > Run Project in the IDE, or click the Run symbol (
Conclusion
For more realistic projects, you may want to enable the PHP Xdebug extension. The Xdebug extension helps you debug PHP scripts by providing valuable trace, parameter, and memory allocation information. With the Xdebug extension enabled, you can debug your PHP script in the NetBeans IDE. To enable the Xdebug extension:
Further Information
|
| |||||||||||||||||||||||||||||||||||||
Oracle is reviewing the Sun product roadmap and will provide guidance to customers in accordance with Oracle's standard product communication policies. Any resulting features and timing of release of such features as determined by Oracle's review of roadmaps, are at the sole discretion of Oracle. All product roadmap information, whether communicated by Sun Microsystems or by Oracle, does not represent a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. It is intended for information purposes only, and may not be incorporated into any contract.
|
| ||||||||||||