n42 Designs

Custom Web Development

Compiling Mod_perl for Apache 2.4 on OS X 10.10 Yosemite

| Comments

TL;DR: You can run this handy script to compile mod_perl for your system.


OS X 10.10 Yosemite upgrades the default Apache install from 2.2 in Mavericks to 2.4. In general, this is a good thing, but if you were using mod_perl, perhaps for mod_cfml with Railo for example, then mod_perl will no longer work.

Recently, there have been several commits so mod_perl will now support Apache 2.4. Since there are no binary releases yet, we will have to compile it ourselves.

I have managed to do this with help from this StackOverflow post.

First you need the latest source from the Apache SVN repositories. They mirror it on git, but its missing some dependencies, so I found it easier to use SVN.

svn checkout https://svn.apache.org/repos/asf/perl/modperl/trunk/ mod_perl-2.0

Then switch into the new directory:

cd mod_perl-2.0

Next, we need to be sure we have XCode 6.1 installed and the command line tools installed as well:

xcode-select --install

Once, we have that, we need to tell the compiler where to find a few dependencies. You can find the reasoning behind this in the StackOverflow post mentioned above, but in general you run:

1
2
3
/usr/bin/apr-1-config --includedir /usr/include/apr-1
sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/apache2 /usr/include/apache2
sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/apr-1 /usr/include/apr-1

This will create a couple simlinks and tell the compiler where some Apache headers are located.

Almost done. Next, we compile it. We need to set a compiler option to tell it to build using the gnu89 standard, instead of clang’s default C99. (Thanks to this blog post for that little nugget!)

perl Makefile.PL MP_CCOPTS=-std=gnu89 ; make ; sudo make install

This will install mod_perl.so to /usr/libexec/mod_perl.so

Lastly, we need to tell Apache to load the newly compiled module and restart apache. Add this line to your /etc/apache2/httpd.conf file:

LoadModule perl_module libexec/apache2/mod_perl.so

Then restart apache:

1
2
sudo apachectl configtest
sudo apachectl restart

If all is well, you should have a working mod_perl module inside Apache 2.4.

ColdFusion 9 and Mod_jrun on Mac OS X Yosemite With Apache 2.4

| Comments

OS X Yosemite updates the included Apache HTTP server from 2.2 to 2.4. The ColdFusion 9 connector installs a version of mod_jrun which has been compiled for Apache 2.2. Using this article I was able to recompile the connector for Apache 2.4 and get ColdFusion 9 running with Apache 2.4. Here you will find a zipped version of the compiled connector so you can skip recompiling it yourself. Simply unzip and move the .so file to the desired location on your Mac and update your Apache configuration to point to it.

So:

LoadModule jrun_module /Applications/JRun4/lib/wsconfig/1/mod_jrun22.so

becomes

LoadModule jrun_module /Applications/JRun4/lib/wsconfig/1/mod_jrun24.so

You may find you need to update other Apache configuration settings. You can find additional information on upgrading from Apache 2.2 to 2.4 in the Apache HTTP Server Documentation.

Running ColdFusion 10 on OS X Mavericks

| Comments

Running ColdFusion 10 on OS X Mavericks is possible, but not straightforward. Unfortunately, it seems the web server connector does not work with Apache 2.2.24 which ships with Mavericks. A bug has been logged for this here: https://bugbase.adobe.com/index.cfm?event=bug&id=3653076. Please vote for it. There are a couple of issues I had with Mavericks and ColdFusion 10 (CF 9 works fine for me for what it is worth). First, ColdFusion wouldn’t start because Mavericks removed Java 6. I had to update 3 files to fix this:

/Applications/ColdFusion10/cfusion/bin/jvm.config /Applications/ColdFusion10/cfusion/bin/coldfusion /Applications/ColdFusion10/cfusion/runtime/bin/wsconfig_jvm.config

In each of these, there was a setting to set the Java home path. It was set to the old location for Java 6. I updated these to point to Java 7. For me this was:

