By: Anonymous: tt0ne ()  May 08 2010 21:18 pm (Read 2378 times)  

Hey guys,

PHP Formatted Code
Sat May  8 07:33:31 2010 - Backup Filesize was less than 1kb Sat May  8 07:33:31 2010 - Command used for mysqldump: /usr/bin/mysqldump -hlocalhost -u<hidden> -p***** -Q <hidden> > "/var/www/glfusion/backups/glfusion_db_backup_2010_05_08_07_33_31.sql"
Sat May  8 07:33:41 2010 - 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE uid=887' at line 1. SQL in question: SELECT block FROM  WHERE uid=887 Sat May  8 07:33:52 2010 - 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE uid=1126' at line 1. SQL in question: SELECT block FROM  WHERE uid=1126



I've been getting this since about 1.1.7 - but I think it's the new version of MySQL or possibly PHP - and nothing to do with glfusion's backup function.

But I'm not sure - because if I do it at the command line - it works - but if do it through the web interface - I get the above in the error log.

I think it may have something to do with the fact that I use a bunch of crazy characters and non-alphanumeric (ie. punctuation and symbols) in our database password.

Why do you think?

- Marco

By: Anonymous: tt0ne ()  May 10 2010 00:21 am  

BUMP :-)

I've tried everything - any clues?!?

I guess I could just make a cron job that does the backup from time to time - but it's not as convenient as using the web interface.

- Marco

By: Mark (offline)  May 10 2010 07:55 am  

Marco, I'm attaching an updated database.php (goes in the public_html/admin/ directory). I've changed the way the executable is called. Give this a try and let me know if it solves the problem.

Thanks!
Mark


glFusion - Enhanced Content Management

Mark



Group Comfort
Level:
: +112
Registered:: 10/21/05

Posts: 6440
By: ironmax (offline)  May 10 2010 11:15 am  

Quote by: Mark

Marco, I'm attaching an updated database.php (goes in the public_html/admin/ directory). I've changed the way the executable is called. Give this a try and let me know if it solves the problem.

Thanks!
Mark



Thanks Mark,

I'm now able to backup my database. Couldn't figure out why I was coming up with zero bytes in the file. Then you posted this changed file and I put it in, and now everything works.

Great job.

Michael


Need web services? Contact Us at Spacequad Internet Services

ironmax



Group Comfort
Level:
: +11
Registered:: 09/14/06

Posts: 426
By: Anonymous: tt0ne ()  May 10 2010 14:27 pm  

What Max said!

Works perfectly now, Mark!

- Marco

By: Anonymous: tt0ne ()  May 10 2010 18:22 pm  

Mark,

I spoke too soon. I'm still having the same issue - 0 byte backups (cleared template cache of course - not that I think it matters with this) and here is what my error log reports:

PHP Formatted Code
Mon May 10 16:17:53 2010 - Command used for mysqldump: "/usr/bin/mysqldump"  -hlocalhost -u<removed> -p***** -Q <removed> > "/var/www/glfusion/backups/glfusion_db_backup_2010_05_10_16_17_53.sql"
Mon May 10 16:18:15 2010 - DBADMIN_exec: Executing: "/usr/bin/mysqldump"  -hlocalhost -u<removed> -p<removed> -Q heavenlysanctuary_com-rev4 > "/var/www/glfusion/backups/glfusion_db_backup_2010_05_10_16_18_15.sql"
Mon May 10 16:18:15 2010 - DBADMIN_execWrapper: Failed Command: "/usr/bin/mysqldump"  -hlocalhost -u<removed> -p<removed> -Q heavenlysanctuary_com-rev4 > "/var/www/glfusion/backups/glfusion_db_backup_2010_05_10_16_18_15.sql"
Mon May 10 16:18:15 2010 - Backup Filesize was less than 1kb
 



Weird, eh?

What do you think? Do you think it's related to using non-alphanumeric characters?

- Marco

By: Mark (offline)  May 10 2010 18:46 pm  

Try taking the -Q option off the command line and let's see if that makes a difference.

If that doesn't work, it may be a problem with special characters in the password.

Thanks!
Mark


glFusion - Enhanced Content Management

Mark



Group Comfort
Level:
: +112
Registered:: 10/21/05

Posts: 6440
By: Anonymous: tt0ne ()  May 11 2010 00:54 am  

Ok, Mark, I removed -Q from the configuration option in glFusion (did I put it there or is that default?)... Still no go.

I bet it's because I have an "!" in my password.

- Marco

By: Mark (offline)  May 11 2010 07:47 am  

Marco, I think I have it this time. Give this new database.php (public_html/admin/ directory) a try and let me know if it works.

Thanks!
Mark


glFusion - Enhanced Content Management

Mark



Group Comfort
Level:
: +112
Registered:: 10/21/05

Posts: 6440
By: Anonymous: tt0ne ()  May 11 2010 20:55 pm  

Ok, I used the new file and I also turned "-Q" off and on - both attempts still failed with a 0 byte file. Here is the log:

PHP Formatted Code

