This page gives some tips on using XAMPP and Aptana Studio together to create a development environment on your machine to run, fix and commit changes to Tiki. See the Commit Code page for step-by-step instructions on how to commit code changes to the Tiki project.
The good thing about these programs is that they are multi-platform (they work on LINUX, Mac, Solaris and Windows machines) and, being packages, they minimize the number of programs that need to be installed. And one more thing: they're both open source and free!
Install XAMPP
XAMPP combines all the programs you need to make your machine a server that can run a Tiki site locally just like an internet site: PHP, MySQL, Apache, phpMyAdmin, etc. Installation is simple - below are the steps by platform (so far, just Windows).
For Windows Machines
- Go to XAMPP for Windows and download the self-extracting version
- Double click to install.
- Leave destination folder as C:\
- Do not create an xampp folder, it will be created for you.
Here's a screenshot:
- Answer questions in setup pop-up that appears
- Start the control panel, which is at C:\xampp\xampp-control.exe
- Make sure previous Windows services are deleted
- Turn on Apache and MySQL
- Set up as Windows services if you want the xampp server to be running when you boot up
This screenshot illustrates the above steps:
Plugin ImageFile not found.
There's a YouTube tutorial on this here
For Linux Machines
- Go to XAMPP for Linux and download the latest version.
- Through Terminal (Applications > Accessories > Terminal), navigate to the directory where the download was placed (usually the Downloads folder).
- Give yourself "root" privileges (XAMPP must be installed by root) by typing in the following in the Terminal:
Copy to clipboardsudo -s
- Type in the command to extract the compressed file to the opt folder (substitute the actual name of the dowloaded file for FILENAME):
Copy to clipboardtar xvfz [FILENAME] -C /opt
- Start XAMPP by using this command:
Copy to clipboard/opt/lampp/lampp start
- If you have permission problems after installing, try the following commands to grant all permissions (777) to all folders under the htdocs folder, and more restricted permissions (644) to all files under htdocs:
Copy to clipboardfind /opt/lampp/htdocs/ -type d -exec chmod 777 {} \; find /opt/lampp/htdocs/ -type f -exec chmod 644 {} \;
Linking to another folder and placing files here can also help avoid permission problems:
Copy to clipboardsudo ln -s /home/[yourusername]/folder /opt/lampp/htdocs/$USER
The XAMPP for Linux site above also has good instructions. There's a YouTube tutorial on this here.
For Macs
The installation process is very simple and the instructions at XAMPP for Mac explain it well.
Install Aptana Studio
Aptana is quite powerful so there's more of a learning curve to getting used to it than a simple code editor, but it definitely pays off in the end. Here are some of its features:
- Code editing:
- Editors for different languages
- Syntax error highlighting as you type
- Syntax help and link to documentation
- Syntax validation throughout entire project
- Highlight a function call and press F3 to go to the function code
- SVN
- Full features including browsing the repository, comparing versions, viewing history, etc.
- SSH/Shell access (uses PuTTy)
- FTP
- Debugger
- Database utility
- File manager
Installing the main program
For Windows and Mac, the installation process is straightforward, just download from www.aptana.com and follow installer instrucions.
For Linux, the main thing to note is you'll need to make sure that Java Runtime is installed first by going to System > Administraton > Synaptic Package Manager and installing the following (where X stands for the version): sun-javaX-jre and sun-javaX-plugin (other related apps will automatically be installed as well). There's a good YouTube tutorial on installing Aptana on Linux here.
Set Workspace
To work together with XAMPP, you should set your Workspace to be where your Xampp document root is (instead of using the default location) by doing the following:
- Go to File > Switch Workspace > Other... and enter the path to the htdocs folder or browse to it. Below are the typical paths:
- Windows: C:\xampp\htdocs
- Linux: /opt/lampp/htdocs
- Mac: /Applications/XAMPP/xamppfiles/htdocs
For Linux and Mac, you'll probably need to adjust the permissions for the htdocs folder and the items in that folder in order for Aptana to be able to work with it. Grant full read and write permissions to all users and everyone.
Install plugins
The first thing you'll need to do after installing the main program is install several plugins. You should see an internal page called "My Studio" when you first bring up the program (if you don't, bring it up by going to Window > My Studio). Then click on "Plugins" and go from there, or click on "View Plugin Manager" to add plugins from there.
Here's a screenshot of how the Plugin Manager looks (usually shows up in the bottom panel):
(Note: In Aptana 2, plugins can be added by selecting Help, Install New Software)
Here are the plugins you should install at a minimum:
- PHP Development Tools
- Subversive or Subclipse (for SVN)
Here are additional plugins you may want install (optional):
- Ajax Libraries (all)
- Smarty Editor
- Must be downloaded separately from http://code.google.com/p/smartypdt/
- Before attempting to install, you may need to add the Eclipse file repository so you can gather required components
- For Aptana Studio 3:
- Help > Install New Software
- click the "Available Software Sites" link
- enable Eclipse Helios Update Site
- After downloading, follow instructions at http://code.google.com/p/smartypdt/wiki/InstallSmartyPDT
- Although instructions refer to Eclipse, the exact same steps apply to Aptana Studio
- Associate *.tpl files with the Smarty editor by doing the following:
- Go to Window > Preferences > General > Editors > File Associations
- Add *.tpl as a file association type if necessary
- Make the Smarty editor the default editor
- Quantum Database Utility
- In addition to installing this plugin, you'll need to download and install another file as explained here.
- Allows you to connect to the MySQL database separately and run queries, etc.
Get used to Perspectives
Instead of showing all features and panels on one screen, Aptana uses "perspectives" that vary the screen and toolbars according to what you're focused on at the moment (for example, debugging, SVN, etc.). You'll need to get used to these so try them out by going to the top right and opening various ones. Here's a screenshot showing where to click to open a new perspective:
If you've changed the layout of a perspective and you like it, it's a good idea to save it by going to Window > Save Perspective As... and then clicking OK on the popup that comes up (no need to rename unless you want to set up a separate perspective).
Settings
Most settings can be made under Preferences or by right-clicking and selecting properties. On Windows and Linux, Preferences appears under the Window menu; on the Mac it appears under the Aptana Studio menu.
The search box under Preferences is very handy given the number of settings.
Unix Line Delimiters
- Go to Window > Preferences (Mac: Aptana Studio > Preferences)
- In the pop-up, select General > Workspace
- Under "New text file line delimiter" on that screen, select the "Other" radio button and select "Unix" from the dropdown menu
- Click "Apply" and "OK"
This is important - using something other than Unix line delimiters causes fatal errors in Tiki.
External Web Servers
Usually it's best to have a stand-alone browser program launch separately when debugging. Following are the settings needed to effect that:
- Go to Window > Preferences (Mac: Aptana Studio > Preferences)
- In the pop-up, select General > Web Browser
- Check Use external browser
- Click Default system Web Browser to use your default browser
- Click New... or Edit... to add or edit another browser. In the screen that pops up, add the location and parameter information as described further below for each type of operating system.
Windows
You just need to enter the path the the browser executable file as the location. For example, C:\Program Files\Internet Explorer\iexplore.exe
Mac
For Macs, you can't just use the path to the browser's executable file. Input the following instead:
Browser | Location | Parameters |
---|---|---|
Safari | /usr/bin/open | -a safari %URL% |
Firefox | /usr/bin/open | -a /Applications/Firefox.app %URL% |
Here's a screenshot:
There's more information on debugging-related settings in the debugging section below under Aptana settings.
Add Tiki as a Project
Something like Tiki is best handled as a project in Aptana as described below.
New Tiki Project from SVN
- First add the Tiki repository to Aptana by switching to the SVN Repository Exploring perspective (
) and then going to File > New > Repository Location (
)
- In the Enter Repository Location Information window that pops up, enter "https://tikiwiki.svn.sourceforge.net/svnroot/tikiwiki" as the URL for the repository, a custom label (optional) and your SourceForge username and password and then click Finish. Here's a screenshot:
This repository that includes all Tiki resources (trunk, branches, etc.) will now be available to choose from for any future Tiki project you want to add to Aptana.
- In the Enter Repository Location Information window that pops up, enter "https://tikiwiki.svn.sourceforge.net/svnroot/tikiwiki" as the URL for the repository, a custom label (optional) and your SourceForge username and password and then click Finish. Here's a screenshot:
- Go to File > New > Project... > SVN > Project from SVN to get the wizard started for selecting a specific Tiki resource for a project:
- After clicking next, make sure the Tiki repository and the Use existing repository location button are selected on the next window (shown below) and click Next:
Plugin ImageFile not found.
- On the next window, click on Browse and select a base resource (such as trunk) on the window that pops up (shown below):
- Click OK on the above Select base resource window, which will take you back to the Select Resource window. Make sure Head Revision is selected and then click Finish. Note: If the Finish button is grayed out on the Select Resource window, just click back and forth on the radio buttons under Revision and it should become active.
- After selecting the resource, click Finish on the Check Out As popup that comes up in order to "Check out as a project using the New Project Wizard." Here's a screenshot:
Plugin ImageFile not found.
- This should take you back to selecting a project type, this time choose PHP > PHP Project to get this wizard started.
- The project name you choose on the next screen will also be the name of the folder under xampp
Existing Project
If you already have an XAMPP Tiki installation that you want to use Aptana with, please view this video on how to do that. You'll need to show the "Project Explorer" view to be able to follow the tutorial.
Project Build Path
To provide all the cool code assist features, Aptana does project builds, where background validation and other routines are run. The default is for these to run automatically. You can speed this process up for the initial build by excluding files that won't need debugging (like image files) by doing the following:
- Right-click the project folder
- Select Build Path > Configure Inclusion / Exclusion Filters...
- Click on "Add Multiple" under the Exclusion patterns
- Select the folders to exclude. For instance:
- images, img, pics, temp, templates_c, templates
Hanging during build
[+]PHP Debugger
One of the main reasons to use a program like Aptana is to be able to debug the code using a debugging program. Below are steps on how to set a debugger up.
Xdebug
- Locate the Xdebug file that comes with XAMPP
The Xdebug file will be in the extension directory, which can be found on the phpinfo page in the "PHP Core" section under extension_dir. (To get to the phpinfo() page, go to localhost/xampp and then click on phpinfo() in the left menu bar). Here's a screenshot showing where the extension directory is:
This path will be added to the php.ini file in the steps below.
- Open the php.ini file to edit it.
The location of the file is shown on phpinfo() in the first section as "Loaded configuration file." here's a screenshot:
- Add or uncomment (by removing the semi-colon (;) at the beginning of the line) the following lines in the Xdebug section of the php.ini file. For the first line, use the Xdebug file path identified in step 1.
Copy to clipboard[XDebug] ;Use your actual path and file name for the Xdebug file in the first line. ;The path shown below is a typical Windows path ;- Unix and Mac Xdebug files will be named something like xdebug.so. ;If not using thread safe, then use zend_extension (without the _ts at the end) zend_extension_ts=C:\xampp\php\ext\php_xdebug.dll xdebug.remote_enable=true xdebug.remote_host=127.0.0.1 xdebug.remote_port=9000 xdebug.remote_handler=dbgp xdebug.idekey=ECLIPSE_DBGP
WarningMake sure there are no stray lines anywhere else in the php.ini file, such as extension=php_xdebug.dll (with Windows), which could override the lines above. If there are, comment them out by placing a semi-colon at the beginning of the line. - Restart the server software (Apache, for example). The server software should be restarted anytime changes are made to php.ini.
- Final check
You'll know that Xdebug has been properly installed when you see the following credit at the end of the first info block on the phpinfo page:
(optional) Download another version of Xdebug
[+]Aptana settings
There are several important settings that need to be made for the debugging functons in Aptana to work:
- Check debugger settings
- Under the Window menu (Aptana Studio menu with the Mac), go to Preferences > PHP > Debug > Installed Debuggers
- Select the debugger you want to configure (Zend or Xdebug) and click on the "Configure" button
- For Xdebug, configure the following:
- Make sure the port is set to 9000 (and that it matches the setting in php.ini)
- Check "Use Multisession"
Here's a screenshot:
Plugin ImageFile not found.
- Optionally, associate your PHP executable with a debugger (this may not be necessary)
This is a bit of a guessing game, but you'll need to locate the file that executes php within xampp.- In Windows, it will be a .dll file. With xampp 1.7.1 it was C:\xampp\apache\bin\php5apache2.dll. Starting with 1.7.2 it moved to C:\xampp\php\phpts.dll.
- With a Mac, in version 1.7.3 the file path was /Applications/XAMPP/xamppfiles/bin/php-5.3.1
Once you've found it: - Other settings
There are a ton of settings under Preferences, but here's a couple of key ones:- Preferences > PHP > PHP Interpreter: make sure this is set to the PHP version you're using
- Preferences > PHP > PHP Servers: be sure the Workspace default is set to http://127.0.0.1 or http://localhost
- Preferences > PHP > Debug > Workbench Options: uncheck Open PHP Debug Views (Debug Output, Browser Output) to keep these views from opening during debugging
Debug Configuration
Now you're ready to set up a debug configuration:
- In the "PHP Debug Perspective", click on the debug icon at the top left of the toolbar (it's a little green bug)
- Select Debug Configurations...
- Click on PHP Web Page in the left tree menu
- Click on the "new" button at the top left
- Enter a name for the project and a file to be opened. It's usually best to leave this as tiki-index.php and you can navigate from this page to others with the debugger running.
- Then click "Apply" and "Debug"
- In the future this configuration will be available in the debug dropdown
Here's a screenshot of the debug configuration window:
Tutorial
If you're not familiar with using a debugger to step through code, there's decent beginner tutorial in Aptana help called "Working with the Debugger." Just go to Aptana help and type that phrase in and it gives you the code for a file to debug and walks you through some debugging steps.
Troubleshooting
If the debugger doesn't work in Aptana even though it shows as being installed properly in phpinfo(), you might try the following:
- Look in the Apatana error log at htdocs/.megadta/.log
- If you're seeing an error that the debugger can't use a port number (say 10000), and that port number is the same as used for the Zend debugger, then change the Zend debugger's port number to a different number
SVN
Just remember Team. All of the familiar SVN functions (commit, update, switch, etc.) can be accessed by right-clicking on any folder or file and then selecting Team in the context menu.
If you like to watch the files scroll by during an update, you can see that in the console view, which is usually in the bottom panel. If not, you can activate it by going to Window > Show View > Console. If you're still not seeing it, you may need to select SVN in the console selector. Here's a sceenshot:
The "Show History" option in the Team menu is very useful. Individual revisions for a file can be right-clicked and changes shown versus a previous revision.
There is also an SVN perspective, which allows you to navigate through the repository, among other features.