Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Backing up database through Admin interface...


caniol

Recommended Posts

I finally have everything working in my webstore (to include database restore) EXCEPT Database Backup. I get this message when I attempt to backup through the Admin interface:

 

Warning: fopen(../admin/backups/db_oscommerce-20080703122040.sql) [function.fopen]: failed to open stream: Permission denied in D:\Inetpub\blackstonetactical\catalog\admin\backup.php on line 29

 

Any ideas?

Link to comment
Share on other sites

in admin there is a backups folder.Chek the name is right and the permissions are ok.

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Link to comment
Share on other sites

in admin there is a backups folder.Chek the name is right and the permissions are ok.

 

Satish

 

Are there specific permissions just for the backup procedure. I can add products and I can restore the database through the Admin interface. I just can not do a backup through the interface.

Link to comment
Share on other sites

The backup folder should have a prper perm,ission so to allow a file to be written to it.

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Link to comment
Share on other sites

Warning: fopen(../admin/backups/db_oscommerce-20080703122040.sql) [function.fopen]: failed to open stream: Permission denied in D:\Inetpub\blackstonetactical\catalog\admin\backup.php on line 29

 

Any ideas?

Maybe the server is in safe mode or the hosting provider added fopen to the commands that cannot be executed (check the server info in the admin). Better ask your hosting provider why the server cannot open files it creates itself.

Link to comment
Share on other sites

Maybe the server is in safe mode or the hosting provider added fopen to the commands that cannot be executed (check the server info in the admin). Better ask your hosting provider why the server cannot open files it creates itself.

 

Thanks for the response! I checked server info - Safe mode is off. Not sure what I'm looking for as far as fopen setting.

 

Also, it can open and read the backup files that I created on a local server and then moved to /backups. But, it can not create a backup file on the production remote server.

Link to comment
Share on other sites

Thanks for the response! I checked server info - Safe mode is off. Not sure what I'm looking for as far as fopen setting.

 

Also, it can open and read the backup files that I created on a local server and then moved to /backups. But, it can not create a backup file on the production remote server.

 

Change your permission for /admin/backups/ folder to 777 ... be careful with this setting tho as it leaves you open for world writeable attacks...the way we do it is set the folder to 777 when we need to do a backup then change it back once backup has been made

Link to comment
Share on other sites

Change your permission for /admin/backups/ folder to 777 ... be careful with this setting tho as it leaves you open for world writeable attacks...the way we do it is set the folder to 777 when we need to do a backup then change it back once backup has been made

 

Thanks for the suggestion - but that didn't work either. The other thing that I don't understand is that it generates the same error when I check "do not store server-side".

Link to comment
Share on other sites

See this post and look for "disable functions" under Configuration in the admin (Server info).

 

Jan here is the info from "server info": disable_functions system,exec,passthru,shell_exec

 

I tried your contribution and got the same error. It chokes here:

	$fp = fopen(DIR_FS_BACKUP . $backup_file, 'w');

Link to comment
Share on other sites

Jan here is the info from "server info": disable_functions system,exec,passthru,shell_exec

 

I tried your contribution and got the same error. It chokes here:

	$fp = fopen(DIR_FS_BACKUP . $backup_file, 'w');

Maybe this is something trivial, like DIR_FS_BACKUP not being defined properly.

 

Try echo'ing that (around that line)

	  case 'backupnow':
	tep_set_time_limit(0);
	$backup_file = 'db_' . DB_DATABASE . '-' . date('YmdHis') . '.sql';
echo '<h2>path and file: ';
echo DIR_FS_BACKUP . $backup_file;
echo '</h2>';
exit;
	$fp = fopen(DIR_FS_BACKUP . $backup_file, 'w');

If there is nothing wrong, perhaps adding touch(DIR_FS_BACKUP . $backup_file); might give another error there or when fopen is called. That might give a clue about what goes wrong.

Link to comment
Share on other sites

Maybe this is something trivial, like DIR_FS_BACKUP not being defined properly.

 

