Error in Options.php

After I have uploaded the Omeka files in Public_html and changed the db.ini I go to the site ( http://173.225.89.117 ) and it shows an error message about the Zend Controller. But if I look at the error log on the Apache Server (yes rewrite is enabled) I see this before the Zend controller error:

[warn] mod_fcgid: stderr: PHP Fatal error:  Argument 1 passed to Omeka_Core_Resource_Options::_convertMigrationSchema() must not be null, called in /home/paomeka/public_html/application/libraries/Omeka/Core/Resource/Options.php on line 49 and defined in /home/paomeka/public_html/application/libraries/Omeka/Core/Resource/Options.php on line 79

Looking at the Options.php just before line 49 I find:

/**
     * @return array
     */
    public function init()
    {
        $bootstrap = $this->getBootstrap();
        $bootstrap->bootstrap('Db');
        $db = $bootstrap->getResource('Db');

        try {
            // This will throw an exception if the options table does not exist
                 $options = $db->fetchPairs("SELECT name, value FROM $db->Option");
        } catch (Zend_Db_Statement_Exception $e) {
            if ($this->_installerRedirect) {
                // Redirect to the install script.
                header('Location: '.WEB_ROOT.'/install');
            } else {
                throw $e;
            }
        }

(line 49)        $this->_convertMigrationSchema($options);

I take it to mean that when there is nothing to query in MySQL for options (There are no tables in the database before or after these errors), it looks to the Install directory to begin the processes there and it fails either to find that directory or execute the code for some reason, so it fails to include any options on line 49 and thus follows the cascade of errors after that.

Is it possible that /home/paomeka/public_html as seen in the error message is being seen by the code as the '.WEB_ROOT.' instead of public_html which I think is where it should point?

I have made a small amount of progress by changing the hostname in db.ini to the ip address instead of "LocalHost" - so now I get a message "Omeka has Encountered an Error" with white space to the right as if it would love to say what the error is but can't quite figure it out. In a nice font too..

But still no install is happening and now there are not error to chase in the Apache Error Log.

Hi pateam:

Glad to hear you've made a bit of progress. We had been trying to figure out what might have been causing your first error, but so far we've been stumped.

Going to your URL now, I see the error page. You can get a more detailed error message on that page by editing application/config/config.ini, and setting 'debug_exceptions' to true.

Best,
Jeremy

I'm fairly confident that the "Fatal error" message you're seeing in your apache log is unrelated to your problem here.

The script you posted an excerpt from (Options.php) should exit immediately after setting the Location header, but does not. However, since we only want to redirect your browser to "install", this is a harmless error.

I believe that your real problem is still the same one from your initial posting: the Omeka installer isn't correctly detecting what your "base URL" is. I notice you're using mod_fcgid. Is it possible for you to try using mod_php instead, just to rule out a possible problem area?

John and Jeremy: Thanks a ton for looking at this. I tried Jeremy's config.ini idea and still get nothing new on the screen or in the log file. I don't see where to change mod_fcgid or mod_php on my virtual manager screen. I'll ask my Server guy about it.

Joe

Talked to my Server Guy and we are running straight mod_php. So back to the "base URL" problem. I commented out the two instances of "DENY" in .htaccess so I could run info.php with the phpinfo()command and see what the setup is. Right now the $_SERVER['DOCUMENT_ROOT']= /home/paomeka/public_html It would be nice to see what the WEB_ROOT is set to in options.php but I tried to slip an echo in there and got no echo so that was too simple. How do you suggest I proceed?

Joe

First, you should switch back to your old db.ini settings, with "localhost". With your old settings, the page was successfully redirecting to "install" and breaking there. Your new db settings are probably causing a permissions problem with your database, which is causing the new error page you're seeing.

So, the next thing I think you should try is to manually set the base URL for the installer yourself.

On line 25 of install/index.php, there is a function call that starts with $application->getBootstrap. Try altering this call so it looks like this:

$application->getBootstrap()->registerPluginResource('Zend_Application_Resource_FrontController',
    array(
        'controllerDirectory' => APPLICATION_PATH . '/controllers',
        'throwExceptions' => true,
        'baseUrl' => '/install'));

Basically, you're just adding the baseUrl entry to the array passed to this function. This overrides the autodetection that normally occurs, and manually says that the installer code is at the "/install" URL on your server.

Thanks John. I'll get on that.

Joe

John:

A little history and a retraction. I first encountered the options.php error trying to load Omeka in a subdirectory under Wordpress (110) We could not resolve the issues so I got a new IP and installed in public_html (117) both threw errors on options.php. Both use mod_fcgid. The server manager didn't recognize it but mod_fcgid is right in the error log. They are on the same server, Bridger. So I got an IP (122) on another server (Kodiak) and got "Omeka has Encountered and Error" with no further information. On 122 the mod_fcgid does not show in the error log. I modified config.ini per Jeremy to show exceptions but nothing changed. I modified db.ini back to "localhost" and nothing changed. I modified install/index.php per your instructions on 122 and nothing changed. I tried the "localhost" changes on 117 along with the index.php change and the debug.execptions = true. It does not show an error on the screen or in the error log, but instead goes to ...117/install/ and does nothing saying "Done" in the bottom left corner.

The error log is
[Sat Jan 29 03:40:03 2011] [warn] mod_fcgid: stderr: PHP Fatal error: Argument 1 passed to Omeka_Core_Resource_Options::_convertMigrationSchema() must not be null, called in /home/paomeka/public_html/application/libraries/Omeka/Core/Resource/Options.php on line 49 and defined in /home/paomeka/public_html/application/libraries/Omeka/Core/Resource/Options.php on line 79

So to avoid anything further with mod_fcgid I will stick to 122. You can see some information with http://173.225.89.122/info.php. And I had such high hopes...

Joe

Just to get some more information, the next thing I'd try is setting PHP to display errors. This should cause some information to be printed about any errors that are occuring, whether on the "Omeka Has Encountered an Error" screen or on the blank white screen on your other server.

To do this, edit your .htaccess file, in the <IfModule> section at the top of the file, and change the display_errors line to read

php_value display_errors 1

I'll also note that all of your servers still appear to be running PHP with mod_fcgid, and not mod_php. (See the "Server API" noted on the info page you linked.)

John:

I changed the display_errors in the code and also found a setting to display errors in my php panel. So now I see errors. Unfortunately it is the same one:
[Sat Jan 29 15:42:01 2011] [warn] mod_fcgid: stderr: PHP Catchable fatal error: Argument 1 passed to Omeka_Core_Resource_Options::_convertMigrationSchema() must be an array, null given, called in /home/bigbear/public_html/application/libraries/Omeka/Core/Resource/Options.php on line 49 and defined in /home/bigbear/public_html/application/libraries/Omeka/Core/Resource/Options.php on line 79

Good old fcgid. So should I look for a server without this fcgid thing?

John:

After becoming able to view the errors, I saw that the name of the database I had been given was wrong and changed that in db.ini. It was still throwing errors but then I remembered that we had changed install/index.php. So I replaced it with the original and it installed! Thanks for your patience in getting me through this. fcgid was not to blame.

Joe