Unable to get correct path in PHP due to server settings -


i not expert on servers , 1 of friends wanted use of php scripts wrote, has problem server , unable find how fix this.

basically problem in generating paths files.

in script, use following variables path:

$path = "/template/"; // path template folder $baseurl = $_server['document_root'].$path; 

then include pages example this:

include($baseurl."scripts/functions.php"); 

on server, works fine , when tried echo baseurl parameter this:

/data/web/virtuals/104571/virtual/www/template/ 

however, on friend´s server, throws "php fatal error: call undefined function" - because checked , functions.php not being loaded,

when tried echoing baseurl on friend´s server, got nothing.

so tried viewing phpinfo() , interestingly, did't find document_root there @ , paths weird, php error shows:

php fatal error: call undefined function convertt() in h:\webspace\hostings\kocher.es\hosting\www\meteotemplate\index.php on line 14 

as dont understand servers dont know means, why has h:/ drive there , more importantly, how fix this....

here phpinfo() displayed: http://kocher.es/meteotemplate/

if knew how fix appreciate it, thanks.

try __dir__

example:

$basepath = __dir__; $templatepath = $basepath."/template/"; // path template folder  include($templatepath."/scripts/functions.php"); 

__dir__ return file base directory , different in different files mean must careful when call it


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -