Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Changing Permissions


Dustin

Recommended Posts

here is a script written to do just that:

 

copy and save as set_config_permissions.php, place in the shop root and runs as mydomain.com/set_config_permissions.php

 

 

<?php
/*
set_config_permissions.php vers 1.0 by pyramids 09202006

Check and if wrong change the permissions on includes/configure.php to 0444
It will verify that the permissions were changed and report the details.
If the permissions are already set properly it will report that and nothing will be done.
*/

$change_this_file = 'includes/configure.php';

if (!file_exists($change_this_file)) {echo "<font size=4>Can't find the <b>'includes/configure.php'</b> file.   <b>NOTE: </b></font>";die();}

$change_perm_to = '0444';

clearstatcache();

if (!file_exists($change_this_file)){echo '<table align="center" width="100%" bgcolor="Lime"><tr><td align="center"><b><font face="Times New Roman" color="Black" size="4">ERROR -> cannot find the file ' . $change_this_file . ' make sure you are running this script from the root and the file is named correctly</font></b></td></tr></table>';
die;}

else{
$get_perm1 = substr(sprintf('%o', fileperms($change_this_file)), -4);
}

if ($get_perm1){
echo '<table align="center" width="100%" bgcolor="white"><tr><td align="center"><b><font face="Times New Roman" color="Black" size="4">TASK: To change permission of ' . $change_this_file . ' to ' . $change_perm_to . ' and verify it</font></b></td></tr></table>';}else{

echo '<table align="center" width="100%" bgcolor="red"><tr><td align="center"><b><font face="Times New Roman" color="white" size="4">ERROR -> cannot get the permission setting of ' . $change_this_file . ' </font></b></td></tr></table>';
die;}

if($get_perm1 == $change_perm_to){
echo '<table align="center" width="100%" bgcolor="white"><tr><td align="center"><b><font face="Times New Roman" color="blue" size="4">*** The file ' . $change_this_file . ' is already set to ' . $change_perm_to . '.  No changes needed. ***</font></b></td></tr></table>';
die;
}

if (!chmod('includes/configure.php', 0444)){echo '<table align="center" width="100%" bgcolor="red"><tr><td align="center"><b><font face="Times New Roman" color="white" size="4">ERROR -> cannot change the permission for ' . $change_this_file . ' to  ' .  $change_perm_to . '</font></b></td></tr></table>';
die;}

clearstatcache();

$get_perm2 = substr(sprintf('%o', fileperms($change_this_file)), -4);

if (!$get_perm2)
{echo '<table align="center" width="100%" bgcolor="red"><tr><td align="center"><b><font face="Times New Roman" color="white" size="4">ERROR -> cannot verify the permission that ' . $change_this_file . ' changed to ' .  $change_perm_to . '</font></b></td></tr></table>';
die;}

if ($get_perm2 == $change_perm_to)
{
echo '<table align="center" width="100%" bgcolor="Lime"><tr><td align="center"><b><font face="Times New Roman" color="Black" size="4">Success, we changed the file ' . $change_this_file . ' from ' . $get_perm1 . ' to permission  ' .  $get_perm2 . '</font></b></td></tr></table>';
}
else{
echo 'Unknown ERROR';
}

?>

Link to comment
Share on other sites

I am using godaddy for hosting and their data base is ASP.Net driven. How can I change the permissions of certain folders required for installation.. I cant change them on the FTP.. Thankss for your time...

 

Godaddy has manager for permission setting on FOLDERS

 

These are the different directory permissions you can apply to the custom directories you create for your Windows hosting account using the Hosting Manager:

 

Read Permission

This enables anonymous users to view the contents of a directory.

Web Permission

This enables anonymous users to view files in a directory through a Web browser using HTTP.

Browse Permission

This enables anonymous users to view all files in the directory (in directory listing format) by pointing their Web browser to the directory path. You must enable ?Read? and ?Web? permissions for "Browse" permission to work properly.

Write Permissions

This enables anonymous users to modify the contents of a directory.

Set Root

This enables you to set the directory/subdirectory folder as an application root in the Web server within your site. An application root is the root directory for an application. All directories and files contained within the application root are considered part of the application.

Reset

Click this to reset the permissions for this directory to their default values. This action will remove the directory from the list of custom-permission directories (but the directory on the file system will not be deleted).

 

Set your folders with write permissions

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...