Reputation: 3787
I'm trying to create a installation script for my PHP(CodeIgniter) app and i need to write database info that i get from user to CI database conf file. Of course i run into permissions problem doing so because config directory doesn't have write permission. So my question is how would this be possible without making user who installs my app to manage folder permissions him/herself.
Upvotes: 0
Views: 242
Reputation: 11623
You could try something like this:
- setup script checks permission on configuration files at startup
- if the files are not writeable, ask user to manually set permission manually (using FTP)
- after setup finishes the execution, use `chmod` command to make the files not writeable
- after the setup is completed, ask the user to delete the setup scripts for security reasons (so the setup is not run again by someone else)
You can use chmod
to change the folder/file permission:
// Everything for owner, read and execute for others
chmod("/somedir/somefile", 0755);
http://php.net/manual/en/function.chmod.php
Upvotes: 0
Reputation:
They have to have access to the webserver's folder read/write options on their end - many hosts don't let you do this through FTP access so you can't even do a direct solution using that - they may have to go through the Control Panel system to do this type of task.
There's no "Run this script and it'll change folder permissions" code out there - the end user will have to be savvy enough to know how to do this.
Upvotes: 1