I've never done this but I seem to recall that there is some kind of PHPizing that needs to be done to make an object work with PHP.
Look in your PHP source directory for a README.SELF-CONTAINED-EXTENSIONS and README.EXT_SKEL. I believe that these will help with what you are doing.