Koozali.org: home of the SME Server

Problem with a PHP include (Gallery)

djhomeless

Problem with a PHP include (Gallery)
« on: April 30, 2005, 01:02:37 AM »
Hi Everyone,
I'm pulling my hair out over a fairly basic (so it seems) include.

One of my sites is using Gallery 2, in combination with a blogging tool (WordPress). All I'm trying to do is show a random image in WP which is failing.

Basically, the failure seems to be environmental. For example, if I try to execute the code as stated by the Gallery2 docs, it fails.
Code: [Select]

<?php readfile&#40;'http&#58;//idiotabroad.com/photos/main.php?g2_view=imageblock&#58;External&g2_blocks=randomImage&g2_show=title'&#41;; ?>


The error is:
Code: [Select]

Warning: readfile(http://idiotabroad.com/photos/main.php?g2_view=imageblock:External&g2_blocks=randomImage&g2_show=title): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found in /home/e-smith/files/ibays/blog/html/foo.php on line 2


Now the interesting part is, if I replace the hostname, with the local IP (127.0.0.1), the function at least executes, but the image doesn't stream.
Code: [Select]

<?php readfile&#40;'http&#58;//127.0.0.1/blog/photos/main.php?g2_view=imageblock&#58;External&g2_blocks=randomImage&g2_show=title'&#41;; ?>

I'm really lost here. Has anyone run into this problem with PHP on SME before??

Thanks all,

Geoffrey

djhomeless

Problem with a PHP include (Gallery)
« Reply #1 on: April 30, 2005, 10:03:49 AM »
I'm sure this is simple setup problem, but I don't know enough to figure it out.

Basically, if I change the code to reference the internal lan hostname, the code and image executes properly (since my client pc is on the internal lan).
Code: [Select]

<?php readfile&#40;'http&#58;//hostname/ibayname/photos/main.php?g2_view=imageblock&#58;External&g2_blocks=randomImage&g2_show=title'&#41;; ?>


Of course this won't work externally, but it begs the question:

Why do I get a 404 if I try to execute the include using the hostname? Is PHP not able to resolve the domain?

I'm really confused here. Any help would be appreciated!

Thanks,

Geoffrey