Moving a domain but encountering PHP errors

software development


Hi Everyone,

I’m in the process of moving to DH but I have a complex site written by someone else.

DH doesnt seem to like full paths. An example of the code is:

require ‘includes/topmenu.php’;

<?php include '/home/mysite/public_html/basic/control/_links.php';?>

How can I fix this to work with DH?

As I understand there is a way to say “take it from root of my public folder”




That might be a path on a CPanel server, but here you’ll need to change it to:


Or you can use $_SERVER[‘DOCUMENT_ROOT’] to put you in the domain’s folder, then just add /some-directory/somefile.php.

:stuck_out_tongue: Save up to $96 at Dreamhost with ALMOST97 promo code (I get $1).
Or save $97 with THEFULL97.


I found this issue when moving my site from go daddy to here, would recommend you use $_SERVER[‘DOCUMENT_ROOT’]

example being:

$doccumentroot = $_SERVER[‘DOCUMENT_ROOT’];

include “$doccumentroot/includes/db.php”;

Just the way i did it because i dint want to keep using $_SERVER[‘DOCUMENT_ROOT’]

Each to their own :wink:




I fixed it. Basically it wasnt parsing php in html files correctly, because a file called test.html with a bare <? php phpinfo(); ?> wouldnt work, but rename it to .php and it all worked fine.

So I added :

RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html

to .htaccess and its all fine now :slight_smile:

What a waste of 12 or so hours.


you should really use cgi for php here instead of the apache module. so instead of your:
AddType application/x-httpd-php .php .htm .html
AddType php5-cgi .php .html
or, if you need php 4:
AddType php-cgi .php .html

track7 - my dream-hosted site