SOLVED!
When I was compiling PHP I had a lot of problems with compiler errors.. upon looking at the code, I found conditional #defines that were not defined properly, such as HAVE_LIBGD15 .. it wasn't set, although it compiled the gd library in another branch of the source tree.
What I ended up doing was modifying the config_vars.mk file in the main PHP source directory, and after the CPPFLAGS statement I added the necessary defines..
For the problem I mentioned above, I had to define HAVE_LIBDL, by adding -DHAVE_LIBDL after the aforementioned CPPFLAGS option in the config_vars.mk file.
For some reason, configure wasn't configuring everything properly .. I've never used autoconf myself so I guess I'll just have to stick with my workaround.
Note: I edited config_vars.mk AFTER running configure.