Archive for the 'PHP' Category

by mkeefe on Aug 31st, 2008

Flash and PHP Bible now available for Kindle

I was informed by a friend that my Flash and PHP Bible is available on Amazon as a kindle e-book. It’s actually pretty cool to see that, I think the ability to search and bookmark on the kindle makes it a perfect option for technical book readers.

Here is the direct link to the kindle version:
http://bit.ly/1AHKj

Here is the paper version:
http://bit.ly/26aL1H

by mkeefe on Jul 3rd, 2008

When semi-random bugs attack

I have been working on a large Flex project for a while now which has been a ton of fun. The core of the application is built in Flex with a class to manage remote calling to PHP files. This is basically how the data comes and goes through the application.

While testing and developing it locally I continuously ran small tests to ensure all the data was working properly and everything was. I decide to upload a build to my online environment for the client to check out and all of a sudden the Remoting classes were returning the same error:

Client.Error.DeliveryInDoubt
Message: Channel disconnected
Detail: Channel disconnected before an acknowledgement was received

This is usually caused by a syntax error in the PHP, but it worked locally.

Charles to the rescue (again)
I opened up Charles and started looking at the response from PHP, to which I found the following:

Fatal error: Uncaught exception 'VerboseException' with message 'file_exists(): open_basedir restriction in effect. File(/models/Debug.php) is not within the allowed path(s): (/tmp)' in /PATH_REMOVED/amfphp/core/amf/io/AMFBaseDeserializer.php:380

That is saying the file can’t be loaded from the root of the server.. well obviously, but the question is, why is AMFPHP looking for it there at all?

After talking to some friends and looking around the AMFPHP files I came across a function within the “globals.php” file.

setClassMappingsPath();

This allows you to set the path, which I did, but for some reason it was still failing. After some more time spent troubleshooting I found the function definition which can be found in “amfphp/core/amf/app/Gateway.php”.

function setClassMappingsPath($value) {
$path = realpath($value . '/') . '/';
$GLOBALS['amfphp']['customMappingsPath'] = $path;
};

The realpath() function seems to be the culprit. I am not saying this is an AMFPHP error, it could be a configuration error on this web server, which I will investigate further once the project is complete.

All I did to fix the error was comment out the realpath() check and set $path = $value. That stopped the incorrect loading of the class files and “magically” my Flex application started working properly once again.

When Errors are Good
The errors in this case were not all that helpful at first, but after looking into the code they really did paint a picture. The “Delivery in doubt” error that Flex throws will prove to be your best friend if you wind up with syntax or file errors within PHP.

by mkeefe on May 2nd, 2008

SWFBlog in an alpha state

Earlier last night I developed (in about 2 hours) the prototype of a Flash-based WordPress theme. The concept is not entirely original, but I still was intrigued to create my own. I have a lot of distance to go and not sure when exactly I will be working on it, but for now here is the start.

I have a couple of tricks up my sleeve which I will talk about at a later release, but lets just say I am thinking in a “modular” way. ;)

Here is the application:
http://scriptplayground.com/swfblog/

Next »