Categories

Rabu, 2008 Oktober 15

NetbeansPHPOnSolaris

Using NetBeans PHP Support in Solaris Express Developer Edition 01/08

SXDE 01/08 is a great release for AMP developers on Solaris. It comes with both the full AMP stack, with tools that make it very easy to setup, as well as NetBeans with new PHP support.

I played with this and it was very easy to get started.

Set up Runtime Environment

  • Get MySQL and Apache going following these insructions.
  • Enable PHP debugging by going to All Applications->Developer Tools->Webstack Admin->Options and choose the PHP tab, then check "Enable debugging"

php-1.jpg

Register the Apache Server in NetBeans

  • Start up the NetBeans for PHP IDE (All Applications->Developer Tools->NetBeans PHP IDE
  • Select the Services tab on the top left pane in NetBeans
  • Under Web Servers, right-click and choose Add Web Server
  • Type in 'Apache' for the connection name

php-2.jpg

  • Choose "search"

php-3.jpg

  • Press Next for next two panels "Configure HTTP Server" and "Configure File Access""

Create a PHP project

  • File->New Project->PHP->PHP Project
  • Give the project a name
  • Choose Apache as the server

php-6.jpg

  • If it asks you which Ruby interpreter you want to use, just pick one

Run Hello World

  • Edit your index.php to say hello

php-7.jpg

  • Run the project: choose Run->Run Main Project, or press the green arrow, or press F6
  • Your browser should come up and say hello:

php-8.jpg

Debugging

  • Create a breakpoint at the line where you print "Hello World"

php-9.jpg

  • Debug the project: choose Run->Debug Main Project, or press the debug button next to the green arrow, or press Ctrl-F5
  • Say yes if it asks you to overwrite your index page. You can click on "Remember" so it won't ask you next time.
  • You should hit the breakpoint and you can look at things like the call stack and active variables. Very nice!

php-10.jpg