I want to know the best way to link back to my main folder both in my local server and when uploaded to my main server because I don't want to pass through the stress of editing my code all over again when I want to upload it and I want to achieve this through php
.
I know the /
would work but it only works when I echo it out, if I did something like this include '/connect.php'
I get this error in my main server:
Warning: include(/tutorials/): failed to open stream: No such file or directory in /home/stephens/public_html/kings/home.php
I also get an error in my local server saying:
Warning: include(C:\wamp\www\projects\tutorials) [function.include]: failed to open stream: Permission denied in C:\wamp\www\home.php.
I tried this also $_SERVER['DOCUMENT_ROOT']
but Its not working in my main server, only for the local server.
I also used $_SERVER['SERVER_NAME']
but It's not working also.
Please does anyone have a better way of achieving this?