Over a million developers have joined DZone.

NetBeans 6.5 PHP Support with sNews

· Java Zone

What every Java engineer should know about microservices: Reactive Microservices Architecture.  Brought to you in partnership with Lightbend.

I’m not a PHP developer, but when NetBeans 6.5 features PHP support, I must give it a try. I’ve got the NetBeans IDE 6.5 Beta PHP IDE. As a first example project, I’ve decided to use sNews, which is an extremly lightweight CMS with a friendly user interface.

Here’s how I’ve set up the project on Ubuntu with Apache and MySQL running locally:

You need the typical stuff (Apache, MySQL, PHP) installed before you get started. sNews rewrites urls to be search engine friendly, so you might need to enable this in your test system http server. For apache2 on ubuntu you do it like this:

  1. In the terminal type “sudo a2enmod”.
  2. You’ll be asked for the module to activate: type “rewrite”.
  3. force a reload “sudo /etc/init.d/apache2 force-reload”

Next you need to enable it for your path:

  1. Edit /etc/apache2/sites-available/default and in <Directory /var/www/> set AllowOveride from None to All (or use more fine grained settings).
  2. In the terminal cd to /var/www/ and create a folder: “sudo mkdir cms”.
  3. chown it to your user “sudo chown <username> cms”.

Now you’re ready to download and unzip sNews (I’ve put mine in the NetBeans Projects folder). Rename the unzipped folder to “cms”. Open the readme.html in a browser. Setup the database and tables as indicated there and launch NetBeans.

  1. In NetBeans go to “New Project” > “PHP” > “PHP Project with Existing Sources” and click “next”.
  2. Point the “Sources Folder” to your unpacked sNews ( e.g. “/home/toni/NetBeansProjects/cms” ) and click “next”.
  3. Check the tick box “Copy files from Sources Folder to another location” and enter “/var/www/cms”, Click “Finish”.

A new project will be created and open the “index.php” page in the editor with nice syntax coloring and code completion. Time for a first test: From your projects context menu select “run”. This should bring up your browser and launch the index.php. If you already went through the whole readme.html and made all the changes to the snews.php everything will be fine. If you’ve waited with these edits to use the cool new editor, since this is what we’re here for, you’ll get an error message that my database is not configured correctly.

To fix this you will need to make some changes to the snews.php file in your project as indicated in the readme.html. Run your application again and you should see this:

The project is up and running. You can check out the sNews site on how to customize sNews. sNews uses css for style, and you can start playing around by changing the style.css in your project with the NetBeans css editor or download a XHTML / CSS template to adjust it to your needs. I’ve got no comparison to other PHP IDE’s since I used command line tools for my (few) PHP test projects, so my judgement is of limited worth, but my first impression is that the tooling is very nice, projects are easy to set up, and the usability is great. It definitely satisfies my PHP needs, now check out if it satisfies yours :-).

From http://eppleton.com/blog/?p=204

Microservices for Java, explained. Revitalize your legacy systems (and your career) with Reactive Microservices Architecture, a free O'Reilly book. Brought to you in partnership with Lightbend.

Topics:

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}