This article describes my experience in creating a PHP project in NetBeans IDE 6.5 from the repository version of Mediawiki. The project included 3 kinds of data that a developer would probably want to handle differently:
- PHP source files, which need to be on the web server and need to be in a Subversion check-in directory
- Subversion meta-data, which has to be in the Subversion check-in directory but preferably not on the web server
- NetBeans IDE meta-data, which preferably should be stored separately from the rest of the data
Fortunately, the PHP Project from Existing Sources wizard made it easy to keep these 3 kinds of data separate from each other, as you will see in the following procedure.
- To begin with, in my IDE, I installed both the Subversion plugin and the Subversion 1.5 for Windows client, available from the Plugins manager (Tools > Plugins).
- I looked up the Mediawiki wiki page on their Subversion repository and found the checkout URL. Then in my IDE I went to Versioning > Subversion > Checkout and entered the URL.
Because I am not a Mediawiki developer, I left the username and password fields blank. If I had developer privileges, I would have entered my authorization credentials so I could later commit changes back to the Mediawiki repository.
In the next panel of the checkout wizard, the IDE automatically filled out the Repository Folder field with the path to the phase3 folder. I accepted this default. Then in the local folder field, I specified a path in the root of my drive. I left all other fields and check boxes blank, which is the default setting.
When I clicked Finish, the IDE checked out the Mediawiki phase3 SVN repository correctly, with the path G:/mediawiki/phase3.
Next I completed the Mediawiki installation procedure as described in the Mediawiki installation guide:
- Prepare the directories.
- Create a database.
- Run the installation script.
- Now I wanted to create a NetBeans project with this repository. I opened the New Project wizard and selected PHP Application with Existing Sources.
- In the Name and Location panel, I browsed to the G:/mediawiki/phase3 folder. I then selected "Put NetBeans metadata into a separate directory" This is so that no NetBeans metadata would be committed back to the Subversion repository. (I had no check in privileges in any case but wanted to test the feature.) I created a "mediawiki" folder in my NetBeansProjects directory for this purpose. I left all other fields at their default settings and clicked Next, which opened the Run Configuration panel.
- In the Run Configuration panel, I chose to run the project as a local web site, on my Xampp Apache server. I could instead have chosen to run the project on a remote FTP server or as a command-line script, as described in the Setting Up a PHP Project tutorial.
In order to run the project as a local web site, I had to copy source files to my server's web folder. So I checked Copy files from Sources Folder to another location. NetBeans IDE automatically located my Apache server's web folder, which for Xampp is G:\xampp\htdocs, and entered the location into the Copy to folder field. This option meant that the PHP source files would be copied to the Apache server without the SVN or NetBeans IDE metadata.
That was it! When I clicked Finish, the IDE created a PHP project out of the checked out Mediawiki repository. It took about 30 seconds to index all the files. From then on, I could use the IDE's PHP editing features to work on the project and its versioning features to update and commit my changes.