vantheman Posted December 6, 2008 Share Posted December 6, 2008 Hello, I'm experiencing a problem with a php page on a website. The page is coming up blank & I've searched and searched for the problemn but can't seem to find the cause. Here's the code: --------------------------------------------------------------- <?php require_once('/includes/getid3/getid3.php'); require_once('/includes/code/functions.php'); $DAYS_TO_DOWNLOAD = 1; $CanRate = 1; $CanDownload = 1; $dtret = GetUsersFirstTimeRated('2008_01_14'); if ($dtret != "") { #User has rated before $CanRate = 0; $days = (strtotime(date("m/d/Y H:i:s")) - strtotime($dtret)) / (60 * 60 * 24); if ($days >= $DAYS_TO_DOWNLOAD) { $CanDownload = 0; } } ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Weeks Available</title> <style type="text/css"> <!-- body { background-color: #FF0000; background-image: url(/includes/images/bg_temp.jpg); } .style4 {font-size: large} a:link { color: #FF0000; } a:visited { color: #FF0000; } a:hover { color: #CCCCCC; } .style5 {font-size: medium} .style6 {color: #FFFFFF} .class1 A:link {color: #FFFFFF} .class1 A:visited {color: #FFFFFF} .class1 A:active {color: #FFFFFF} .class1 A:hover {text-decoration: underline; color: red;} --> </style></head> <body> <table width="500" height="379" border="3" align="center" bordercolor="#000000"> <tr> <td bordercolor="#FF0000" background="/includes/images/bg2_temp.jpg"> <div align="right"><span class="style5"><span class="class1"><a href="SearchFiles.php">Search for Artist</a></span></span> </div> <BR> <div align="center"><span class="style2"><span class="style4"> <?php #Get list of folders starting with 2(weekly folders) @$d = dir("."); if ($d) { while($entry=$d->read()) { if ($entry[0] == "2") { $items[] = $entry; } } $d->close(); sort($items); } $i = sizeof($items)-1; while ($i >= 0) { $dirname = $items[$i]; print "<a href='DisplayFiles.php?wk=" . $dirname . "'>" . GetWeekFromDirectory($dirname) . "</a><br><BR>\n"; $i--; } # for($i=0; $i<sizeof($items); $i++) { # $dirname = $items[$i]; # print "<a href='DisplayFiles.php?wk=" . $dirname . "'>" . GetWeekFromDirectory($dirname) . "</a><br><BR>\n"; # # } ?> </span></div></td> </tr> </table> <!--<a href="/logout.htm">Logout</a>--> <?php echo "<BR> $CanRate : $CanDownload"; ?> </body> </html> --------------------------------------------------------------- Can anyone help please? Thanks in advance Van Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted December 6, 2008 Share Posted December 6, 2008 Add the following two lines immediately after your first opening <?php tag to get php to help you - ini_set ("display_errors", "1"); error_reporting(E_ALL); Do your actually have a folder in the root of the current hard disk called includes? That is what the leading slash / in a file system path in a require/include statement means. This does not have the same meaning as a leading slash / in a URL. Quote Link to comment Share on other sites More sharing options...
vantheman Posted December 6, 2008 Author Share Posted December 6, 2008 Yes the is an "include" folder at the root. I inserted the code that you gave me, uploaded and here's what is displaying: Warning: main() [function.main]: open_basedir restriction in effect. File(/includes/getid3/getid3.php) is not within the allowed path(s): (/var/www/vhosts/nervedjsemf.com/httpdocs:/tmp) in /var/www/vhosts/nervedjsemf.com/httpdocs/secure/DisplayWeeksTest.php on line 4 Warning: main(/includes/getid3/getid3.php) [function.main]: failed to open stream: Operation not permitted in /var/www/vhosts/nervedjsemf.com/httpdocs/secure/DisplayWeeksTest.php on line 4 Fatal error: main() [function.require]: Failed opening required '/includes/getid3/getid3.php' (include_path='.:') in /var/www/vhosts/nervedjsemf.com/httpdocs/secure/DisplayWeeksTest.php on line 4 Thanks for your quick response. Quote Link to comment Share on other sites More sharing options...
mrMarcus Posted December 6, 2008 Share Posted December 6, 2008 for the third error, beginning an included/required path with '/' dictates to the server that it's an absolute path back to the root of the filesystem .. the root to your file system is: /var/www/vhosts/nervedjsemf.com/httpdocs/ .. includes is considered in your webserver directory, so to call for that you would have to use a relative path as follows: require_once('./includes/filename.php'); you can by all means use absolute paths when including files, they just tend to be longer and make switching servers a pain since you might have to update all your absolute paths .. an absolute path in this case would be: require_once('/var/www/vhosts/nervedjsemf.com/httpdocs/secure/includes/filename.php'); that's the 3rd error anyways .. i believe. Quote Link to comment Share on other sites More sharing options...
vantheman Posted December 6, 2008 Author Share Posted December 6, 2008 I forgot to point out that, the php file with the code, resides inside the "secure" folder. The "includes" folder that this php file calls, resides 1 level up, inside the httpdocs folder. With that being said, how should the relative statement be typed? Quote Link to comment Share on other sites More sharing options...
mrMarcus Posted December 6, 2008 Share Posted December 6, 2008 I forgot to point out that, the php file with the code, resides inside the "secure" folder. The "includes" folder that this php file calls, resides 1 level up, inside the httpdocs folder. With that being said, how should the relative statement be typed? usually the parent directory in reference to a webserver structure is something along the lines of 'public_html', or 'htdocs'. i see you have 'htdocs', so do your require_once('./includes/filename.php'); the absolute path would be require_once('/var/www/vhosts/nervedjsemf.com/httpdocs/includes/filename.php'); basically, htdocs in your case is the directory in which the physical aspect of your site resides. it does not need to be referenced to in relative paths. Quote Link to comment 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.