Debbie-Leigh Posted January 27, 2008 Share Posted January 27, 2008 Hi, My websites have just been moved to a PHP 5/MySql 5 server, which has caused some of my code to stop working. With file and file_get_contents, I get a message saying that the file couldn't be found, using this code: $aRet = file("http://myothersubdomain/path/to/file/file.php") The file definitely exists and can be called from my browser, but file doesn't seem to be able to find it under php5. With include, I have a file that I include into a script and the file also has an include within it. The file itself is included, but the include within the file is not. It seems to be executed, but nothing replaces it. The first file is: <html> <head> <title>Download Login</title> <meta name="Keywords" content="download,login" /> <meta name="Description" content="Download Login" /> <meta http-equiv="robots" content="noindex, nofollow" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Language" content="en-us" /> <link href="http://myothersubdomain/path/to/file/css.php" rel="stylesheet" type="text/css" /> <script language="JavaScript1.2" type="text/javascript" src="js/constants.js.php"></script> </head> <body background="http://myothersubdomain/images/bg.jpg"> <table width="750" align="center" valign="top" cellpadding="0" cellspacing="0" class="page-border"> <tr><td align="center"> <img name="imghdr" src="http://myothersubdomain/images/hdr.gif" width="750" height="100" border="0" /> <table width="100%" align="center" valign="top" border="0" cellpadding="10" cellspacing="0" class="bg-page"> <tr><td valign=top> <h1>Download Login</h1> <?php $booShowFieldset = TRUE; ?><?php include("http://myotherdomain/path/to/file/myfile.htm"); ?> </td></tr></table> <?php include("http://myothersubdomain/path/to/file/myfile2.htm"); ?> </td></tr></table> </body> </html> The code that executes it is: $strEvalFilename = "/home/path/to/file/myincludefile.php"; ob_start(); include($strEvalFilename); $strEvalText = ob_get_clean(); The result is: <html> <head> <title>Download Login</title> <meta name="Keywords" content="download,login" /> <meta name="Description" content="Download Login" /> <meta http-equiv="robots" content="noindex, nofollow" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Language" content="en-us" /> <link href="http://myothersubdomain/path/to/file/css.php" rel="stylesheet" type="text/css" /> <script language="JavaScript1.2" type="text/javascript" src="js/constants.js.php"></script> </head> <body background="http://myothersubdomain/images/dpp-bg.jpg"> <table width="750" align="center" valign="top" cellpadding="0" cellspacing="0" class="page-border"> <tr><td align="center"> <img name="imghdr" src="http://myothersubdomain/images/hdr.gif" width="750" height="100" border="0" /> <table width="100%" align="center" valign="top" border="0" cellpadding="10" cellspacing="0" class="bg-page"> <tr><td valign=top> <h1>Download Login</h1> </td></tr></table> </td></tr></table> </body> </html> Could anyone tell me whether these statements have changed in the way they operate in php5 that would cause this behaviour and what I can do to fix it? All 3 statements have worked fine in php4 and nothing changed code-wise before or after the migration to php5. Debbie Quote Link to comment https://forums.phpfreaks.com/topic/88074-problem-with-file-file_get_contents-and-include-in-php-5/ Share on other sites More sharing options...
phpSensei Posted January 27, 2008 Share Posted January 27, 2008 edit: nvm, sorry. Quote Link to comment https://forums.phpfreaks.com/topic/88074-problem-with-file-file_get_contents-and-include-in-php-5/#findComment-450591 Share on other sites More sharing options...
Debbie-Leigh Posted February 6, 2008 Author Share Posted February 6, 2008 Hi, FYI, for anyone with a similar problem. I solved this problem by asking my hoster to switch allow_url_include on and everything is working again. Debbie Quote Link to comment https://forums.phpfreaks.com/topic/88074-problem-with-file-file_get_contents-and-include-in-php-5/#findComment-459301 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.