# White page problem with PHP page after upgrade to php5-5.3.5



## soylentgreen (Feb 4, 2011)

I had put off upgrading my company's email server's php5 to 5.3.x until recently.  We use The Horde for webmail and calendar.  The Horde is very heavy on PHP and works fine, but my simple redirect stopped working.

Simply, if the user is coming from a "10.0." network then the page redirects them to 'http' whereas if they are not, then they get 'https'.

index.php

```
<?
 $visitor = $_SERVER['REMOTE_ADDR'];
 if (preg_match("/10.0./",$visitor)) {
       header('Location: http://our.mailserver.com/horde/');
 } else {
       header('Location: https://our.mailserver.com/horde/');
 };
 ?>
```

Here are my installed PHP ports

```
php5-5.3.5          PHP Scripting Language
php5-ctype-5.3.5    The ctype shared extension for php
php5-dom-5.3.5      The dom shared extension for php
php5-extensions-1.4 A "meta-port" to install PHP extensions
php5-fileinfo-5.3.5 The fileinfo shared extension for php
php5-filter-5.3.5   The filter shared extension for php
php5-ftp-5.3.5      The ftp shared extension for php
php5-gd-5.3.5       The gd shared extension for php
php5-gettext-5.3.5  The gettext shared extension for php
php5-hash-5.3.5     The hash shared extension for php
php5-iconv-5.3.5    The iconv shared extension for php
php5-imap-5.3.5     The imap shared extension for php
php5-json-5.3.5     The json shared extension for php
php5-ldap-5.3.5     The ldap shared extension for php
php5-mbstring-5.3.5 The mbstring shared extension for php
php5-mcrypt-5.3.5   The mcrypt shared extension for php
php5-mysql-5.3.5    The mysql shared extension for php
php5-openssl-5.3.5  The openssl shared extension for php
php5-pdo-5.3.5      The pdo shared extension for php
php5-pdo_sqlite-5.3.5 The pdo_sqlite shared extension for php
php5-posix-5.3.5    The posix shared extension for php
php5-session-5.3.5  The session shared extension for php
php5-simplexml-5.3.5 The simplexml shared extension for php
php5-sqlite-5.3.5   The sqlite shared extension for php
php5-tokenizer-5.3.5 The tokenizer shared extension for php
php5-xml-5.3.5      The xml shared extension for php
php5-xmlreader-5.3.5 The xmlreader shared extension for php
php5-xmlwriter-5.3.5 The xmlwriter shared extension for php
php5-zlib-5.3.5     The zlib shared extension for php
```

Previously (and currently working on the production server) is:

```
php5-5.2.12         PHP Scripting Language
php5-ctype-5.2.12   The ctype shared extension for php
php5-dom-5.2.12     The dom shared extension for php
php5-extensions-1.3 A "meta-port" to install PHP extensions
php5-filter-5.2.12  The filter shared extension for php
php5-ftp-5.2.12     The ftp shared extension for php
php5-gd-5.2.12      The gd shared extension for php
php5-gettext-5.2.12 The gettext shared extension for php
php5-hash-5.2.12    The hash shared extension for php
php5-iconv-5.2.12   The iconv shared extension for php
php5-imap-5.2.12    The imap shared extension for php
php5-json-5.2.12    The json shared extension for php
php5-ldap-5.2.12    The ldap shared extension for php
php5-mbstring-5.2.12 The mbstring shared extension for php
php5-mcrypt-5.2.12  The mcrypt shared extension for php
php5-mysql-5.2.12   The mysql shared extension for php
php5-openssl-5.2.12 The openssl shared extension for php
php5-pcre-5.2.12    The pcre shared extension for php
php5-pdo-5.2.12     The pdo shared extension for php
php5-pdo_sqlite-5.2.12 The pdo_sqlite shared extension for php
php5-posix-5.2.12   The posix shared extension for php
php5-session-5.2.12 The session shared extension for php
php5-simplexml-5.2.12 The simplexml shared extension for php
php5-spl-5.2.12     The spl shared extension for php
php5-sqlite-5.2.12  The sqlite shared extension for php
php5-tokenizer-5.2.12 The tokenizer shared extension for php
php5-xml-5.2.12     The xml shared extension for php
php5-xmlreader-5.2.12 The xmlreader shared extension for php
php5-xmlwriter-5.2.12 The xmlwriter shared extension for php
php5-zlib-5.2.12    The zlib shared extension for php
```

The machine in question is 8.0-RELEASE-p2 that updates the ports tree nightly via cron.  This worked fine until the upgrade to 5.3.5 from 5.2.12.  Can anyone see where this is not compliant?  I am now getting a white page on this.

[edit]There are no mention of errors in the httpd-access.log or httpd-error.log[/edit]
Thanks in advance


----------



## Alt (Feb 5, 2011)

Add error_reporting(E_ALL); at top - it should show the error.


----------



## soylentgreen (Feb 7, 2011)

```
<?
error_reporting(E_ALL);
 $visitor = $_SERVER['REMOTE_ADDR'];
 if (preg_match("/10.0./",$visitor)) {
       header('Location: http://our.mailserver.com/horde/');
 } else {
       header('Location: https://our.mailserver.com/horde/');
 };
 ?>
```

Also returns a white page.  Did I add the line correctly?  I am unfamiliar with PHP.


----------



## rghq (Feb 7, 2011)

Hello 

Did you set:


```
log_errors = On
error_log = /whever/your/webserver/can/write/php.log
```

In your php.ini ? Then you'll have a PHP logfile that should help tracking what the problem may be.


----------



## vand777 (Feb 8, 2011)

Have you tried to rebuild The Horde? 

P.S. I remember having a similar problem with one of my web resources but do not remember with which one and what causes the problem, and how I solved the problem. But I remember having a blank page after maybe a PHP upgrade...


----------



## codeWarrior (Feb 13, 2011)

did you restart apache ? Usually -- Apache needs a restart after rebuilding PHP...


----------



## roddierod (Feb 14, 2011)

soylentgreen said:
			
		

> ```
> <?
> $visitor = $_SERVER['REMOTE_ADDR'];
> if (preg_match("/10.0./",$visitor)) {
> ...



You have to enable *short tags* if you are just using *<?* and not *<?php*.


----------



## soylentgreen (Feb 17, 2011)

*[solved]*

Thank you all for your replies.  I will address them in order:

@ rghq = Yes, the log file had no errors related to this, only depreciated warnings that had nothing to do with this page.
@ vand777 = The Horde works fine.  I am having a problem with the script in the first post.
@ codeWarrior = Yes, I have restarted apache and the server multiple times.
@ roddierod = Thank you this fixed my problem.  I added the 
	
	



```
<?php
```
 instead of 
	
	



```
<?
```
 and now the script works.


----------

