vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Permissions, db or sql issue? (https://vborg.vbsupport.ru/showthread.php?t=293571)

gamaken 01-04-2013 08:40 AM

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.

kh99 01-04-2013 10:06 AM

What happens exactly? Are you getting an error?

gamaken 01-04-2013 03:57 PM

Quote:

Originally Posted by kh99 (Post 2394627)
What happens exactly? Are you getting an error?

No errors on the page, and I don't see anything in my logs.

kh99 01-04-2013 04:00 PM

OK, but there must be some way that you know it isn't working.

gamaken 01-04-2013 05:19 PM

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.

kh99 01-04-2013 05:39 PM

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.

gamaken 01-04-2013 07:17 PM

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?

kh99 01-04-2013 09:55 PM

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?

gamaken 01-04-2013 10:04 PM

Quote:

Originally Posted by kh99 (Post 2394778)
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.


All times are GMT. The time now is 03:34 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00994 seconds
  • Memory Usage 1,729KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete