cpmFetch blocks in Efiction cpmFetch blocks in Efiction
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

cpmFetch blocks in Efiction

Started by lonebard, March 24, 2007, 03:19:52 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

lonebard

I've tried getting help from Calic0cat, the creator of the block for efiction to use cpmFetch. She couldn't figure out this problem I'm having and suggested I try posting over here and see if anyone could help out.

Versions
Efiction v 3.2.1
Coppermine v 1.4.1
CpmFetch v 1.6.4
PHP v 5.2.1
MySQL v 4.1.21

URL/Installation Directories...
http://www.themasque.net/efiction/
http://www.themasque.net/coppermine/
http://www.themasque.net/cpmfetch/

What I've Done...

-Installed cpmfetch okay, the test page displayed the two images I have in the coppermine gallery.

-Edited the cpgrecent.php file for the eFiction block to have the correct urls and uploaded it to the server.

<?php

require_once "../cpmfetch/cpmfetch.php";
$objCpm = new cpm("/coppermine");
$objCpm->cpm_setReturnType('html');
$options = array( 'subtitle' => '%t' 'tablestyle' => 'ccontent' );
$content $objCpm->cpm_viewLastAddedMedia(3,1,$options);


?>


-Initialized the block in the admin panel.

-Go back to the main page

-Receive error message.

QuoteA fatal MySQL error was encountered.
Query: SELECT message_text FROM fanfiction_messages WHERE message_name = 'welcome'
Error: (1146) Table 'bgmasque_coppermine.fanfiction_messages' doesn't exist

- I tried Calic0cat's suggestion of adding "$objCpm->cpm_close();" to the code just after the "$content" line and get this error...

QuoteWarning: mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /home/bgmasque/public_html/efiction/includes/dbfunctions.php on line 18

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/bgmasque/public_html/efiction/includes/dbfunctions.php on line 18
A fatal MySQL error was encountered.
Query: SELECT message_text FROM fanfiction_messages WHERE message_name = 'welcome'
Error: (2002) Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

Hopefully thats enough details to get someone's brain ticking.

Thanks in advance.

lonebard

(Theres no modify button on these forums?)

Quote from: Calic0cat
I'm leaning towards the php 5 being the problem, however, as jacci (the other poster with the same problem) was also running php 5.x. Definitely a point worth mentioning if you post over on the cpmfetch forum.

vuud

Quote from: lonebard on March 24, 2007, 04:46:15 PM
(Theres no modify button on these forums?)

Well, I have no idea about Effliction... I've never heard of it.

I would not recommend the close statement - technically you don't need it as PHP will clean up after you.  The older "stable" version of cpmfetch (we are on the cusp of a new age with cpmfetch 2.0) had a nasty habit of trashing your database connection if it re-used it.

I would not suspect problems with PHP5 and cpmfetch.  Not sure what the add on there does to it.

If you want to post links, I will check and see what efflication does for php blocks and what calic0cats module does.

Otherwise,  I only have the obvious question... does the table it says does not exist really exist ??


Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

lonebard

http://www.efiction.org/

calic0cats module - http://efiction.org/forums/index.php?topic=4487.0

As for your obvious question. The table exists in the database for eFiction, but I think that calic0cats' idea is that somehow cpmfetch isn't looking in the eFiction database it's looking for it in the coppermine database?

Hope that makes sense.

Calic0cat

Quote from: vuud on March 24, 2007, 10:53:04 PM
I would not recommend the close statement - technically you don't need it as PHP will clean up after you.  The older "stable" version of cpmfetch (we are on the cusp of a new age with cpmfetch 2.0) had a nasty habit of trashing your database connection if it re-used it.

I suggested the close in the faint  hope that eFiction would be smart enough to open a fresh connection. Unfortunately, it wasn't. :P

Quote
I would not suspect problems with PHP5 and cpmfetch.  Not sure what the add on there does to it.

If you want to post links, I will check and see what efflication does for php blocks and what calic0cats module does.


