Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create or edit file content on root

I have one website, not i want when i upload this site on live server it should ask for database username, password, site url..etc. Something like website installer. It is working fine in LOCAL system.

Now my problem is: i need to change RewriteBase in .htaccess file. But this file is located at root of site. So i am getting permission issue to create new file or edit/copy file which is located at root.

Warning: rename(generate.htaccess,.htaccess): Permission denied

Warning: copy(.htaccess): failed to open stream: Permission denied

What should i do. Please help.

Thanks.

like image 357
VibhaJ Avatar asked May 24 '12 05:05

VibhaJ


People also ask

How do you edit a root file?

Enable write permission to all of the file that you want to edit (Hold on the file – File Operations – Permission – tick all on write). That's it. You can open the file as text and edit it with Jota Text Editor now. Remember to change the permission back to previous settings after done changing.

How do you create a root file?

Creating a ROOT fileUse the function Open() from TFile to create or open a ROOT file. For the second argument, the following options are available: "RECREATE" : create a ROOT file, replacing it if it already exists. "CREATE" or "NEW" : create a ROOT file.


1 Answers

To Create/Modify file on root directory you must have to give 0777 permission to your root directory. This is not a good practice.

I suggest create empty .htaccess or other required file with 777 permission initially. Before writing content in that file first check write permission after that copy content from source file (in your case from where you trying to copy).

Hope this may help.

like image 68
Nimit Dudani Avatar answered Oct 13 '22 15:10

Nimit Dudani