Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 01-04-2013, 08:40 AM
gamaken gamaken is offline
 
Join Date: Aug 2010
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Permissions, db or sql issue?

I realize this isn't a specific vbulletin issue, but I'm pulling my hair out trying to determine why I can't include global.php ouside of my forums directory.

I'm attempting to include global.php in my index (as well as a few other files) so I can load forum stats. This is my php:
Code:
$curdir = getcwd ();
$forumpath = './forums/';
chdir($forumpath);
include('./global.php');
chdir ($curdir);
permissions:
Code:
ls -al forums/global.php 
-rw-r--r-- 1 www-data www-data 2071 Jan  2 05:56 forums/global.php
This isn't working for some reason. I can connect to the db without using the global.php just fine:
Code:
$con = mysql_connect("localhost","user","pass");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
  mysql_select_db("db", $con);
If anyone has some ideas, I would be most grateful. Thanks.
Reply With Quote
  #2  
Old 01-04-2013, 10:06 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What happens exactly? Are you getting an error?
Reply With Quote
  #3  
Old 01-04-2013, 03:57 PM
gamaken gamaken is offline
 
Join Date: Aug 2010
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
What happens exactly? Are you getting an error?
No errors on the page, and I don't see anything in my logs.
Reply With Quote
  #4  
Old 01-04-2013, 04:00 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, but there must be some way that you know it isn't working.
Reply With Quote
  #5  
Old 01-04-2013, 05:19 PM
gamaken gamaken is offline
 
Join Date: Aug 2010
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes, this was working 100% on another server, which is why I'm thinking it's something related to permissions or mysql. I don't think it's a php error as nothing has changed, except forum paths and database information.
Reply With Quote
  #6  
Old 01-04-2013, 05:39 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

But you still haven't said exactly what's not working. Are you getting a white page? Just not getting the expected results somewhere?

It could be the cookie path settings. If your script isn't in the forum directory you need to set the cookie path to '/' or else your custom script won't see you as logged in.
Reply With Quote
  #7  
Old 01-04-2013, 07:17 PM
gamaken gamaken is offline
 
Join Date: Aug 2010
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The bridge is to post new topics/stats to the index. I have a seperate login bridge that is working fine.
I'm using a cron job to run a php script that grabs forum stats (new posts, hot posts, etc.), and writes them to a file to be included in the index (the files are writable).
The index isn't updating where I'm including the stats, but if I manually change these files it shows on the index.
So I can narrow it down to the php file called by cron.
This is the problem:
Access denied for user 'www-data'@'localhost' (using password: NO)
It's using www-data because no connection is being made to the database. I figured if it was using global.php that would take care of the db connection right?
Reply With Quote
  #8  
Old 01-04-2013, 09:55 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So you're saying that your script includes global.php, then tries to use the mysql_ php calls assuming the database connection has been setup? That does sound like it should work so I guess I'm not a lot of help. Did you compare the config.php settings with the server that works?
Reply With Quote
  #9  
Old 01-04-2013, 10:04 PM
gamaken gamaken is offline
 
Join Date: Aug 2010
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
So you're saying that your script includes global.php, then tries to use the mysql_ php calls assuming the database connection has been setup? That does sound like it should work so I guess I'm not a lot of help. Did you compare the config.php settings with the server that works?
Yes. It's the same.
I appreciate you trying to help. I've searched everywhere I can think of for the solution, and nobody seems to have any idea.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:51 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04071 seconds
  • Memory Usage 2,236KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (3)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (9)postbit
  • (9)postbit_onlinestatus
  • (9)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete