strocknar Posted March 14, 2007 Share Posted March 14, 2007 So i've got this server running a Progress DB. I need to connect to it using PHP to pull customer/product data. My web server is running FC6 with Apache and PHP. I got iODBC installed and connecting to the database and created a simple page to create a connection: <?php $conn = odbc_connect(DSN, NAME, PASS) or die ("error connecting"); ?> I just want to see if the page will run successfully. It seems to except for one small thing. When I run the file in a web browser it asks if I want to save it. Any ideas why this would be happening? Quote Link to comment https://forums.phpfreaks.com/topic/42728-odbc/ Share on other sites More sharing options...
per1os Posted March 14, 2007 Share Posted March 14, 2007 In the apache httpd.conf is .php recognized as an extension? --FrosT Quote Link to comment https://forums.phpfreaks.com/topic/42728-odbc/#findComment-207306 Share on other sites More sharing options...
strocknar Posted March 14, 2007 Author Share Posted March 14, 2007 yes. I've got several other pages that come up fine. If I take out the DSN or change the NAME or PASS, it errors out. It seems that if odbc_connect makes a connection, it wants me to save it somewhere. Quote Link to comment https://forums.phpfreaks.com/topic/42728-odbc/#findComment-207310 Share on other sites More sharing options...
per1os Posted March 14, 2007 Share Posted March 14, 2007 Have you tried saving it and see what the output produces? --FrosT Quote Link to comment https://forums.phpfreaks.com/topic/42728-odbc/#findComment-207315 Share on other sites More sharing options...
strocknar Posted March 14, 2007 Author Share Posted March 14, 2007 yup...blank document Quote Link to comment https://forums.phpfreaks.com/topic/42728-odbc/#findComment-207318 Share on other sites More sharing options...
boo_lolly Posted March 14, 2007 Share Posted March 14, 2007 try using fread() and printing it out to the browser. Quote Link to comment https://forums.phpfreaks.com/topic/42728-odbc/#findComment-207326 Share on other sites More sharing options...
strocknar Posted March 14, 2007 Author Share Posted March 14, 2007 still nothing Quote Link to comment https://forums.phpfreaks.com/topic/42728-odbc/#findComment-207354 Share on other sites More sharing options...
boo_lolly Posted March 14, 2007 Share Posted March 14, 2007 post your fread code. read this tutorial for help Quote Link to comment https://forums.phpfreaks.com/topic/42728-odbc/#findComment-207358 Share on other sites More sharing options...
strocknar Posted March 14, 2007 Author Share Posted March 14, 2007 Probably should have been more specific. the code: <?php $fname = "./dled.php"; $handle = fopen($fname, "r"); $contents = fread($handle, filesize($fname)); echo $contents; fclose($handle); ?> Outputs Warning: fread() [function.fread]: Length parameter must be greater than 0 so technically nothing Quote Link to comment https://forums.phpfreaks.com/topic/42728-odbc/#findComment-207361 Share on other sites More sharing options...
per1os Posted March 14, 2007 Share Posted March 14, 2007 Have you tried to do a SQL statement after the connection is initiated? --FrosT Quote Link to comment https://forums.phpfreaks.com/topic/42728-odbc/#findComment-207365 Share on other sites More sharing options...
strocknar Posted March 14, 2007 Author Share Posted March 14, 2007 I've tried pulling the tables with odbc_tables($conn), i've tried echo ing text (both before and after the connection) and i've tried printing text. I could see it asking me to download if there was something actually in the file, but the filesize is 0bytes. Quote Link to comment https://forums.phpfreaks.com/topic/42728-odbc/#findComment-207372 Share on other sites More sharing options...
per1os Posted March 14, 2007 Share Posted March 14, 2007 No clue, maybe try and google ODBC and PHP and see if there is a bug or some type of setting that needs to be set. --FrosT Quote Link to comment https://forums.phpfreaks.com/topic/42728-odbc/#findComment-207380 Share on other sites More sharing options...
boo_lolly Posted March 14, 2007 Share Posted March 14, 2007 try this: <?php $fname = "dled.php"; $handle = fopen($fname, "r"); while(!feof($handle)){ $line = fgets($fp, 1024); echo $line ."\n"; } fclose($handle); ?> Quote Link to comment https://forums.phpfreaks.com/topic/42728-odbc/#findComment-207386 Share on other sites More sharing options...
strocknar Posted March 14, 2007 Author Share Posted March 14, 2007 lol, that was fun boo. i got Warning: fgets(): supplied argument is not a valid stream resource in /opt/lampp/htdocs/chris/yada.php on line 5 infinitely. Quote Link to comment https://forums.phpfreaks.com/topic/42728-odbc/#findComment-207391 Share on other sites More sharing options...
per1os Posted March 14, 2007 Share Posted March 14, 2007 http://us2.php.net/manual/en/function.odbc-connect.php http://www.easysoft.com/developer/languages/php/apache_odbc.html Maybe those can help? --FrosT Quote Link to comment https://forums.phpfreaks.com/topic/42728-odbc/#findComment-207397 Share on other sites More sharing options...
boo_lolly Posted March 14, 2007 Share Posted March 14, 2007 haha sorry. i normally use $fp instead of $handle... force of habit... this will work: <?php $fname = "dled.php"; $handle = fopen($fname, "r"); while(!feof($handle)){ $line = fgets($handle, 1024); echo $line ."\n"; } fclose($handle); ?> Quote Link to comment https://forums.phpfreaks.com/topic/42728-odbc/#findComment-207400 Share on other sites More sharing options...
artacus Posted March 14, 2007 Share Posted March 14, 2007 Are you using the Merant ODBC driver? Its quirky at best. I don't think I ever found a PROGRESS ODBC driver for *nix. Mine is set up on a Windows box, but it works. 1) Set up a system DSN. Set the isolation level to "READ UNCOMMITED" or it will lock other users out when you are querying tables. 2) In php try something like this $dsn = 'PROGRESS'; $user = 'odbcuser'; $pw = 'password'; $odbc_con = odbc_connect($dsn,$user,$pw,SQL_CUR_USE_ODBC) or die(odbc_error()); Quote Link to comment https://forums.phpfreaks.com/topic/42728-odbc/#findComment-207405 Share on other sites More sharing options...
strocknar Posted March 14, 2007 Author Share Posted March 14, 2007 Frost: those two websites as well as http://jehiah.cz/archive/compiling-shared-php-modules are what I used to set up PHP. I had lampp installed and didn't want to recompile php/apache. boo: after that, page comes up blank. artacus: I'm using the ODBC driver from the progress website (progress.com i think). You have to have aaccount with them to log in and all that fancy stuff in order to get it tho. I had to get the driver from the provider of a seperate piece of software (the one connecting to this godforsaken database in the firstplace). P.S. Thank you all for your help Quote Link to comment https://forums.phpfreaks.com/topic/42728-odbc/#findComment-207410 Share on other sites More sharing options...
artacus Posted March 14, 2007 Share Posted March 14, 2007 Heh, you think its godforsaken now, just wait 'till you start running queries against it. Its SLOWWWW. Especially if you are used to counting your query time in milliseconds in mysql. Quote Link to comment https://forums.phpfreaks.com/topic/42728-odbc/#findComment-207428 Share on other sites More sharing options...
strocknar Posted March 15, 2007 Author Share Posted March 15, 2007 @artacus: great...yet more reasons to dislike it anyone else have any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/42728-odbc/#findComment-208181 Share on other sites More sharing options...
strocknar Posted March 16, 2007 Author Share Posted March 16, 2007 I went ahead recompiled Apache2 and PHP5 from source...turns out I wasn't actually making a connection...Back to the drawing board! Quote Link to comment https://forums.phpfreaks.com/topic/42728-odbc/#findComment-208752 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.