Fruddy Posted March 30, 2007 Share Posted March 30, 2007 I get this error: Fatal error: Call to undefined function: business_header() in /home/n/e/sv_newcomedynet/test.php on line 4 When i try to run this script: <? include('http://www.newcomedy.net/fns/output_fns.php'); business_header(); ?> The function: <? function business_header() { ?> <body bgcolor="black"> <table border="0" cellspacing="0" cellpadding="0" align="center"> <tr> <td width="898" height="186" background="http://www.newcomedy.net/imgs/business_top.gif"> </td> </tr> </table> <? }; ?> I cant figure out what is wrong :/ Quote Link to comment https://forums.phpfreaks.com/topic/44966-call-to-undefined-function/ Share on other sites More sharing options...
kenrbnsn Posted March 30, 2007 Share Posted March 30, 2007 Do not use the full URL when including a local file, use the local file path: <?php include('fns/output_fns.php'); business_header(); ?> The same with the path of your image, use the relative path, so if you change hosts, it will still work: <?php function business_header() { ?> <body bgcolor="black"> <table border="0" cellspacing="0" cellpadding="0" align="center"> <tr> <td width="898" height="186" background="imgs/business_top.gif"> </td> </tr> </table> <? }; ?> Ken Quote Link to comment https://forums.phpfreaks.com/topic/44966-call-to-undefined-function/#findComment-218306 Share on other sites More sharing options...
gudmunson Posted March 30, 2007 Share Posted March 30, 2007 When I include stuff, I don't use the http part. Not sure if that's a valid type for including. I use an absolute site path: require_once('/includes/db/connect.php'); You could try stripping the http://sitename out and just put in the absolute path (from root-/) Quote Link to comment https://forums.phpfreaks.com/topic/44966-call-to-undefined-function/#findComment-218307 Share on other sites More sharing options...
Barand Posted March 30, 2007 Share Posted March 30, 2007 The last sentence may explain it (from PHP manual - include) If "URL fopen wrappers" are enabled in PHP (which they are in the default configuration), you can specify the file to be included using a URL (via HTTP or other supported wrapper - see Appendix L for a list of protocols) instead of a local pathname. If the target server interprets the target file as PHP code, variables may be passed to the included file using a URL request string as used with HTTP GET. This is not strictly speaking the same thing as including the file and having it inherit the parent file's variable scope; the script is actually being run on the remote server and the result is then being included into the local script. Quote Link to comment https://forums.phpfreaks.com/topic/44966-call-to-undefined-function/#findComment-218310 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.