View Full Version : Permissions, db or sql issue?
gamaken
01-04-2013, 08:40 AM
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:
$curdir = getcwd ();
$forumpath = './forums/';
chdir($forumpath);
include('./global.php');
chdir ($curdir);
permissions:
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:
$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.
What happens exactly? Are you getting an error?
gamaken
01-04-2013, 03:57 PM
What happens exactly? Are you getting an error?
No errors on the page, and I don't see anything in my logs.
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.
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?
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
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.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.