# Apache/PHP not working



## fullauto (Jul 16, 2012)

I have an Apache 2.2 server offering up PhpBB3.  Everything is working smoothly on that system. But, I am trying to migrate the database as well as the PhpBB3 page to another server for testing and such.  

I used the Doc from the PhpBB website to do the transfer
http://www.phpbb.com/kb/article/transferring-your-board-to-a-new-host-or-domain/

Everything went according to plan until I transfered the actual documents from the original server to the 'test' server.  All I get is a blank screen.  I have been tirelessly scouring the Internet for a solution to the problem without avail.

Finally, I am turning to the experts here.

I will lay out my original and then my test server layouts.

"Hubert" -- Working server.

```
[root@hubert]/usr/local/etc/apache22-> httpd -v
Server version: Apache/2.2.22 (FreeBSD)
```

Php module is loaded:

```
[root@hubert]/usr/local/etc/apache22-> httpd -M
Loaded Modules:
 - snip -
 php5_module (shared)
Syntax OK
[root@hubert]/usr/local/etc/apache22->
```


```
#
# This is the main Apache HTTP server configuration file.  It contains the
- snip - 
LoadModule php5_module        libexec/apache22/libphp5.so

-snip -
################ Virtual Hosts ##################

<VirtualHost *>
        ServerName www.somedomain.net>
        DocumentRoot /usr/www/somedomain.net
	
	<Directory /music>
        	AllowOverride None
        	Order allow,deny
        	Allow from all
	</Directory>

	<Directory /apps>
        	AllowOverride None
        	Order allow,deny
        	Allow from all
	</Directory>

	<Directory /video>
        	AllowOverride None
        	Order allow,deny
        	Allow from all
	</Directory>

	<Directory /phpBB3>
        	AllowOverride None
        	Order allow,deny
        	Allow from all
	</Directory>
</VirtualHost>

<VirtualHost *>
	ServerName www.anotherdomain.com
	DocumentRoot /usr/www/anotherdomain.com
	
	<Directory />
		AllowOverride None
		Order allow,deny
		Allow from all
	</Directory>
</VirtualHost>

#################### End Virtual Hosts #########################
<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>
-snip-
DefaultType text/plain
-snip-
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddType application/x-httpd-php .php
-snip-
</IfModule>
-snip-
```


```
[root@hubert]/usr/local/etc-> php -v
PHP 5.3.13 with Suhosin-Patch (cli) (built: May 21 2012 00:01:21)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
```


```
php.conf
PHP_VER=53
PHP_VERSION=5.3.13
PHP_SAPI=cli cgi mod
PHP_EXT_INC=pcre spl
```


```
[root@hubert]/usr/local/etc-> mysqladmin -uXXXXXXX -pXXXXXXX version
mysqladmin  Ver 8.41 Distrib 4.1.25, for portbld-freebsd9.0 on i386
Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license

Server version          4.1.25
Protocol version        10
Connection              Localhost via UNIX socket
UNIX socket             /tmp/mysql.sock
Uptime:                 2 days 17 hours 55 min 16 sec

Threads: 1  Questions: 9068  Slow queries: 0  Opens: 126  Flush tables: 1  Open tables: 64  Queries per second avg: 0.038
```

System works fine!

Now for the test server - "Zap" (Yes, all the servers here are named after Futurama characters)


```
[root@zap]/usr/local/etc-> httpd -v
Server version: Apache/2.2.22 (FreeBSD)
Server built:   Jul 15 2012 18:59:51
You have new mail.
[root@zap]/usr/local/etc->
```


```
#
# This is the main Apache HTTP server configuration file.  It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.2> for detailed information.
# In particular, see 
# <URL:http://httpd.apache.org/docs/2.2/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do.  They're here only as hints or reminders.  If you are unsure
# consult the online docs. You have been warned.  
#
# Configuration and logfile names: If the filenames you specify for many
# of the server's control files begin with "/" (or "drive:/" for Win32), the
# server will use that explicit path.  If the filenames do *not* begin
# with "/", the value of ServerRoot is prepended -- so "/var/log/foo_log"
# with ServerRoot set to "/usr/local" will be interpreted by the
# server as "/usr/local//var/log/foo_log".

#
# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
#
# Do not add a slash at the end of the directory path.  If you point
# ServerRoot at a non-local disk, be sure to point the LockFile directive
# at a local disk.  If you wish to share the same ServerRoot for multiple
# httpd daemons, you will need to change at least LockFile and PidFile.
#
ServerRoot "/usr/local"

#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to 
# prevent Apache from glomming onto all bound IP addresses.
#
#Listen 12.34.56.78:80
Listen 80

#
# Dynamic Shared Object (DSO) Support
#
# To be able to use the functionality of a module which was built as a DSO you
# have to place corresponding `LoadModule' lines at this location so the
# directives contained in it are actually available _before_ they are used.
# Statically compiled modules (those listed by `httpd -l') do not need
# to be loaded here.
#
# Example:
# LoadModule foo_module modules/mod_foo.so
#
-snip-
LoadModule php5_module        libexec/apache22/libphp5.so

