# I cant config my site on my new host



## Matsaki (Apr 1, 2011)

I have changed from having my own server (Debian) to a web host in the same company (also running Debian), as I'm not so good in UNIX, MYSQL and programming and the guy who take care of the server is gone, I decided to change.

Anyway. I have uploaded my PHP/MySQL site to the new host but I can't get it going. The search path don't want to work.

*This is the first errors I get on the page:*



> Warning: include(/includes/dbopen.php) [function.include]: failed to open stream: No such file or directory in /home2/scancypc/public_html/ayianapa/Structure/header.php on line 35





> Warning: include() [function.include]: Failed opening '/includes/dbopen.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home2/scancypc/public_html/ayianapa/Structure/header.php on line 35





> Warning: include(/includes/utils.php) [function.include]: failed to open stream: No such file or directory in /home2/scancypc/public_html/ayianapa/Structure/header.php on line 36





> Warning: include() [function.include]: Failed opening '/includes/utils.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home2/scancypc/public_html/ayianapa/Structure/header.php on line 36





> Warning: include(/includes/auth.php) [function.include]: failed to open stream: No such file or directory in /home2/scancypc/public_html/ayianapa/Structure/header.php on line 37





> Warning: include() [function.include]: Failed opening '/includes/auth.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home2/scancypc/public_html/ayianapa/Structure/header.php on line 37



*In my header.php the configuration looks like this:*



> if ( ban($ip_range, $_SERVER['REMOTE_ADDR']) )
> die('Du är inte längre medlem på ayianapa.nu och avstängd från sajten!');
> 
> if ($_SERVER['SERVER_NAME'] == "www.ayianapa.nu" || $_SERVER['SERVER_NAME'] == "ayianapa") $DOCUMENT_ROOT = "/public_html/ayianapa";
> ...



So why will it not open the three /Includes as above ? They are there and reachable if I i.e. check from the browser writing the URL to the /Includes and there I see all the files. Where do I go wrong here?

*Thanks for any help!*

(I'm not sure this is the right forum though)

Thnaks!


----------



## ElDiabloConCaca (Apr 2, 2011)

Can you log in via ssh to the server, change directory to where those files are located, then post the output of the "pwd" command here?

You're setting the document root variable to a folder called "public_html" that is at the very ROOT of the drive, from what it looks like.


----------



## Matsaki (Apr 2, 2011)

[~/public_html/ayianapa]#


----------



## ElDiabloConCaca (Apr 2, 2011)

What's the full path of "~"?

Since your web server is running as a different user than what you use to log into ssh with (hopefully!), it will interpret "~" as something different as well.

Try something like:

"/var/www/localhost/public_html/ayianapa"

...or...

"/users/ayianapa/public_html"

...depending on what the full path is.

It looks like you posted what your command-line prompt says instead of what the output of "pwd" says... is that right?


----------



## Matsaki (Apr 2, 2011)

As you can see even if I put the path 





> /public_html/ayianapa


 In the erros I wrights the full path 





> /home2/scancypc/public_html/ayianapa/



I got from the support to write:


```
if ($_SERVER['SERVER_NAME'] == "www.ayianapa.nu" || $_SERVER['SERVER_NAME']
== "ayianapa") $DOCUMENT_ROOT = "/www/ayianapa";

include($DOCUMENT_ROOT ."/www/ayianapa/includes/dbopen.php");
include($DOCUMENT_ROOT ."//www/ayianapa/includes/utils.php");
include($DOCUMENT_ROOT ."/www/ayianapa/includes/auth.php");
```

But that don't work either. I get error:



> Warning: include(/www/ayianapa/includes/dbopen.php) [function.include]: failed to open stream: No such file or directory in /home2/scancypc/public_html/ayianapa/Structure/header.php on line 35


----------



## ElDiabloConCaca (Apr 2, 2011)

Well, now that won't work at all...

You set "$DOCUMENT_ROOT" to "/www/ayianapa"...

...then you take $DOCUMENT_ROOT and concatenate it with "/www/ayianapa/includes/dbopen.php".

So, your final string in the "include" directives is:

/www/ayianapa/www/ayianapa/includes/dbopen.php
(You're inserting "/www/ayianapa" _twice_)

So, try this:

Set $DOCUMENT_ROOT to "/home2/scancypc/public_html/ayianapa".

Then, in your include directives, concat $DOCUMENT_ROOT with "/includes/dbopen.php", "/includes/utils.php" and "/includes/auth.php".

See if that works.


----------



## Matsaki (Apr 2, 2011)

IfI did understand you right I wrote:


```
if ($_SERVER['SERVER_NAME'] == "www.ayianapa.nu" || $_SERVER['SERVER_NAME']
== "ayianapa") $DOCUMENT_ROOT = "/home2/scancypc/public_html/ayianapa";

include($DOCUMENT_ROOT ."/includes/dbopen.php");
include($DOCUMENT_ROOT ."/includes/utils.php");
include($DOCUMENT_ROOT ."/includes/auth.php");
```

The output I get then is:


> *Warning:* include(/www/ayianapa/includes/dbopen.php) [function.include]: failed to open stream: No such file or directory in /home2/scancypc/public_html/ayianapa/Structure/header.php on line 35


----------



## ElDiabloConCaca (Apr 2, 2011)

Do this:

ssh into the server, then change the directory to where those .php files are located.

Then, type "pwd" and post the output of that command.


----------



## Matsaki (Apr 2, 2011)

[~/public_html/ayianapa/includes]# pwd
/home2/scancypc/public_html/ayianapa/includes


----------



## CharlieJ (Apr 26, 2011)

I don't want to just come out of the blue with this.. but I had errors when moving servers when using shorthand php e.g. "<? ?>", could this be caused by this?

Just thought I'd mention that


----------



## Matsaki (Apr 26, 2011)

Sorry for not posting but problem solved  It was just because the domain was not active yet.


----------