/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home

This was after installing the latest Updater 45 JDK from Oracle’s website.

Once I made these changes ColdFusion started fine.

The next issue is with the Connector. Adobe created a customized version of mod_jk to go along with their customized version of Tomcat. Because of this, recompiling mod_jk is not going to work. We’ll have to wait for an updated version from Adobe. (EDIT: See Mike’s comment below for a solution!) Until then you can either use the built in web server or install MAMP PRO which ships with Apache 2.2.22 (same as Mountain Lion) and then configure using the web server connector.

I followed the recommendations in this blog post: http://www.brilang.com/2012/06/installing-coldfusion-10-under-mamp-pro-2-on-os-x-lion/1137 to configure MAMP PRO.

FarCry LESS Plugin

| Comments

Today I released a plugin for FarCry that will automatically compile your LESS files into CSS. No more need to compile on your development machine before you push to production, and no more need to punish your users by compiling on the client side with Less.js. While those solutions are perfectly acceptable, this plugin will let you simply code in LESS, then let FarCry do the work of serving compiled, minified CSS to your users.

The plugin uses a similar syntax to FarCry’s built in skin:loadCSS tag so it should be instantly familiar. Be sure to read the installation instructions to avoid a couple of potential “gotchas”.

Check it out on Github, and let me know if its useful for you, or if you would like to see any additional features.

Github Gist Renderer for BlogCFC

| Comments

I created a quick renderer for Github Gists for use within BlogCFC entries. You can see it in action right here. If interested just grab the code from the gist below and save it to /org/camden/blog/render/gist.cfc. You can then use

to include the gist in your entry. If you want to constrain the height you can use CSS like:

Here is an example of what the output looks like, using the Gist I created to hold the code for the renderer. Feel free to grab it for your own BlogCFC install.

FarCry YouTube Plugin

| Comments

One of our clients asked for better integration of their YouTube hosted videos on their FarCry website. They had been linking to the youtube.com URLs directly, leading traffic away from their website. Obviously, they would have preferred to keep those visitors on their site and engaged.

As some other clients have also expressed a desire to display YouTube videos on their sites, I decided to build the functionality as a FarCry plugin. This would allow me to move this feature set to any FarCry site.

At its foundation, the plugin works via two custom types and a scheduled task. The scheduled task runs and uses the YouTube API to grab the playlists and videos on the specified account (configurable via a FarCry config). If it finds those objects already in FarCry, it updates them with the latest data from YouTube, if its new, it adds it to the FarCry database. Any items found in FarCry that aren’t returned by the API are deleted. The plugin gives you the ability to reorder the videos on a playlist via the FarCry webtop. All data is managed on the YouTube side. I may consider adding the ability to completely manage the videos and playlists on the webtop, but that will greatly increase the complexity of the plugin, and I don’t see a great benefit to doing so. To me, it makes more sense to go straight to the source to upload new videos, manage your videos, etc rather than try to stuff all that functionality into a FarCry form. No need to reinvent the wheel, in my opinion.

The plugin also includes two rules. One lists videos based on selected playlists or videos, the other displays an embedded video.

To interact with the YouTube API, I made use of Raymond Camden’s awesome YouTube CFC.

I am happy to say that I have also posted this code on Github for the entire community to use. Give it a try! If you have any ideas for improvement please open a ticket, or better yet, fork the project and send me a pull request.

You can find the project on RIAForge and Github.

FarCry Poll Plugin

| Comments

I have released a plugin I have had for a while. I’m not sure why I never got around to releasing it. Its a very simple FarCry plugin that gives you the ability to create a one question poll and display it on the site. It uses a couple content types and a rule.

To install, copy the files to /farcry/plugins/spcPoll and add spcPoll to your this.plugins setting in your FarCry constructor. Deploy the content types in the COAPI manager and restart the application. You can now create a question, assign answers to it, and deploy that question using the “Poll: Display Poll” rule.

You can grab the code on Binpress or Github.

Let me know what you think!