Replies Back to Article

PHAkt and Access database, is it possible?

ERROR
May 15, 2001 by shawn conrad

Fatal error: Call to undefined function: adodb() in C:\Inetpub\wwwroot\php\adodb\adodb.inc.php on line 28
-----------

This after all the other bugs where squashed and the coffeepot died...

I have went through this situation in which every thing worked great when working w/in UD, but when you view live or view in localhost...this.

I wonder, do I need to set this up on a server to accurately execute the php, or should this work off of PWS?

---------------

RE: ERROR
May 15, 2001 by shawn conrad

/**
  * SET THE VALUE BELOW TO THE DIRECTORY WHERE THIS FILE RESIDES
  * ADODB_RootPath has been renamed ADODB_DIR
  */
 if (!isset($ADODB_DIR))
  $ADODB_DIR = adodb(__FILE__); 

/** This is line 28(above) the (__FILE__) is causing the error and being undefined. I have tried listing the ` $ADODB_DIR = ` to : A.)Absolute path B.) Relative C.) root  D.) All the above

.........

RE: RE: ERROR
May 16, 2001 by Tim Green

If you use the latest version of my extension 'ADODB installer v1.01' in Extensions/App Servers/PHP you won't need to make this manual alteration. This extension uses the latest version of ADODB (v1.01) which automagically works the Document Path out for you.

Alternatively, you can download ADODB v1.01 from http://php.weblogs.com/ADODB.

However, if you do decide to use my extension you will find that whenever ADODB is upgraded, I will upgrade the extension and you can re-apply it at any time to upgrade the version of ADODB in your site painlessly :-)

And to make life that little bit easier, you will always know what version of ADODB you are running because the version number of my extension will be the same as the ADODB version.

Shameless plug I know, but I hope this helps.

Access,DSN - less Connections & Linux Servers
May 16, 2001 by Tim Green

It should also be noted that if your site is hosted on a Linux / Unix server running PHP, and it does not have UnixODBC installed (or similar) you won't be able to make a connection to an Access database.

This is because the current implementation of ODBC in PHP is buggy, and PHP cannot make a successful connection to an Access Database.

If you are running on a Windows-based server then there is no problem, as ADODB makes use of the ADO COM Component, and will successfully connect.

I mention this here, purely for the sake of completeness of this great article.

For further information regarding this subject see http://php.weblogs.com/odbc

::RE: RE: RE: ERROR
May 16, 2001 by shawn conrad

::::VERSION 1.01::::

/**
  * SET THE VALUE BELOW TO THE DIRECTORY WHERE THIS FILE RESIDES
  * ADODB_RootPath has been renamed ADODB_DIR
  */
 if (!isset($ADODB_DIR))
  $ADODB_DIR = dirname(__FILE__);

----------

This looks to be the same as the last version in which it asks to define the directory. Is the code different elsewhere?

To define in detail the procedure I set up the database:

1.) Connect database through the ODBC in the control panel, as System DNS. (database resides in root folder of the clients work-my preference)

2.) Define in UD the connection type and the "language" you wish to use,in this case we use PHP and define all our connections and paths.-NOTE: I am using PWS and store everything in the wwwroot folder in its' own folder.

3.) We define the connection in the server model for PHP at which this time the PHAkt extension becomes visible as to connect the proper drivers and the dbNames.

4.) At this time I use the provided test button on the right to make sure my connection is defined and working.

5.) I add the appropriate information from the recordset that is now in my connections.(drag--drop)

6.) save all the relative files and directories in the localhost/wwwroot folder to be certain the testing is valid.

7.) call up http://localhost/`foldername` to view page.

8.) this error --see above postings.
-----------------------

I am certain PHP is working
I have tried changing the  INCLUDE_PATH= "." in my php.ini file.
Ihave changed the first mentioned suggestion.
Also have upgraded to the new ext.

Please, follow this reply with anything that seems out of order -with your succesfull connections with this great ext.

--sc

 

RE: ::RE: RE: RE: ERROR
May 16, 2001 by shawn conrad

<?php


  //    Copyright (c) Interakt Online 2001
  //    http://www.interakt.ro/

  require("./file:///C|/My%20Documents/clients/headesign_php/adodb/adodb.inc.php");
  require("./file:///C|/My%20Documents/clients/headesign_php/Connections/NorthWind.php");
............................................
Did a clean install of UD and now this in the connection code...?? any one??

RE: ::RE: RE: RE: ERROR
May 16, 2001 by Tim Green

ADODB_DIR is being set to the correct value in line 34 :-

// using PHPCONFIG protocol overrides ADODB_DIR
 if (isset($PHPCONFIG_DIR)) $ADODB_DIR=$PHPCONFIG_DIR.'/../adodb';

So no matter what you were doing the correct value would be used.

Looking through your posts, it is becoming clear that maybe you're not putting the ADODB folder in the right place.

You are getting this error message :-

Fatal error: Call to undefined function: adodb() in C:\Inetpub\wwwroot\php\adodb\adodb.inc.php on line 28

This tells me that you are uploading the ADODB folder to the wrong place. The ADODB folder must be installed with all of the other folders of your website. NOT in the PHP folder.

Also, setting arbitary values in your php.ini won't do the situation any good. I would suggest that you return the include_path line back to the default :-

include_path =                   ; UNIX: "/path1:/path2"  Windows: "\path1;\path2"

Finally, your last error. Re-installing UD was a bit drastic and was not at all necessary to sort out this problem, as your connection via UD worked correctly. You had already correctly assertained that the problem was at your webserver.

You will need to delete those lines, and recreate your connections and possibly re-apply all of the server behaviours that use them.

I hope all this helps.

Absolutely
June 10, 2001 by Tim Green

The current version of PHAkT (v8.2) has been correctly amended so that connections to an Access database can be easily created. It was always possible to connect to an Access database with all of the PHAkT versions, but an oversight meant you had to first edit one of the system files. This is no longer necessary.

My apologies for the late response to your question Stefan.