ecroskey Posted October 20, 2006 Share Posted October 20, 2006 Hey gang, I have two different servers running, one using RedHat ES 3 and the other using RedHat ES 4. I have been using the following script in many different flavors for the past four years on my RH ES3 box and it works flawlessly every time. I am trying to use it on the ES4 box and when I include this particular piece of code, it tanks the page. Nothing gets displayed. Any ideas?[code] $OrdDir="/var/www/telesoc/moreinfo"; $DBAtype="dat"; $ORDtype="tscat"; $odate = date("Ymd"); $adcode = "tsc"; srand ((double) microtime() * 1000000); $random = (rand());$wfileP1 = "Request For Category Info:Date = $odateFirst Name = $_POST['fname']Last Name = $_POST['lname']Email Address = $_POST['email']Category = $_POST['cats']Drop Code = $adcode"; $file=$OrdDir."/".$odate.".".$ORDtype."_".$random.".".$DBAtype; $f=fopen($file,'w'); fwrite($f,$wfileP1); fclose($f);[/code]My version of php is 4.3.9 and my version of Apache is Apache/2.0.52 (Red Hat) Quote Link to comment Share on other sites More sharing options...
obsidian Posted October 20, 2006 Share Posted October 20, 2006 are your folder and file permissions on your new box set in such a way as to allow your apache user (server) write access? Quote Link to comment Share on other sites More sharing options...
ecroskey Posted October 20, 2006 Author Share Posted October 20, 2006 Yup. The folder is 777. Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted October 20, 2006 Share Posted October 20, 2006 Are you sure it's crashing on the call to fopen and not before? Quote Link to comment Share on other sites More sharing options...
ecroskey Posted October 20, 2006 Author Share Posted October 20, 2006 Yup. If I take this chunk out (top of file) the page will be displayed correctly, it shoots out two emails and the world is good. But as soon as I put this chunk in, with or without it's own php tags, it gets goofy. Nothing displays, no emails, nothing. Quote Link to comment Share on other sites More sharing options...
obsidian Posted October 20, 2006 Share Posted October 20, 2006 why not throw some error checking onto there and see where it's dying:[code]<?php$file=$OrdDir."/".$odate.".".$ORDtype."_".$random.".".$DBAtype;if (is_writable($file)) { if (!$f=fopen($file,'w')) { echo "Can't open file!"; } else { if (fwrite($f,$wfileP1) === FALSE) { echo "Couldn't write to file!"; } else { echo "File written successfully!"; } fclose($f); }} else { echo "File is not writable!";}?>[/code]this way, you can tell exactly where it's erroring out Quote Link to comment Share on other sites More sharing options...
ecroskey Posted October 23, 2006 Author Share Posted October 23, 2006 Same thing. It doesn't show me any of the errors. Back to a white screen. Quote Link to comment Share on other sites More sharing options...
obsidian Posted October 23, 2006 Share Posted October 23, 2006 [quote author=ecroskey link=topic=112150.msg456348#msg456348 date=1161616494]Same thing. It doesn't show me any of the errors. Back to a white screen.[/quote]Is this an included file? If so, my guess is that you have syntax errors or another issue somewhere in the parent structure. I say this because, even if the code posted above was working, you'd see something on the screen ("File written successfully"). So, since you're not seeing anything at all, there are deeper issues than your fopen(). 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.