Seriously frustrated with Drupal 5.x giving me blank pages. I've searched the web for answers and have tried the usual fixes. By that I mean:

* Adding to .htaccess

<FilesMatch "\.(php|html?)$">
php_value memory_limit 32000000
</FilesMatch>

* Adding to settings.php

ini_set("memory_limit", "32M");
ini_set('display_errors', TRUE);

*Adding to the start of index.php

ini_set("memory_limit", "32M");
ini_set('display_errors', TRUE);

None of them work, even if all 3 are in place. No error ever shows up (like I'm used to or expected with Perl's Carp).

I get blank pages during the following actions:

- Logging in (submit and index.php?q=node&destination=node gives blank page).
- Logging out (click logout and index.php?q=logout gives blank page)
- Several admin actions here and there (site info, changing blocks etc) but not all of them.
- Submitting content.

In all the above cases, the content or action is submitted: a back-page or refresh will show the intended result or submit the data twice. In the case of modifying admin settings, Drupal actually shows "Configuration saved" twice.

Is this a memory issue or a redirect issue? Thus far I have been unable to locate any log on Drupal that clearly indicates the problem. I do not have access to server error logs (only access logs). In addition I don't have access to php.ini and I'm on an IIS6.0 webhosting server.

Is Drupal 5.x incompatible with IIS6?

I read somewhere that it could be due to whitespaces in some php files. But I use Crimson Editor which auto-strips trailing spaces and I've also independently verified some suspect files like styles.css, etc and there were no offending trailing spaces.

Any help will be greatly appreciated! I actually moved from Joomla to Drupal, but didn't expect this much difficulty.

Comments

vm’s picture

Doesn't make sense that you wouldn't have a php.ini file, as this has nothing to do with IIS6 and everything to do with PHP ?

There are quite a few threads about IIS6 using search. I use apache, so I can't be of any specific help.

phpninja’s picture

Hi, it's not that I don't have a php.ini file, but as a paid webhost, I don't have access to it. It's not a machine I can sit infront of and browse the filesystem using Windows Explorer or edit php.ini with notepad.

My only access to the server is FTP. The virtual filespace is limited to just "www" on the IIS server.

vm’s picture

I dont specifically have access to my php.ini either, thus i use a small snippet of PHP to grab the php.ini file from its folder and save it to my root, then i changed it from there. You will have to alter the snippet as necessary to grab your php.ini as it may be stored in a completely different folder then mine was.

You may want to ask your host for a copy provided they allow you to use a custom php.ini file if the snippet does not work for you.

The snippet I use is below.

You may want to use a custom php.ini file in order to change some of the host defaults.   For example, you may want to turn register_globals = off.   If you copy the default host file, make changes, and then put it in your webspace, you may not know if your host makes further changes to the default file which could cause your file to be out-of-date.  A good solution is the following script, which you can execute manually or kick-off with cron each night.  The script reads the host default file, makes your changes, and writes it to your directory.  Now you can always have the current host default php.ini file with your changes made. 

Note - you may have to change the file/directory paths in the examples below to match your hosting environment. 

- - Start Script Here - -
<?php 
// Put all the php.ini parameters you want to change below. One per line. 
// Follow the example format $parm[] = "parameter = value"; 
$parm[] = "register_globals = Off"; 
$parm[] = "session.use_trans_sid = 0"; 
// full unix path - location of the default php.ini file at your host 
// you can determine the location of the default file using phpinfo() 
$defaultPath = '/usr/local/lib/php.ini';  
// full unix path - location where you want your custom php.ini file 
$customPath = "/home/user/public_html/php.ini"; 
// nothing should change below this line. 
if (file_exists($defaultPath)) { 
  $contents = file_get_contents($defaultPath);  
  $contents .= "\n\n; USER MODIFIED PARAMETERS FOLLOW\n\n";   
  foreach ($parm as $value) $contents .= $value . " \n"; 
  $handle = fopen($customPath, 'w');  
  if (fwrite($handle, $contents)) {  
    fclose($handle); 
    if (chmod($customPath,0600)) $message = "The php.ini file has been modified and copied"; 
      else $message = "Processing error - php.ini chmod failed"; 
  } else { 
    $message = "Processing error - php.ini write failed"; 
  } 
} else { 
  $message = "Processing error - php.ini file not found"; 
} 
echo $message; 
?>  
- - End Script Here - - 

