Difference between revisions of "Change File Permissions with PHP"
From Phoenix Cart User Guide
PeterRobert (talk | contribs) |
PeterRobert (talk | contribs) |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
| − | < | + | <div class="btn btn-grey btn-back">{{#fas:arrow-left}} Back</div> <div class="btn btn-grey btn-faq">{{#fas:question-circle}} FAQ Tips & Tricks</div> |
| − | |||
<hr> | <hr> | ||
| Line 10: | Line 9: | ||
*In this case the file permissions must be changed by creating a php file to change them. | *In this case the file permissions must be changed by creating a php file to change them. | ||
| − | + | ---- | |
*There are 2 '''configure.php''' files, ensure both have their file permissions changed. | *There are 2 '''configure.php''' files, ensure both have their file permissions changed. | ||
**Important: '''includes/configure.php''' and '''youradmin/includes/configure.php''' are different files in different locations, never open both at once to avoid confusion and ensure they are uploaded/saved back to the correct locations. | **Important: '''includes/configure.php''' and '''youradmin/includes/configure.php''' are different files in different locations, never open both at once to avoid confusion and ensure they are uploaded/saved back to the correct locations. | ||
*Set file permissions for these 2 files to 444 dependent on server host. This can be done in your host server account control panel or using FTP software e.g. using FileZilla, click file, right click, select '''File permissions...''' | *Set file permissions for these 2 files to 444 dependent on server host. This can be done in your host server account control panel or using FTP software e.g. using FileZilla, click file, right click, select '''File permissions...''' | ||
| − | + | ---- | |
*Open php file editing software e.g. <big>'''[[Notepad++]]'''</big> to see this: | *Open php file editing software e.g. <big>'''[[Notepad++]]'''</big> to see this: | ||
Latest revision as of 05:57, 25 March 2021
Back
FAQ Tips & Tricks
- It is necessary for some files like the configure.php files to be unwritable.
- This is controlled by their file permission.
- Changing their file permission to 444 makes the files unwritable.
- Some servers do not allow file permissions to be changed to 444 using FTP software e.g. FileZilla but they can be changed via the host server website control panel.
- Some servers do not allow file permission changes to 444 via FTP or control panel.
- In this case the file permissions must be changed by creating a php file to change them.
- There are 2 configure.php files, ensure both have their file permissions changed.
- Important: includes/configure.php and youradmin/includes/configure.php are different files in different locations, never open both at once to avoid confusion and ensure they are uploaded/saved back to the correct locations.
- Set file permissions for these 2 files to 444 dependent on server host. This can be done in your host server account control panel or using FTP software e.g. using FileZilla, click file, right click, select File permissions...
- Open php file editing software e.g. Notepad++ to see this:
- Copy and paste the following code into the new file.
- Ensure the root path of your website is correct i.e. the path before youradmin/includes/configure.php
- The correct root path for your website can be found in the back up copy of the configure.php file in the line beginning with
define('DIR_FS_CATALOG'
<?php
chmod("/var/www/xxxx/xxxx/xxxx/xxxx/htdocs/yoursite/youradmin/includes/configure.php", 0444);
echo "file permission was changed";
?>
- In Notepad++ go to menu File and click Save as...
- Save the file in the root folder/directory (e.g. catalog) of your website backup folder/directory with the name e.g. filepermission and choose .php from the All types(*.*) drop down menu.
- Using FTP file transfer software e.g. FileZilla, upload this file to the root folder/directory.
- In your web browser, enter yoursite/filepermission.php to run the file.
- If successful, the text file permission was changed will show.
- Check that the permissions have changed by viewing the files on the host server in the ftp software or website control panel.
- Change the root path in the code to /var/www/xxxx/xxxx/xxxx/xxxx/htdocs/yoursite/includes/configure.php to change the other configure.php file and repeat the process.
- Some servers will not allow any changes of file permissions to 444 by the website user by any means in which case the server must be contacted to instruct them to change the file permissions.
Phoenix Cart User Guide, like CE Phoenix Cart, is free to use but is maintained by unpaid volunteers.
All other content is the reserved Intellectual Property and Copyright of phoenixcart.org