Jump to content


Strange error I am seeing in the error logs.

  • Please log in to reply
1 reply to this topic

#1 Gordon Werner

Gordon Werner
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 06 July 2006 - 08:13 PM

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: (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.

$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))] : ""));

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


#2 redarrow

  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 06 July 2006 - 09:06 PM

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)
Wish i new all about php DAM i will have to learn

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users