Several months ago, I started the process of embedding PHP into the Titanium platform. After several sprints of work, the Appcelerator team was finally ready to merge my work into their master branch, and Martin Robinson worked to bring the implementation to maturity. The current release of Titanium Developer does not yet have the PHP support built in to the bundled SDK, and I’m not sure when it will be released, so I thought I’d share how to get a development version built with PHP support so you can start playing with it and even help the Appcelerator team by catching bugs in the implementation.
Since it may still be a while before the next release of Titanium that includes PHP, I’ve decided to provide instructions here on how to build the SDK from the master branch and connect it to the Titanium Developer application. Sorry, but I don’t have instructions for Windows; these work on Mac or Linux.
- Download (and install) Titanium Developer from http://www.appcelerator.com/products/download/
- Launch Titanium Developer and let it do its thing (you’ll have to create an acct)
- Now you may close it
- You should now have a Titanium directory with the SDK in it at either:
- Now, build the development SDK to use with Titanium Developer. You’ll need Python, scons, a compiler, and possibly other prerequisites.
1 2 3 4
$> git clone git://github.com/appcelerator/titanium_desktop.git $> cd titanium_desktop/ $> git submodule update --init $> scons dist
- Unzip the built SDK to some location. I like to use
$> unzip build/osx/dist/sdk-0.7.0.zip -d ~/.titanium-dev/
- Move Titanium Developer SDK out of the way and point to your build SDK
1 2 3 4 5 6 7
$> cd /Library/Application\ Support/Titanium/ $> mv modules/ modules-old/ $> mv runtime/ runtime-old/ $> mv sdk/ sdk-old/ $> ln -s ~/.titanium-dev/modules modules $> ln -s ~/.titanium-dev/runtime runtime $> ln -s ~/.titanium-dev/sdk sdk
- Now relaunch Titanium Developer.
You’re now ready to build a project with PHP!
Click Create to generate a stub project. I’ll cover more about development with PHP in Titanium in the future, but let’s get started by showing a phpinfo() page.
index.html file in the Resources directory of your project and add the following anywhere in the page:
In the Resources folder, create the
phpinfo.php script and add the following to that script:
Now, go back to Titanium Developer, click the Test & Package tab for your project, then click the Launch tab. To build and run your application for testing, click the Launch App button.
You should now see a dark gray test page with the “See the phpinfo()” link you created. Click that link, and it should take you to the
phpinfo.php script you created with the proper
phpinfo() output. Congratulations!
Visit the Appcelerator Codestrong developer center for more information on building Titanium applications. Visit
#titanium_app on Freenode IRC to ask questions about application development. If you want to help develop the project and contribute PHP tests to it, join