In order to see a working version of cpmfetch in eFiction blocks, you can check my own site at http://www.calic0cat.net - that one has efiction and Coppermine sharing a database, and cpmfetch and Coppermine are both in (separate) subdirectories of the eFiction directory. I also have it working on two test sites, one at http://test.calic0cat.net/efiction/ with a shared database but with eFiction and Coppermine in side-by-side directories, and one at http://test2.calic0cat.net/efiction/ with eFiction and Coppermine on separate databases and in side-by-side directories. It works just fine in all three cases. All working examples are eFiction 3.2 (both test sites) or 3.2.1 (live site only) with Coppermine Gallery 1.4.10 and cpmfetch 1.6.4. The MySQL version is 4.1.16 and PHP is 4.4.2 (with "extra web security"). All sites are (normally) bridged; however, I have disabled bridging on the test2 site in order to eliminate that as a source of the differing behaviour. Disabling the bridging made no difference; the cpmfetch blocks still work fine in eFiction.

*Edit* Important additional note: I've switched the http://test2.calic0cat.net/efiction site over to PHP 5.2.1 without encountering any errors, which shoots my PHP 5 theory all to heck.

Quote

Otherwise,  I only have the obvious question... does the table it says does not exist really exist ??


It looks to me as if, in lonebard's case (and that of another eFiction user experiencing the same issue), eFiction is looking in the Coppermine database instead of in the eFiction database. Why this issue crops up for them when it works fine for me, I don't know and I've run out of ideas to try.

vuud

Quote from: Calic0cat on March 25, 2007, 06:43:17 AM
I suggested the close in the faint  hope that eFiction would be smart enough to open a fresh connection. Unfortunately, it wasn't. :P

In order to see a working version of cpmfetch in eFiction blocks, you can check my own site at http://www.calic0cat.net - that one has efiction and Coppermine sharing a database, and cpmfetch and Coppermine are both in (separate) subdirectories of the eFiction directory. I also have it working on two test sites, one at http://test.calic0cat.net/efiction/ with a shared database but with eFiction and Coppermine in side-by-side directories, and one at http://test2.calic0cat.net/efiction/ with eFiction and Coppermine on separate databases and in side-by-side directories. It works just fine in all three cases. All working examples are eFiction 3.2 (both test sites) or 3.2.1 (live site only) with Coppermine Gallery 1.4.10 and cpmfetch 1.6.4. The MySQL version is 4.1.16 and PHP is 4.4.2 (with "extra web security"). All sites are (normally) bridged; however, I have disabled bridging on the test2 site in order to eliminate that as a source of the differing behaviour. Disabling the bridging made no difference; the cpmfetch blocks still work fine in eFiction.

*Edit* Important additional note: I've switched the http://test2.calic0cat.net/efiction site over to PHP 5.2.1 without encountering any errors, which shoots my PHP 5 theory all to heck.

It looks to me as if, in lonebard's case (and that of another eFiction user experiencing the same issue), eFiction is looking in the Coppermine database instead of in the eFiction database. Why this issue crops up for them when it works fine for me, I don't know and I've run out of ideas to try.

Hallo!

Thanks for making extending CpmFetch into another realm.  I really intended cpmFetch to be used this way - a resource for people to extend.

More so now...  See my developers page http://cpmfetch.fistfullofcode.com/developers/index.php if you are interested.  I am also going to produce documentation specifically for developers.

(The site is not quite done yet)


Sometime...  ;P

Anyway, its late here - I will mull this over tomorrow and see if I can come up with anything.

Oh - one of the first things may be to move to a dev version...  The code is much newer and it will be stable in the immediate future.  I believe I recoded the dbconnect stuff - so it should play nicer... but avoiding the close should have fixed that...

Hmmmmm






Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

lonebard

I'll try running a dev version but I'm not sure if the eFiction block that calicocat has created will support it.

lonebard

Installation of 1.9.12 went fine. I used the code displayed in the CpmFetch installer to replace the code from CalicoCat's efiction block. (Editing the URL to be correct obviously).

The funny thing is, it gives a very similar error to the previous one...

QuoteWarning: mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /home/bgmasque/public_html/efiction/includes/dbfunctions.php on line 18

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/bgmasque/public_html/efiction/includes/dbfunctions.php on line 18
A fatal MySQL error was encountered.
Query: SELECT message_text FROM fanfiction_messages WHERE message_name = 'welcome'
Error: (2002) Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

BUT it displays the two images... just nothing else.

http://www.themasque.net/efiction/

lonebard

I also noticed that the code given by the installer included the "  $objCpm->cpm_close();" line. I removed it and now I don't get the same error, but something similar.

