Gordon Werner Posted July 6, 2006 Share Posted July 6, 2006 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 46Can 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 advanceGordon Quote Link to comment https://forums.phpfreaks.com/topic/13893-strange-error-i-am-seeing-in-the-error-logs/ Share on other sites More sharing options...
redarrow Posted July 6, 2006 Share Posted July 6, 2006 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) Quote Link to comment https://forums.phpfreaks.com/topic/13893-strange-error-i-am-seeing-in-the-error-logs/#findComment-54141 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.