Tue May 11 18:52:24 2010 - DBADMIN_exec: Executing: "/usr/bin/mysqldump"  -hlocalhost -u<removed> -p***** -Q heavenlysanctuary_com-rev4 > "/var/www/glfusion/backups/glfusion_db_backup_2010_05_11_18_52_24.sql"
Tue May 11 18:52:25 2010 - DBADMIN_execWrapper: Failed Command: "/usr/bin/mysqldump"  -hlocalhost -u<removed> -p"<removed>" -Q heavenlysanctuary_com-rev4 > "/var/www/glfusion/backups/glfusion_db_backup_2010_05_11_18_52_24.sql"
Tue May 11 18:52:25 2010 - Backup Filesize was less than 1kb
Tue May 11 18:52:25 2010 - Command used for mysqldump: "/usr/bin/mysqldump"  -hlocalhost -u<removed> -p***** -Q heavenlysanctuary_com-rev4 > "/var/www/glfusion/backups/glfusion_db_backup_2010_05_11_18_52_24.sql"
 



I can see you used quotes - maybe we need ' instead of " or even ` - which is why you're the programmer - because those little quotes are what make me crazy nuts when it comes to hacking code.

I won't even get into the ; and , and : ;-)

- Marco

By: Mark (offline)  May 11 2010 20:59 pm  

Marco, are there any other special characters in the password, like a quote (single or double). I've tested the new code on Windows and Unix (Linux) hosts and it is working fine when a | (pipe character) is in the password.

Do this, check your web server's error log and let's make sure we aren't overlooking some other issue. See if the web server logs show anything about the exec() PHP call or any other info like a permission issue...

Thanks!
Mark


glFusion - Enhanced Content Management

Mark



Group Comfort
Level:
: +112
Registered:: 10/21/05

Posts: 6440
By: Anonymous: tt0ne ()  May 12 2010 00:43 am  

I don't see any complaints from PHP or Apache in the webserver logs - but I'll go ahead and give you all the strange characters in our database password with the suspicion that it's not gonna help anyone discover what it is.

There is a "!", "@", and a "$" in the password. Is one of those the problem?

- Marco

By: Mark (offline)  May 12 2010 07:38 am  

Marco, I've tested with all those characters without any issues. It is working for me both on Windows and Linux based hosts. I wonder if there isn't something else hiding from us.....

Generally, one of the following will prevent external programs from running:

1. Invalid permissions. The web server does not have permissions to run the program. Could be a perm problem on the executable or the directory where it is stored.

2. PHP Safe Mode settings will restrict what external executables can be executed.

3. Insufficient memory - PHP cannot allocate enough memory to load and run the external command.

Generally, all of these will provide some error in the web server's error log, but depending on the server configuration, I guess they could be suppressed.

Can you try suing to the user that the web server is running as and then running the command from the prompt to validate there are no permission issues?

Thanks!
Mark


glFusion - Enhanced Content Management

Mark



Group Comfort
Level:
: +112
Registered:: 10/21/05

Posts: 6440
By: Anonymous: tt0ne ()  May 12 2010 08:07 am  

Ok, check this out, Mark:

PHP Formatted Code

web:/var/www/glfusion# su www-data
\h:\w$ /usr/bin/mysqldump -hlocalhost -uheavenlysa -p<removed> -Q heavenlysanctuary_com-rev4 > ./testdump.sql
mysqldump: Got error: 1045: Access denied for user 'heavenlysa'@'localhost' (using password: YES) when trying to connect
\h:\w$ /usr/bin/mysqldump -hlocalhost -uheavenlysa -p -Q heavenlysanctuary_com-rev4 > ./testdump.sql
Enter password:
\h:\w$ ls -laSh testdump.sql
-rw-r--r-- 1 www-data www-data 103M May 12 06:00 testdump.sql
\h:\w$
 



So, as you can see - on the first attempt - I put the password on the command line and it failed.

On the second attempt, I just used -p without a password so that it would prompt me for one - and that worked.

So, then I decided to try:

PHP Formatted Code

\h:\w$ /usr/bin/mysqldump -hlocalhost -uheavenlysa -p'<removed>' -Q heavenlysanctuary_com-rev4 > ./testdump.sql
\h:\w$ ls -laSh testdump.sql
-rw-r--r-- 1 www-data www-data 103M May 12 06:04 testdump.sql
\h:\w$
 



Notice I put the '' after the -p - and that worked... so now at least I know what the problem is - I think it's the order of my symbols - now that I look at it - the password could be interpreted as a variable (I think that's the right coding term - lol!)...

What do you think?

- Marco

By: Mark (offline)  May 12 2010 08:15 am  

That would make sense. Still, we should be able to pass it via PHP. I'm attaching one more update to try, let me know if this makes a difference.

Thanks!
Mark


glFusion - Enhanced Content Management

Mark



Group Comfort
Level:
: +112
Registered:: 10/21/05

Posts: 6440
17 posts :: Page 1 of 2
  • 1
  • 2
All times are CDT. The time is now 03:22 am.
Normal Topic Normal Topic
Locked Topic Locked Topic
Sticky Topic Sticky Topic
New Post New Post
Sticky Topic w/ New Post Sticky Topic w/ New Post
Locked Topic w/ New Post Locked Topic w/ New Post