Include function php

software development

#1

hi iam having troubles with my forum punbb.
i tried to include the extern.php to show the last 10 post made. but im having error in including the file and im very confident that its bec of the way my php was install on my server.

this is the error ive got

Warning: main(extern.php?action=active) [function.main]: failed to open stream: No such file or directory in /home/.shamrock/myusername/mywebsite.com/forum/header.php on line 219

Warning: main(extern.php?action=active) [function.main]: failed to open stream: No such file or directory in /home/.shamrock/myusername/mywebsite.com/forum/header.php on line 219

Warning: main() [function.include]: Failed opening ‘extern.php?action=active’ for inclusion (include_path=’.:/usr/local/lib/php’) in /home/.shamrock/myusername/mywebsite.com/forum/header.php on line 219


#2

I am not sure that you can pass the action value in the file path. I’ve never heard of doing that before, but I don’t have a very good understanding of files in Linux so I guess there it is possible that it would work, but I would still try it without and see if just ‘extern.php’ works instead.


#3

it still not work. even with extern.php only.


#4

?action=active is handled by apache, but when you do an include() in php, especially with allow_url_fopen disabled, you’re not using apache. if $_GET[‘action’] isn’t already set to active, but the included script needs it to be, just set it before including the script, and leave off the ?action=active.

track7 - my dream-hosted site


#5

Indirectly, you may have to call up a stored mySQL entry just to pass whatever you need to pass into the external code.

But I don’t think you need to do it–as long as the the fuctions in the external code has some form of variable passing in its call, it’ll pick it up when called and a simple ‘include (“external.php”);’ statement added.