Need help with running iWebCal

apps

#1

I’m trying to get iWebCal running on my DreamHosts server, and it keeps giving me the following errors:

Warning: main(/dh/cgi-system/base/main.inc): failed to open stream: No such file or directory in /home/.damian/canterburynh/www/cvfd/login/iWebCal/config.inc on line 194

Warning: main(): Failed opening ‘/dh/cgi-system/base/main.inc’ for inclusion (include_path=’.:/usr/local/lib/php’) in /home/.damian/canterburynh/www/cvfd/login/iWebCal/config.inc on line 194

Fatal error: Cannot instantiate non-existent class: iwebcal in /home/.damian/canterburynh/www/cvfd/login/iWebCal/index.php on line 44

http://www.canterburynh.us/cvfd/login/iWebCal/

BUT, the exact same set of files uploaded to a DIFFERENT (non-dreamhost) server works fine:

http://www.webparlour.com/iWebCal/index.php

Any clue what is going on at DreamHost. It seems I frequently have issues setting up PHP scripts at DH that I don’t have elsewhere. Am wondering why things “just work” elsewhere, but not at DH?

Any help/suggestions would be appreciated.

The place where I got the script is here:

http://interfacethis.com/iwebcal/

Thanks!

~Jem


#2

That’s the problem.

Cause DH is one of the few web hosts I’ve found that properly configures their servers. Many web authors don’t understand this and their scripts can break on DH’s network.

For some reason, it’s looking for a file in /dh and you don’t have access to /dh, nor does that directory exist on the DH servers.

Most likely the reason it’s working everywhere is that when that / happens, it’s using an HTTP call on the current domain to look for the file if it fails to locate it on the file system. Unfortunately since allow_url_fopen is turned off, the include failes.

Another words; it’s a poorly written script.


#3

You what know what else is bugging me. This;

vs

I don’t see how it would even work if allow_url_fopen was turned of (assuming I was right initially about my guess).

It’s looking for main.inc within the directory dh/cgi-system/base, but your config file is in cvfd/login/iWebCal. Where’s the dh and cgi-system directory?!


#4

Guice,

Thanks for posting. I must confess, I’m a relative newbie with respect to PHP, so please bear with me.

There seems to be something about my server configuration that is causing problems, as another DH’er has been able to upload and get this to work fine on his DH site.

Your comments about the “fictitious paths” are interesting, but looking at the code, it seems that path was generated by the DH server itself (from a server variable). Here’s the lines from the script at line 194:

if (!isset($iWebCal_LOCAL_PATH))
$iWebCal_LOCAL_PATH = dirname($_SERVER[“SCRIPT_FILENAME”]);
include “${iWebCal_LOCAL_PATH}/base/main.inc”;

So perhaps I could get around this if I could give an explicit path to the requested main.inc file? Not sure what that is though. Will have to do some further looking.


#5

What you’re seeing is the location of the PHP binary used for CGI applications:

kchrist@dreamhost:~>$ ls -l /dh/cgi-system/ total 1436 -rwxr-xr-x 1 root root 1465288 Jan 25 17:16 php.cgi See the knowledge base article on running PHP as a CGI as opposed to an Apache module for help fixing it. Hint: Look for the bits about $_SERVER[‘SCRIPT_NAME’].

Alternately, toggle your site to use PHP as an Apache module instead of CGI.


If you want useful replies, ask smart questions.


#6

Thank you kchrist!

I will look in to this, as it would be more elegant than the solution I found, which was to indicate an explicit path (specific to that one domain/directory) instead of relying on the relative (relative to where the script is located) path generated by the server variable.

What I did works, but it would require remembering to change the path each time I wanted to use the script in a new location, or on a different DH domain.

Best wishes,

Jem