AddType application/x-httpd-php .php

-snip-
<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>
-snip-
DefaultType text/plain

<IfModule mime_module>
   -snip-
    AddEncoding x-compress .Z
    AddEncoding x-gzip .gz .tgz
    AddType application/x-httpd-php .php
-snip-
Include etc/apache22/Includes/*.conf
```


```
[root@zap]/usr/local/etc-> php -v
PHP 5.3.14 with Suhosin-Patch (cli) (built: Jul 15 2012 22:17:03)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
[root@zap]/usr/local/etc->
```

when I point my browser to zap.mydomain.com, all I get is a blank screen.  I added a php file to the root directory with the following contents to test the php.

```
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
Echo "Line 1</br>";
$link = mysql_connect('localhost', 'XXXX', 'XXXX');    
Echo "Line 2</br>";
?>
```

I get this:

```
Line 1

Fatal error: Call to undefined function mysql_connect() in /usr/www/test.php on line 5
```

And when I point to index.php, if I view source, I get this:

```
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=windows-1252" http-equiv=Content-Type></HEAD>
<BODY></BODY></HTML>
```

Like, I said. I have been at this for days and am not sure what to make of it.  Any assistance will be greatly appreciated.


----------



## Abriel (Jul 16, 2012)

What shows 
	
	



```
<?php phpinfo(); ?>
```
 on Zap? Is there "mysql" in "Configuration"?
Do you have 
	
	



```
extension=mysql.so
```
 in /usr/local/etc/php/extensions.ini


----------



## fullauto (Jul 16, 2012)

No php dir.  Not sure how that happened.
what is that indicative of?

```
[root@zap]/usr/local/etc-> ls
apache22                lynx.lss                pam.d                   proftpd.conf            xml2Conf.sh
devd                    lynx.lss.sample         php.conf                proftpd.conf.sample
lynx.cfg                man.d                   php.ini-development     rc.d
lynx.cfg.sample         openldap                php.ini-production      teamspeak
[root@zap]/usr/local/etc->
```

I added the code you gave me to test.php and it runs.

```
PHP Version 5.3.14
System 
FreeBSD zap 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan 3 07:15:25 UTC 2012 root@obrian.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386 
Build Date 
Jul 15 2012 22:16:01 
Configure Command 

'./configure' '--with-layout=GNU' '--localstatedir=/var' '--with-config-file-scan-dir=/usr/local/etc/php' '--disable-all' '--enable-libxml' '--enable-mysqlnd' '--with-libxml-dir=/usr/local' '--with-pcre-regex=/usr/local' '--with-zlib-dir=/usr' '--program-prefix=' '--with-apxs2=/usr/local/sbin/apxs' '--with-regex=php' '--with-zend-vm=CALL' '--prefix=/usr/local' '--mandir=/usr/local/man' '--infodir=/usr/local/info/' '--build=i386-portbld-freebsd9.0' 

Server API 
Apache 2.0 Handler 
Virtual Directory Support 
disabled 

Configuration File (php.ini) Path 

/usr/local/etc 



Loaded Configuration File 

(none) 



Scan this dir for additional .ini files 

/usr/local/etc/php 



Additional .ini files parsed 

(none) 



PHP API 

20090626 



PHP Extension 

20090626 



Zend Extension 

220090626 



Zend Extension Build 

API220090626,NTS 



PHP Extension Build 

API20090626,NTS 



Debug Build 

no 



Thread Safety 

disabled 



Zend Memory Manager 

enabled 



Zend Multibyte Support 

disabled 



IPv6 Support 

enabled 



Registered PHP Streams 

php, file, glob, data, http, ftp 



Registered Stream Socket Transports 

tcp, udp, unix, udg 



Registered Stream Filters 

string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk 





This server is protected with the Suhosin Patch 0.9.10
Copyright (c) 2006-2007 Hardened-PHP Project Copyright (c) 2007-2012 SektionEins GmbH
 




This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies


 

--------------------------------------------------------------------------------

PHP Credits
 
--------------------------------------------------------------------------------
-snip-

This program is free software; you can redistribute it and/or modify it under the terms of the PHP License as published by the PHP Group and included in the distribution in the file: LICENSE
 
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
If you did not receive a copy of the PHP license, or have any questions about PHP licensing, please contact license@php.net.
```


----------



## fullauto (Jul 16, 2012)

-- UPDATE --
I am a newb, and made a newb error! 
Problem solved. 
I forgot to ./usr/ports/lang/php52-extensions/make install clean

Thank you for pointing my obviously overloaded mind in the right direction!


----------

