[PHP] Re: Problem using Metabase
Hello, on 08/16/2005 10:17 PM Pablo Gosse said the following: [snip] I suspect that the problem is with file permissions. I recall that since Metabase uses include to load class files, the script will not exit when it fails to include a PHP class file. Assuming that is the case, make sure that all Metabase class files are readable by your Web server user. [/snip] The permissions seem fine. However, I've discovered something else. I was able to use Metabase without any trouble on a linux server to access a Postgres database. I then removed the call to MetabaseSetDatabase and changed the drive to odbc-msaccess, and the errors returned. Changed it back to pgsql or mysql and the errors go away. I just now tried this on the IIS box and got the same results. If I specify postgres I get an error telling me that postgres is not enabled in that php implementation, and if I specify mysql it works fine. If I change it back to odbc-msaccess, the errors are there. So, the error message I get is only triggered when I specify Access as the database. Does this provide any further insight? Not really but I looked again at your error message and sample script and realized a few things that seem to be the problem. Your error message said: Fatal error: Class metabase_manager_odbc_class: Cannot inherit from undefined class metabase_manager_database_class in C:\Inetpub\wwwroot\etrakFE\classes\metabase\metabase_odbc.php on line 13 There is no class definition on line 13 of metabase_odbc.php . That definition is in manager_odbc.php. So I wonder if you did not typed the error message with inadverted changes. In your example you call SetDatabase. That does not make Metabase load the ODBC driver schema manager extension. I suspect that you meant CreateDatabase. That would trigger the extension class loading and eventual errors. If you are sure permissions are ok, the only other possibility to make the class loading include fail is incorrect include path. I suspect you need to specify absolute path to make it work. What is your include path in php.ini? Anyway, I changed Metabase base class to make it gracefully fail (not make PHP exit with a fatal error) if any of the extension include files does not load properly for some reason. Please try the updated version getting it from CVS or a current snapshot that you can download from here: http://www.meta-language.net/download.html#snapshots Metabase is inside the archive: http://www.meta-language.net/download/metal-cvs.zip or http://www.meta-language.net/download/metal-cvs.tar.gz Once you use this version your script should no longer exit with a fatal error. It should fail but a call to $db-Error() should return a meaningful error message. -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Problem using Metabase
Hello, on 08/16/2005 12:01 AM Pablo Gosse said the following: Thanks, Manuel. I tried what you suggested but it didn't work. The server this project is housed on is an IIS server running PHP 4.4.0. I installed the metabase package on a linux server, and was able to connect to a postgres database with no troubles at all. It must be something in our PHP configuration that's causing the problem, but I'm pretty sure we have a cache extension installed. This PHP install was done rather quickly, unless there's a cache extension installed by default (which there is not as far as I understand, but I could be wrong ...) we likely didn't install one. I suspect that the problem is with file permissions. I recall that since Metabase uses include to load class files, the script will not exit when it fails to include a PHP class file. Assuming that is the case, make sure that all Metabase class files are readable by your Web server user. -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: Problem using Metabase
[snip] I suspect that the problem is with file permissions. I recall that since Metabase uses include to load class files, the script will not exit when it fails to include a PHP class file. Assuming that is the case, make sure that all Metabase class files are readable by your Web server user. [/snip] The permissions seem fine. However, I've discovered something else. I was able to use Metabase without any trouble on a linux server to access a Postgres database. I then removed the call to MetabaseSetDatabase and changed the drive to odbc-msaccess, and the errors returned. Changed it back to pgsql or mysql and the errors go away. I just now tried this on the IIS box and got the same results. If I specify postgres I get an error telling me that postgres is not enabled in that php implementation, and if I specify mysql it works fine. If I change it back to odbc-msaccess, the errors are there. So, the error message I get is only triggered when I specify Access as the database. Does this provide any further insight? Cheers and TIA, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Problem using Metabase
Hello, on 08/15/2005 11:32 AM Pablo Gosse said the following: Hi, folks. I've recently decided to use Manuel's Metabase instead of ADOdb as ADOdb doesn't support transactions for MS Access, however I'm getting the following error when running the sample code: Fatal error: Class metabase_manager_odbc_class: Cannot inherit from undefined class metabase_manager_database_class in C:\Inetpub\wwwroot\etrakFE\classes\metabase\metabase_odbc.php on line 13 Obviously this means that the metabase_manager_odbc_class is being defined before metabase_manager_database_class, thus throwing an error, but the problem is I'm not calling this manually, and have used the sample code exactly as it is in the manual. Here's my code: require(classes/metabase/metabase_database.php); require(classes/metabase/metabase_interface.php); $error=MetabaseSetupDatabaseObject(array(Type=odbc-msaccess, IncludePath=classes/metabase), $db); if($error!=) { echo Database setup error: $error\n; exit; } $db-SetDatabase(etrakADB); I tried that code here with PHP 4.3.11 and it works perfectly. Which version of PHP are you using? Are you using any PHP cache extension like APC or another? Metabase loads the class files by the right order but it is possible that a buggy caching extension may be causing that problem. You may also try loading the classes as workaround right after the includes you make in your script: require('classes/metabase/metabase_odbc.php'); require('classes/metabase/metabase_odbc_msaccess.php'); require('classes/metabase/manager_odbc.php'); require('classes/metabase/manager_odbc_msaccess.php'); -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: Problem using Metabase
[snip] Here's my code: require(classes/metabase/metabase_database.php); require(classes/metabase/metabase_interface.php); $error=MetabaseSetupDatabaseObject(array(Type=odbc-msaccess, IncludePath=classes/metabase), $db); if($error!=) { echo Database setup error: $error\n; exit; } $db-SetDatabase(etrakADB); I tried that code here with PHP 4.3.11 and it works perfectly. Which version of PHP are you using? Are you using any PHP cache extension like APC or another? Metabase loads the class files by the right order but it is possible that a buggy caching extension may be causing that problem. You may also try loading the classes as workaround right after the includes you make in your script: require('classes/metabase/metabase_odbc.php'); require('classes/metabase/metabase_odbc_msaccess.php'); require('classes/metabase/manager_odbc.php'); require('classes/metabase/manager_odbc_msaccess.php'); [/snip] Thanks, Manuel. I tried what you suggested but it didn't work. The server this project is housed on is an IIS server running PHP 4.4.0. I installed the metabase package on a linux server, and was able to connect to a postgres database with no troubles at all. It must be something in our PHP configuration that's causing the problem, but I'm pretty sure we have a cache extension installed. This PHP install was done rather quickly, unless there's a cache extension installed by default (which there is not as far as I understand, but I could be wrong ...) we likely didn't install one. Thanks, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] RE: Problem using Metabase
[snip] It must be something in our PHP configuration that's causing the problem, but I'm pretty sure we have a cache extension installed. This PHP install was done rather quickly, unless there's a cache extension installed by default (which there is not as far as I understand, but I could be wrong ...) we likely didn't install one. [/snip] Sorry, I meant to say that we likely DO NOT have a cache extension installed. Can anyone think of any other reason why the order in which the class files are loaded would be changed on one server to the next? Cheers and TIA, Pablo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php