You may want to change other things in php.ini as well.  You can do this by repeating the $parm[] statement for as many changes as you wish to make.

For example you may want to use your own temp directory for session files.   To do this add the following line:
$parm[] = "session.save_path = /home/user/temp";   // user specified temp session file directory 
Note the sessions directory is above the public directory for added security.

You may want to use your own temp upload directory for improved security.   To do this add the following line:
$parm[] = "upload_tmp_dir = /home/user/temp";   // user specified temp upload directory 
Note the uploads directory is above the public directory for added security.

If you want to change the maximum file upload size to something larger than 2MB, add the following:
$parm[] = "upload_max_filesize = 4M";   // user specified max file upload size 

And if you want to go larger than 8MB, also add the folowing:
$parm[] = "post_max_size = 10M";   // user specified post max size 
--------------------------------------------------------------------------------
The above script does a chmod 600 on the custom php.ini file which should adequately protect it from prying eyes. 
--------------------------------------------------------------------------------
An alterative to using a custom php.ini file is to use the php function ini_set() in your scripts to modify the default php parameter values.   This is probably the best solution for custom scripts, but not practical if you use applications which you do not know how to modify.
phpninja’s picture

Hi, thanks for the custom php.ini script. However, as you say, using the php function ini_set() is an alternative to this, however, it does appear that inserting ini_set() code into settings.php doesn't seem to have any beneficial effect on my problem.

Mojah’s picture

Sounds like a server related issue.

Check with your host if they recently upgraded their Zend optimizer engine or installed eAccelerator. I was struggling with white screens for a few days, until I realised that certain combinations of the Zend optimzation engine + eAccelerator (a php compiled code cache) did not work well together.

Maybe try installing on a different server. You can do a XAMPP or WAMP installation on your local machine and play around with Drupal 5 to confirm that it is indeed a server setup issue.

I'm on an Apache VPS and cannot provide much assistance with IIS6 issues. May I ask why you host on a Windows server?

phpninja’s picture

I actually setup Drupal 5 on a test machine which is W2K+IIS5, and that was ok except it gave me the known "login won't take" problem, which i fixed with the GLOBALS['tempuser'] fix. No issues with white pages. Surprisingly, on my test machine, php settings are at default, there isn't even a memory_limit variable set for php (5.1.4), yet no white pages.

Moving on, installing Drupal 5 on IIS6 on my paid webhost (1and1), strangely I didn't get the "login won't take" problem, but instead get the "white page of death". The webhost also didn't set a memory_limit variable.

As to why I host on a Windows Server, I actually originally requested a Linux one but 1and1 put me on a Windows server promising better performance on a newer server. If this keeps up I'll have to insist they move me back.

Adding ini_set lines to settings.php doesn't make the new memory_limit variable appear in admin/settings/php, suggesting that somehow IIS6 is preventing the changes. I also can't use clean URLs with IIS6.

Christefano-oldaccount’s picture

display_errors should be set to On (not "TRUE").

How to create a custom php.ini file when nothing else works

phpninja’s picture

I created the custom.ini, placing it everywhere but it seems the custom ini isn't loaded.

What else can be done? Could be that the redirect isn't working properly? After submitting, the data IS definitely submitted and entered into the database, it just isn't redirecting back to the page...

UPDATE: Ok I reduced the modules to a bare minimum and the white page problem cleared up. Therefore it's pretty obvious it's the memory issue. Looks like I'll have to work with my host to increase the php memory limit since it's also painfully clear that it won't use custom values at my end.

Thanks all for the help!

pankajshr_jpr’s picture

thanx phpninja .... from your provided knowledge to fix problems of blank page i could able to fix the problem of blank pages in my website. means by adding the information:

* Adding to .htaccess

php_value memory_limit 32000000

* Adding to settings.php
ini_set("memory_limit", "32M");
ini_set('display_errors', TRUE);

*Adding to the start of index.php
ini_set("memory_limit", "32M");
ini_set('display_errors', TRUE);