Alex-Grim Posted December 14, 2007 Share Posted December 14, 2007 I am trying to write my first OOP script, and i know that it's messed up, but it's not giving me any errors, or any output. I have turned on the error_reporting to E_STRICT in my php.ini file and restarted apache, but it has made no difference... Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted December 14, 2007 Share Posted December 14, 2007 must be a parse error also turn on display_errors setting in php.ini file Quote Link to comment Share on other sites More sharing options...
Alex-Grim Posted December 14, 2007 Author Share Posted December 14, 2007 Here's my code in the first file: <?php $br = "<br/><br/>"; $e = "<h1>ErRoR</h1>"; $myfile = "/includes/classes/MySql.php"; readfile($myfile) OR die("<h1>ErRoR! Content not available!</h1>"); include_once $myfile or die($e); echo "Page Loaded, and MySql.php included. $br"; ?> dfffffffffggsdfgsdfgsdfg And the result in the first error message, but i'm sure the path is right... Quote Link to comment Share on other sites More sharing options...
Alex-Grim Posted December 14, 2007 Author Share Posted December 14, 2007 yeah, i turned on the display_errors and restarted apache, and i still get no errors, other than the ones i use in my script. I've also tried screwing up the code on purpose, and still, nothing. Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted December 14, 2007 Share Posted December 14, 2007 try this <?php $br = "<br/><br/>"; $e = "<h1>ErRoR</h1>"; $myfile = "/includes/classes/MySql.php"; if (file_exists($myfile)) { include_once($myfile); echo "Page Loaded, and MySql.php included. $br"; } else { echo ($e."<h1>ErRoR! Content not available!</h1>"); } ?> dfffffffffggsdfgsdfgsdfg Quote Link to comment Share on other sites More sharing options...
Alex-Grim Posted December 14, 2007 Author Share Posted December 14, 2007 I meant to include this: display_errors On On display_startup_errors Off Off doc_root no value no value docref_ext no value no value docref_root no value no value enable_dl On On error_append_string no value no value error_log no value no value error_prepend_string no value no value error_reporting 2048 2048 Quote Link to comment Share on other sites More sharing options...
Alex-Grim Posted December 14, 2007 Author Share Posted December 14, 2007 I could be completely overlooking something in the path (i've been up for 2 days working on a flash website, now this). Here's a screenshot of Gedit, you can see the path in the top, and the file name in the tab -- wel, you know what the hell you're looking at, duh (i keep forgetting i'm talking to OTHER LINUX/Unix users for a change). http://phpbuilder.com/board/attachment.php?attachmentid=3357&d=1197629225 ===Edit=== I meant to add, AlexGrim is the root web folder, so the path is relative to that. One thing i want to ask is, do i have to have my includes folder listed in my includes path (if there is such a thing, which i'm sure there is). This can't be the problem though, because it's saying the file cannot be found even by the readfile() method. I use readfile() for my other site (LinuxIntro.com) to load the content into the Index (only) page, and i don't have anything listed in my include path. Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted December 14, 2007 Share Posted December 14, 2007 this $myfile = "/includes/classes/MySql.php"; should be $myfile = "includes/classes/MySql.php"; notice I removed one slash that assuming the script runs from the root folder Quote Link to comment Share on other sites More sharing options...
Alex-Grim Posted December 14, 2007 Author Share Posted December 14, 2007 The funny thing is, the leading slash is the shorthand way of saying "webroot", and works for everything else in a website (css, html, javascript, etc), but that got past one error after removing it, thatnx. The next problem is that i'm still not loading the page, and now it stops executing after the readfile() method. Here's the madification i made to the code: if (file_exists($myfile)) { echo "The file DOES exist. $br"; include_once($myfile); echo "Page Loaded, and MySql.php included. $br"; } I get the first echo, and nothing else after that. Quote Link to comment Share on other sites More sharing options...
Alex-Grim Posted December 14, 2007 Author Share Posted December 14, 2007 Disregard that last comment. The cause was that there were errors in the second file, so it couldn't load it , but that brings me back to the reason i started this thread: why am i not getting any errors.... Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted December 14, 2007 Share Posted December 14, 2007 your error reporting should in php.ini file should be error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted December 14, 2007 Share Posted December 14, 2007 When learning php, developing php code, or debugging php code, you should not disable NOTICE messages. Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted December 14, 2007 Share Posted December 14, 2007 Yeah that was actually just a copy paste from my production server.... 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.