QuoteA fatal MySQL error was encountered.
Query: SELECT message_text FROM fanfiction_messages WHERE message_name = 'welcome'
Error: (1146) Table 'bgmasque_coppermine.fanfiction_messages' doesn't exist

Seems to me Calico's idea was correct. Its looking in the coppermine database for the Efiction data.

vuud

Quote from: lonebard on March 27, 2007, 07:01:43 PM
I also noticed that the code given by the installer included the "  $objCpm->cpm_close();" line. I removed it and now I don't get the same error, but something similar.

Seems to me Calico's idea was correct. Its looking in the coppermine database for the Efiction data.

Yes, the installer is for basic use... covers %90 of the people.  So removing the close was good.

Okay, so for some reason cpmfetch is hyjacking the mysql connection?

Weird, it should not do that.

Without the cpmfetch stuff, I assume all runs well?




Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

lonebard

Yep, as soon as i disabled cpmFetch code block the eFiction mainpage comes up fine.

vuud

Quote from: lonebard on March 27, 2007, 07:49:16 PM
Yep, as soon as i disabled cpmFetch code block the eFiction mainpage comes up fine.

I am doing this from memory, so hope for the best.

In the cpmfetch_config.php file that the install generated, there should be an option in there named:

//  $config_overrides['cfUseExistingDBConnection'] = 'false';

Make sure it says false.  If it says true, change it look like this

$config_overrides['cfUseExistingDBConnection'] = 'true';

Let me know
Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

lonebard

Hmm, I removed the slashes, changed it to true, same error. No changes at all that I can see.

vuud

Quote from: lonebard on March 27, 2007, 10:57:20 PM
Hmm, I removed the slashes, changed it to true, same error. No changes at all that I can see.


Sorry, the line to change it to should be:

$config_overrides['cfUseExistingDBConnection'] = 'false';

If the commented out version was false, it will not help as that is what the install thinks your site needs.

I did some digging on this, but nothing neat yet.

Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

lonebard

Ah ok, sorry I missunderstood that.

Changed it to

  $config_overrides['cfUseExistingDBConnection'] = 'false';

Still no change.

lonebard

Ah, actually there is a change i guess the page was just cached at the time.

Now nothing comes up, I just get a pure white page.

http://www.themasque.net/efiction/

lonebard

Ok maybe the host had a brain fart for the few minutes.

no change.

(I hope double posting isnt against the rules here)

vuud

Quote from: lonebard on March 27, 2007, 11:59:45 PM
Ok maybe the host had a brain fart for the few minutes.

no change.

(I hope double posting isnt against the rules here)

I have no idea... I probably have to look at efiction some more.  Regrettably Command and Conquer just came out today, so it probably will not be tonight.  :D
Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

lonebard


vuud

Quote from: lonebard on March 28, 2007, 03:38:45 PM
ok.

...Thanks I guess.

I think you may be screwed...  Actually maybe not

Here is the problem and I am not sure why it happens to you, but not other people.

The version of eFiction I downloaded (3.2.1) is written in such a way that it does not care about what database it uses specifically.  It makes a faulty assumption that the last DB opened is the one that it wants to use.  So when you start efiction, then start cpmfetch, then do some more with efiction it goes kaplooey.  Splat.

Proper fix: The proper fix for this is that efiction rewrite the database code in there to care about what database link it is.  CpmFetch tracks its own connection, but eFiction just uses the last one opened.  Probably not that bad for someone to fix, since they seem to have kept all the database work in one file (I did not verify it, but seems that way).

Improper fixes:

  • Install CPG into the same database as eFiction, or vice-e-versa
  • Start CpmFetch and make a call for an image before eFiction creates its dbconnection
  • Fix the DB Code in eFiction yourself.

I know these are not the answers you are looking for.  I am happy to say that this is not a CpmFetch problem, but an unforseen condition in the efiction program (they never expected another db connection to be made).

Does that help?

Supporting docs for when they say its not an efiction problem:

http://us2.php.net/mysql_query

Quotelink_identifier

The MySQL connection. If the link identifier is not specified, the last link opened by mysql_connect() is assumed. If no such link is found, it will try to create one as if mysql_connect() was called with no arguments. If by chance no connection is found or established, an E_WARNING level warning is generated.











Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco