Page 1 of 1

DB Optimization Cron Job Permission Problems After Upgrade

PostPosted: Mon Nov 26, 2007 12:46 pm
Author: jast
Your phpBB Version: 2.0.22
phpBB Type: phpBB / IMPortal
MODs: No
Your knowledge: Basic Knowledge
Board URL: http://homeworld.homelinux.com/portal/

PHP Version:
MySQL Version:


What was done before the problem appeared?
I upgraded from the 141 release to 141d.


What was done to try to solve the problem?
Checked file ownership.



De.scription and Message

I had an operational site running IM141 and then applied the 141d update to get all of the CTracker fixes at once. After copying all of the files over my old site, I now get the following error whenever the DB Optimization cron job runs. It appears that the cron job is now trying to run with the permissions of the web server instead of the permissions of the portal database.

Code: Select all
 Warning]: Access denied for user 'www-data'@'localhost' (using password: NO) in /var/www/portal/includes/optimize_database_cron.php on line 65  Warning: mysql_list_tables() [function.mysql-list-tables]: A link to the server could not be established in /var/www/portal/includes/optimize_database_cron.php on line 65  Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in /var/www/portal/db/mysqli.php on line 354  Warning: Cannot modify header information - headers already sent by (output started at /var/www/portal/includes/optimize_database_cron.php:65) in /var/www/portal/includes/sessions.php on line 421  Warning: Cannot modify header information - headers already sent by (output started at /var/www/portal/includes/optimize_database_cron.php:65) in /var/www/portal/includes/sessions.php on line 422  Warning: Cannot modify header information - headers already sent by (output started at /var/www/portal/includes/optimize_database_cron.php:65) in /var/www/portal/includes/page_header.php on line 1156  Warning: Cannot modify header information - headers already sent by (output started at /var/www/portal/includes/optimize_database_cron.php:65) in /var/www/portal/includes/page_header.php on line 1158  Warning: Cannot modify header information - headers already sent by (output started at /var/www/portal/includes/optimize_database_cron.php:65) in /var/www/portal/includes/page_header.php on line 1159


How do I get the cron job to run under the proper database user account?

Re: DB Optimization Cron Job Permission Problems After Upgra

PostPosted: Mon Nov 26, 2007 12:58 pm
Author: CaNNon
Think they all fall back to line 65 and
Access denied for user 'www-data'@'localhost' (using password: NO)

You should check the password

Re: DB Optimization Cron Job Permission Problems After Upgra

PostPosted: Mon Nov 26, 2007 1:03 pm
Author: jast
Yeah, I know. The thing is, it never ran the cron job under the www-data (webserver) account before I upgraded to 141d. I believe it always ran the cron job under the MySQL user account I created for the portal. The www-data account doesn't have any permissions to the database.

Re: DB Optimization Cron Job Permission Problems After Upgra

PostPosted: Wed Nov 28, 2007 11:18 pm
Author: jast
:ping:

Anyone else have an idea why the cron job is trying to run under the web server user account instead of the portal user account? It never did this before...my cron job count was always incrementing and I never got any errors in my logs.

PostPosted: Mon Dec 10, 2007 11:59 am
Author: jast
:ping:

Still looking for help on this one. Something between 1.4.1 and 1.4.1d changed the user that cron job was running under. Does anyone know where this is controlled?

Re: DB Optimization Cron Job Permission Problems After Upgra

PostPosted: Mon Dec 10, 2007 3:30 pm
Author: Helter
the only thing I can think of is that you originally uploaded the files as an ftp user and the update as the root user. 141 to 141d only includes tested bugfixes and none are related to your problem.
in your ftp client, or cpanel file manager, check file ownership. Generally speaking, if the files are owned by root, they will not be accessible to anyone else.

Re: DB Optimization Cron Job Permission Problems After Upgra

PostPosted: Mon Dec 10, 2007 11:12 pm
Author: jast
Helter,
Thanks for the tip. I did the upgrade locally on my server, and I think I did use my admin account. However, I always do a "chown -R www-data:www-data" on the portal directory to make the files are owned by the Apache user account. This is the same thing I've done for every other install. I just checked in the config.php file and made sure that the username and password were set correctly for the integramod database and it is set correctly to portal_user.

All I can think of is that optimize_database_cron.php is being executed by the www-data user, as it should be, but it is trying to access the database as www-data instead of portal_user like the rest of the .php files are doing. I don't get a permissions error when I try to do a post, so I know portal_user has access to the database. Is there something different in optimize_database_cron.php as far as how the database is being accessed?

Re: DB Optimization Cron Job Permission Problems After Upgra

PostPosted: Tue Dec 11, 2007 12:25 am
Author: Helter
i have no idea why your forum would be trying to use 2 separate accounts. You could check to ses if that is the case by adding the www-data user, as a user to your forum db.

Re: DB Optimization Cron Job Permission Problems After Upgra

PostPosted: Tue Dec 11, 2007 1:54 pm
Author: jast
I created a database user www-data and gave it SELECT, INSERT, UPDATE, DELETE, EXECUTE privileges. I also assigned a password to the user. I then set the cron job to run every 20 seconds and received the same error message as in the previous post. I then deleted the password and received the following error message.

[code]Warning]

So, it appears the www-data user is connecting to the database, but there is still a problem somewhere.