Try echo'ing that (around that line)

	  case 'backupnow':
	tep_set_time_limit(0);
	$backup_file = 'db_' . DB_DATABASE . '-' . date('YmdHis') . '.sql';
echo '<h2>path and file: ';
echo DIR_FS_BACKUP . $backup_file;
echo '</h2>';
exit;
	$fp = fopen(DIR_FS_BACKUP . $backup_file, 'w');

If there is nothing wrong, perhaps adding touch(DIR_FS_BACKUP . $backup_file); might give another error there or when fopen is called. That might give a clue about what goes wrong.

 

Jan,

 

I tried these and got basically the same error message - no additional info.

 

After all of this, I'm assuming (which may be dangerous :blink: ) that what is happening is that the remote server is not allowing a file to be created programmatically (by the execution of osCommerce code). Is this assumption correct?

Link to comment
Share on other sites

I tried these and got basically the same error message - no additional info.

 

After all of this, I'm assuming (which may be dangerous :blink: ) that what is happening is that the remote server is not allowing a file to be created programmatically (by the execution of osCommerce code). Is this assumption correct?

I don't know what you mean with a remote server but if you would have added the touch "thing" than at least you would see a 0 K file backup file now in your list of backups. You don't mention anything about that.

Link to comment
Share on other sites

I don't know what you mean with a remote server but if you would have added the touch "thing" than at least you would see a 0 K file backup file now in your list of backups. You don't mention anything about that.

 

Here is what I get:

 

Warning: touch() [function.touch]: Unable to create file ../admin/backups/db_oscommerce-20080705151531.sql because Permission denied in D:\Inetpub\blackstonetactical\catalog\admin\backup.php on line 106

 

Warning: fopen(../admin/backups/db_oscommerce-20080705151531.sql) [function.fopen]: failed to open stream: Permission denied in D:\Inetpub\blackstonetactical\catalog\admin\backup.php on line 109

 

 

By remote server I mean the server at my hosting company. On my local machine I'm running WAMP5 for development and testing and am not having any problems with the backup procedure.

Link to comment
Share on other sites

Here is what I get:

 

Warning: touch() [function.touch]: Unable to create file ../admin/backups/db_oscommerce-20080705151531.sql because Permission denied in D:\Inetpub\blackstonetactical\catalog\admin\backup.php on line 106

So Satish was right after all. There is a permissions problem. I (only now) notice you say it is 700 for the user. However, the process that writes to that directory is likely not that user/owner of that directory. Try setting it higher, 755 for example.

 

I hope you rename your admin to something else. Admin is the default. If there is a weakness, it will be child play to find your admin...

Link to comment
Share on other sites

So Satish was right after all. There is a permissions problem. I (only now) notice you say it is 700 for the user. However, the process that writes to that directory is likely not that user/owner of that directory. Try setting it higher, 755 for example.

 

I hope you rename your admin to something else. Admin is the default. If there is a weakness, it will be child play to find your admin...

 

OK - one more problem. I am just now realizing that I am not able to change the setting from 700. Though It appears to change to 755, when I go back and check it, it goes back to 700. Any ideas?

Link to comment
Share on other sites

OK - one more problem. I am just now realizing that I am not able to change the setting from 700. Though It appears to change to 755, when I go back and check it, it goes back to 700. Any ideas?

No idea really. This is on a Windows server? Better ask your hosting provider. Maybe they can change the owner ship of the directory backups to the process that PHP runs under (if that is the applicable term for a Windows server). Perhaps the owner of the directory should be the webserver...

Link to comment
Share on other sites

No idea really. This is on a Windows server? Better ask your hosting provider. Maybe they can change the owner ship of the directory backups to the process that PHP runs under (if that is the applicable term for a Windows server). Perhaps the owner of the directory should be the webserver...

 

OK, I was attempting to change permissions using my ftp utility. It indicated that the permissions were changed, but really weren't. I ended up going into the webcontrol center provided by my hosting company and changed the permissions (Window's version) there. All works now. Thanks very much all!

 

Jan, PM incoming.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...