Wednesday, February 17, 2010

accounting...and php

Links: IonCube loader instructions

Thought I'd try that Nola Pro software and see what it's all about to put something enterprise level on a localhost, or what kind of security holes it opens. Blah blah blah. Along the way, I fell prey to a php problem I was embarrassed to have overlooked, and got to try-out the IonCube code obfuscator w/associated configuration challenges.

Figure 1

Ion Cube's product is a code obsfucator, one that makes it nearly impossible for visitors to determine the underlying code of a website's pages, sort of like Zend. NolaPro requires the IonCube loader as a prerequisite for NolaPro's installation. The IonCube loader is free, the complete IonCube package is not. This business model reminded me of the early PDF era when a free Adobe Reader was provided to read PDF files, but Adobe required that Acrobat be purchased, at a significant price, to produce them. At any rate, I navigated to Ion Cube's main site, then to "Products->Free Loaders for Encoded Files" and downloaded the latest .tgz. Instructions were to untar it and move its entire folder into /var/www/htdocs. The folder appeared to contain a group of libraries.

To install NolaPro itself, I untarred the NolaPro .tgz in my home directory. From there, the instructions were to move the entire folder into /var/www/htdocs. It also suggested full "777" permissions on this folder, which I don't like to do. I made sure Apache was on and pointed my browser to http://localhost/nolapro. From there NolaPro's installer displayed the necessary php.ini settings. Here's a summary of its php complaints.

Figure 2

I thought that mbstring was properly configured in my php.ini, so that was weird, along with the gd thing. It seemed an odd diagnostic at first....

php embarrassment
A check with http://localhost/phpinfo.php soon solved one problem. How could I have overlooked it not loading my php.ini file? Idiot.
Figure 3
I remedied this problem by copying php.ini to /usr/local/lib/php.ini. But, about this time, I also recalled I had initially installed php v.5.28 on my system, and had subsequently upgraded to 5.3. Although it can't be seen in the the photo clip above, http://localhost/phpinfo.php noted version 5.3 was what Apache was reporting. However checking $ php -v yielded the following:
PHP 5.2.8 (cli) (built: Jan 9 2009 16:26:32)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
Nice -- a mixed-up set of installations. Additionally, when I compiled the module last year, I apparently overlooked gd and mbstring support:
'./configure' '--with-apxs2=/usr/sbin/apxs' '--with-pgsql=/usr/local' '--with-mysql=/usr/share' '--with-libxml-dir=/usr/lib' '--with-curl=/usr/bin/curl' '--with-zlib' '--with-gettext' '--with-gdbm' '--enable-inline-optimization' '--enable-track-vars'

Accordingly I went back to my php source folder, did a $ make clean and reconfigured, made, and #made installed the php module. This time, used all of the above and added --with-gd --enable-mbstring into the configure command. Success.

more IonCube
With the php problems resolved, NolaPro was ready to install except for the IonCube loader (Figure 2). IonCube provides a diagnostic script, ioncube-loader-helper.php , but this was displaying a blank page when I attempted to load it. I then copied the IonCube folder to both the nolapro folder and the htdocs folder as possible solution. No change. In the end, ensuring I had loader files corresponding to my processor was the answer. I thought I could run loader files that that noted 64-bit processing on my 32-bit system, and that these loader files would be back-compatible. They weren't. Once I dropped to the 32-bit version, ioncube-loader-helper.php displayed a successful test screen. Just to be certain, I also updated /usr/local/lib/php.ini with

zend_extension = /var/www/htdocs/ioncube/ioncube_loader_lin_5.3.so

I used loader 5.3 which corresponded to my php release; others should change it to the loader for their php release.

snagware
NolaPro was finally ready to install and did so routinely. At first look, NolaPro seems pleasing. It also appears to be a foot in the door to lure users into purchasing premium add-ons. If that's right, it's not freeware, but more like crippleware. I'll take a closer look over the coming week. It was a good experience insofar as I gained additional experience with php and IonCube configurations.

No comments: