# 9.0-R + Apache 2.2 - blank PHP pages



## johnsalomon (Mar 9, 2012)

Hi there,

I've recently done a full system upgrade with a lot of hiccups.  This included having to replace a bunch of incompatible or missing libraries, a full portupgrade and a whole series of system rebuilds that went badly wrong.

Currently, my local Apache server displays nothing but blank pages with any PHP applications.  I'm using torrentflux2 and jinzora2 - a frontend for bittornado and a music streaming application.

Both reside in subdirectories of the www DocumentRoot.  This is on a purely local box, nothing fancy, just a bunch of php connnecting to MySQL backend

- users/groups and permissions are correct (all www)
- PHP5 module is installed.  
- simple index.html works, both in the DocumentRoot and the actual subdirectories of the applications
- php5-mysql is installed, mysql_connect() works (i.e. I can get an echo "Connected to MySQL" to show up with the username and password from a simple test.php script 
- phpinfo() works (output below).  I can run phpinfo() via an index.php in the application directories so it's not a permissions thing.
- mysql is running, Apache is running
- testing application scripts with *php -l <whatever.php>* works without errors
- setting LogLevel to 'debug' in httpd.conf gives nothing relevant (logging works, but all I get is a warning about a deprecated php function which shouldn't cause this).  Ditto for syslog
- *php -v* shows no errors

The index.php of the applications, though, display absolutely nothing at all.

If I place phpinfo() above the rest of the php in that file, it works.  If I put it after the first include, like so


```
// main.internal
require_once("inc/main.internal.php");

phpinfo();
```

blank again.  


```
php -l inc/main.internal.php
```

gives no errors.
I'm almost 100% sure that it's something to do with php-related modules or configuration and I am convinced that it's something _really_ stupid that I am missing.  

Attached is all the (loads of) info that might be relevant...I'm happy to post any other info (going away for the weekend so it'll be Monday).

I am thoroughly puzzled at this point and would be grateful for any tips at all.  Happy to try anything suggested.

Thanks very much,

-John


-------

```
behemoth# uname -a
FreeBSD behemoth 9.0-RELEASE FreeBSD 9.0-RELEASE #5: Thu Mar  8 12:20:20 CET 2012     
root@behemoth:/usr/obj/usr/src/sys/BEHEMOTH  i386
```

--------


```
behemoth# pkg_info|grep -i php
adodb-4.99.0        Database library for PHP
eaccelerator-0.9.6.1_1 A free open-source PHP accelerator & optimizer
php5-5.3.10_1       PHP Scripting Language
php5-bz2-5.3.10_1   The bz2 shared extension for php
php5-ctype-5.3.10_1 The ctype shared extension for php
php5-dom-5.3.10_1   The dom shared extension for php
php5-exif-5.3.10_1  The exif shared extension for php
php5-extensions-1.6 A "meta-port" to install PHP extensions
php5-fileinfo-5.3.10_1 The fileinfo shared extension for php
php5-filter-5.3.10_1 The filter shared extension for php
php5-hash-5.3.10_1  The hash shared extension for php
php5-iconv-5.3.10_1 The iconv shared extension for php
php5-json-5.3.10_1  The json shared extension for php
php5-mysql-5.3.10_1 The mysql shared extension for php
php5-openssl-5.3.10_1 The openssl shared extension for php
php5-pdo-5.3.10_1   The pdo shared extension for php
php5-pdo_sqlite-5.3.10_1 The pdo_sqlite shared extension for php
php5-phar-5.3.10_1  The phar shared extension for php
php5-posix-5.3.10_1 The posix shared extension for php
php5-session-5.3.10_1 The session shared extension for php
php5-simplexml-5.3.10_1 The simplexml shared extension for php
php5-sqlite-5.3.10_1 The sqlite shared extension for php
php5-sqlite3-5.3.10_1 The sqlite3 shared extension for php
php5-tokenizer-5.3.10_1 The tokenizer shared extension for php
php5-xml-5.3.10_1   The xml shared extension for php
php5-xmlreader-5.3.10_1 The xmlreader shared extension for php
php5-xmlwriter-5.3.10_1 The xmlwriter shared extension for php
php5-zlib-5.3.10_1  The zlib shared extension for php
```

--------


```
behemoth# php -v
PHP 5.3.10 with Suhosin-Patch (cli) (built: Mar  9 2012 01:07:52)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
    with eAccelerator v0.9.6.1, Copyright (c) 2004-2010 eAccelerator, by eAccelerator
```

--------


```
behemoth# cat /usr/local/etc/php/extensions.ini
extension=eaccelerator.so
extension=dom.so
extension=bz2.so
extension=ctype.so
extension=exif.so
extension=fileinfo.so
extension=filter.so
extension=mysql.so
extension=hash.so
extension=iconv.so
extension=json.so
extension=openssl.so
extension=pdo.so
extension=pdo_sqlite.so
extension=phar.so
extension=posix.so
extension=sqlite3.so
extension=tokenizer.so
extension=xml.so
extension=xmlwriter.so
extension=zlib.so
extension=xmlreader.so
```

--------


```
behemoth# php -m
[PHP Modules]
bz2
Core
ctype
date
dom
eAccelerator
ereg
exif
fileinfo
filter
hash
iconv
json
libxml
mhash
mysql
mysqlnd
openssl
pcre
PDO
pdo_sqlite
Phar
posix
Reflection
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
zlib

[Zend Modules]
eAccelerator
```

-----


```
behemoth# php --ini
Configuration File (php.ini) Path: /usr/local/etc
Loaded Configuration File:         /usr/local/etc/php.ini
Scan for additional .ini files in: /usr/local/etc/php
Additional .ini files parsed:      /usr/local/etc/php/extensions.ini
```

------


----------



## SirDice (Mar 9, 2012)

johnsalomon said:
			
		

> If I place phpinfo() above the rest of the php in that file, it works.  If I put it after the first include, like so
> 
> 
> ```
> ...



If phpinfo() works PHP and Apache are configured correctly. If there are any missing PHP extensions I've noticed applications will tend to complain, quite loudly, about it.

The fact those PHP scripts don't produce errors doesn't mean they also produce correct output. I'm guessing those applications haven't been configured correctly.


----------



## johnsalomon (Mar 9, 2012)

SirDice said:
			
		

> If phpinfo() works PHP and Apache are configured correctly. If there are any missing PHP extensions I've noticed applications will tend to complain, quite loudly, about it.
> 
> The fact those PHP scripts don't produce errors doesn't mean they also produce correct output. I'm guessing those applications haven't been configured correctly.



Well this is the thing that throws me - before the kerfuffle with my upgrade to 9.0 (I really can't tell you everything that went wrong, as I just don't even understand it myself, suffice to say that the system itself seems to be working after a series of buildworlds with newly csupped source and a fully updated ports collection with portupgrade -a) everything worked fine.

This was with php5 and Apache 2.2, although I can't remember the exact versions.  

The fact that it's two distinct applications that have nothing to do with each other refusing to display any output makes me doubt that it's a php code or application configuration issue.


----------



## johnsalomon (Mar 9, 2012)

By the way, here is the phpinfo output:

http://pastebin.com/mMdgAjRC

(too long for posting here).

Next step is to try and get some php applications working via ports (i.e. freshly installed).

These two were not installed from ports, so should have no dependencies that were configured automatically based on system settings - that's another reason why I can't imagine it being an application configuration issue.


----------



## Uniballer (Mar 9, 2012)

I am not sure that you can count on portupgrade rebuilding *all* ports, especially if the port itself has not changed since it was last built.  Maybe you should seriously consider removing all ports & packages and starting over, or at least look through /usr/local for stuff that hasn't been recently upgraded.  Perhaps you could use find(1) for this, like maybe 
	
	



```
find /usr/local/{bin,lib,libexec,sbin} -not -newer /boot/kernel/kernel
```


----------



## wblock@ (Mar 9, 2012)

Uniballer said:
			
		

> I am not sure that you can count on portupgrade rebuilding *all* ports, especially if the port itself has not changed since it was last built.



Yes.  *portupgrade -a* upgrades everything that's not the latest version, while *portupgrade -af* rebuilds and upgrades everything.  But that second one is likely to break inconveniently.  The sysutils/portmaster procedure at the end of the man page to upgrade all ports is the best-documented way to get everything rebuilt.


----------



## Uniballer (Mar 10, 2012)

wblock@ said:
			
		

> The sysutils/portmaster procedure at the end of the man page to upgrade all ports is the best-documented way to get everything rebuilt.



Even the ports-mgmt/portmaster procedure fails occasionally due to port breakage (e.g. some part of the x11/gnome2 meta-port was broken again yesterday).  Maybe someday we won't all have to track the ports tree equivalent of CURRENT.


----------



## soulreaver1 (Mar 11, 2012)

For me it looks like missing apache extensions. I've had simillar situation while doing system upgrade last time. First check whether you have "display_errors=on" in your php.ini file. 
	
	



```
display_errors = On
```
If an error occurs while running php script and "display_errors" parameter is off, usually "blank, white screen" appears instead of script result.


----------

