News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

SMF's SSI.php & Drupal.... What The...

Started by PHPD҉irector, March 05, 2009, 04:36:07 PM

Previous topic - Next topic

PHPD҉irector

Well in one of my drupal blocks i have this php code;

<?php

require("/home/phpdirec/public_html/forum/SSI.php");

ssi_news();

?>
 


I'm right in saying that should display my forums news yeah?

Well as soon as i save it i get an error page;

Fatal error: Cannot redeclare db_query() (previously declared in /home/phpdirec/public_html/includes/database.mysql-common.inc:33) in /home/phpdirec/public_html/forum/Sources/Subs.php on line 330

Warning: Table 'phpdirec_sitemain.smf_watchdog' doesn't exist query: INSERT INTO smf_watchdog (uid, type, message, variables, severity, link, location, referer, hostname, timestamp) VALUES (1, 'php', '%message in %file on line %line.', 'a:4:{s:6:\"%error\";s:12:\"user warning\";s:8:\"%message\";s:793:\"Table &#039;phpdirec_sitemain.smf_sessions&#039; doesn&#039;t exist\nquery: UPDATE smf_sessions SET uid = 1, cache = 0, hostname = &#039;92.23.81.77&#039;, session = &#039;messages|a:2:{s:6:\\&quot;status\\&quot;;a:3:{i:0;s:39:\\&quot;The block configuration has been saved.\\&quot;;i:1;s:39:\\&quot;The block configuration has been saved.\\&quot;;i:2;s:39:\\&quot;The block configuration has been saved.\\&quot;;}s:5:\\&quot;error\\&quot;;a:1:{i:0;s:215:\\&quot;warning: require(/forum/SSI.php) [&lt;a href=\\&#039;function.require\\&#039;&gt;function.requi in /home/phpdirec/public_html/includes/database.mysql.inc on line 128


What's going on?  :(
Every Pro Started Out As A Newb
http://phpdirector.co.uk - completely free and open source youtube clone

PHPD҉irector

Every Pro Started Out As A Newb
http://phpdirector.co.uk - completely free and open source youtube clone

MrPhil

Any chance that you've ended up requiring SSI.php twice? Try changing require() to require_once() and see if anything improves.

PHPD҉irector

Every Pro Started Out As A Newb
http://phpdirector.co.uk - completely free and open source youtube clone

karlbenson

does drupal have a function called db_query?

PHPD҉irector

Every Pro Started Out As A Newb
http://phpdirector.co.uk - completely free and open source youtube clone

PHPD҉irector

Every Pro Started Out As A Newb
http://phpdirector.co.uk - completely free and open source youtube clone

MrPhil

#7
Quote from: regularexpression on March 06, 2009, 06:26:19 PM
does drupal have a function called db_query?

Quote from: 110mb.com
Looks Like It

Well then, there you are. If both SMF and Drupal are trying to define a function "db_query", there's bound to be problems. I would suggest renaming the SMF version to "smf_db_query", and of course, all references to it. You might try first looking at both functions, and if they're exactly the same, you could just remove one of the definitions.

As SMF gets integrated with portals and CMSs on more and more sites, we're bound to see increasing numbers of such conflicts. It would be good for the SMF developers to start thinking about renaming all functions with an smf_ prefix to prevent such name conflicts.

PHPD҉irector

Sorry, i don't understand what you mean :S
Every Pro Started Out As A Newb
http://phpdirector.co.uk - completely free and open source youtube clone

MrPhil

Quote from: 110mb.com on March 07, 2009, 09:12:15 AM
Sorry, i don't understand what you mean :S

SMF defines a function named "db_query". Drupal evidently defines a function named "db_query". PHP doesn't like two separate definitions of something with the same name, even if the functions are identical. One of the names has to change.

PHPD҉irector

So how do i changes SMF's one? Will it be easy?

I hope it does not effect anything else if i change it :P

Thanks :P
Every Pro Started Out As A Newb
http://phpdirector.co.uk - completely free and open source youtube clone

MrPhil

Will it be easy? No. It would probably be best to download either SMF or Drupal (all the PHP files) to your PC. Scan through them and replace all instances of db_query with smf_db_query (or drupal_db_query, if you choose to modify Drupal instead). Re-upload all changed files and hope for the best. I would not try to do such an update in-place on your server, as it's too easy to make a mistake and change some of Drupal's db_query's or vice-versa. You'll have your hands full already, doing on your PC.

PHPD҉irector

Well, i'll do that when i have time but if there's another way i'd like to do that first.

Is it possible with php to scan my forum, find the news and return it. So like SSI but fsock, or curl or something?
Every Pro Started Out As A Newb
http://phpdirector.co.uk - completely free and open source youtube clone

PHPD҉irector

Quote from: 110mb.com on March 07, 2009, 10:55:11 AM
Well, i'll do that when i have time but if there's another way i'd like to do that first.

Is it possible with php to scan my forum, find the news and return it. So like SSI but fsock, or curl or something?
Every Pro Started Out As A Newb
http://phpdirector.co.uk - completely free and open source youtube clone

greyknight17

Is this issue resolved now? If not, have you tried the suggestion by MrPhil yet?

qqq111

I have the same problem. Is it possible to fix this?

JBlaze

Hello, just going through some old support topics. Do you still require assistance with this issue?

If so, please reply with more information about what isn't working.

Additionally, if this is already solved, please mark it solved by clicking 'Mark Topic Solved' at the lower left of your screen.
Jason Clemons
Former Team Member 2009 - 2012

Advertisement: