Jump to content

Archived

This topic is now archived and is closed to further replies.

Gordon Werner

Strange error I am seeing in the error logs.

Recommended Posts

hi there ...

At my job, we have multiple people working on a website for a client.

Most of us use macs to do this and our server is running apache on BSD.

In order for us to view our work on our local machines as well as on our dev server (also a mac) I need to have some code that can automatically determine the path to the include directory where the site's configuration file lives.

locally on our machines we would look at the site at:  http://127.0.0.1/~user/domain (files in the user's ~/Sites directory)
the dev server on http://devserver/doman (files in /Library/WebServer/Documents)
the production server on http://www.domain.com/ (files in /home/web/sites/domain)

the following code SEEMS to handle this ... buy studying the path and looking to see if Library or Users exists in the path (then it is local or dev) and if not, then it is the live server.

[code]


$uri  =  explode("/", $_SERVER['PATH_TRANSLATED']);
$path_site  =  "http://".$_SERVER['HTTP_HOST'].(ereg('Library|Users', $uri[1]) ? ($uri[3] == "Sites" ? "/~$uri[2]/".$uri[(array_search($site,$uri))] : "/".$uri[(array_search($site,$uri))]) : ((array_search($site,$uri)) > 4 ? "/".$uri[(array_search($site,$uri))] : ""));


[/code]


However, I am getting the following error in the php errorlog ONLY on the live server:


[Thu Jul  6 13:00:02 2006] [error] PHP Warning:  array_search() [<a href='function.array-search'>function.array-search</a>]: Wrong datatype for second argument in /home/web/sites/domain/include/config.php on line 46


Can anyone tell me what I am doing wrong, or even if I should worry about this error?  The sites work just fine on all machines so it looks like it is working but I do not like error messages.

Also ...

can anyone offer a better way to do this? if my way is flawed?

thanks in advance

Gordon

Share this post


Link to post
Share on other sites
I not sure but maybe you need to use eregi ok.


ereg lower case letters (case sencetive)

eregi uper and lower case letters.(non case sencetive)

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.