1

I installed XAMPP and subsequently set a password for PHPMyAdmin & MySQL, which requires me to modify the file 'config.inc.php' to add my password to it. However, I simply can't find a way to successfully edit the file without getting a permission or operation error.

No matter what I try, I cannot modify the file to set up a password for PHPMyAdmin.

  1. I have tried logging in as root user using nano to modify the file and I still get permission errors.

  2. I've tried using my normal account and using sudo nano config.inc.php.

  3. I've tried changing permissions on the file to 755 and 777 i.e. chmod 755 config.inc.php.

Currently, due to these issues I can't access PHPMyAdmin at all now. Hoping someone can provide a solution to this nightmare.

Thanks!

EDIT

I'm running MacOS Mojave version 10.14.2, should have specified that my apologies!

When doing an ls -l on the file, I get:

-rw-r--r-- 1 daemon daemon 5109 18 Jan 09:40 config.inc.php

4
  • Hey Sam! Great first question on Superuser. Consider specifying which Unix-based OS you're running since permission issue mitigation can vary from system to system.
    – baelx
    Feb 7 '19 at 1:25
  • 1
    Apologies, I've edited the post to include the OS version. Thanks!
    – Sam Wood
    Feb 7 '19 at 6:57
  • Thanks for adding that, Sam. Not sure what’s going on for you but just to confirm, with each time you’re trying to access that file you’re getting rejected with an insufficient privileges error of some kind? Could you also do a ‘ls-l’ on that file and add the output to your question?
    – baelx
    Feb 7 '19 at 7:19
  • Sorry I took so long... I've edited again with the results of the ls -l command. Yes, I get the message '[ Error writing config.inc.php: Permission denied ]' when trying to edit using 'sudo nano'.
    – Sam Wood
    Feb 8 '19 at 20:38
0

Thanks for the info so far, Sam.

The permissions on that file correspond to 644. I would try to run the commands you've listed again, prefacing with sudo as necessary. Here are some steps to correct the issue:

1. Switch the owner of the config.inc.php file with:

sudo chown youruser:youruser config.inc.php

To be sure, you can find your user name by simply running whoami beforehand.

You will be asked to enter your root password for this operation. Make sure you enter it successfully and the command completes. Then run ls -l again and you should see:

-rw-r--r-- 1 youruser youruser 5109 18 Jan 09:40 config.inc.php

This should be plenty for you to be able make use of the file to solve your underlying issue.


2. Try accessing it with the nano command.

3. If for some reason you're denied. Try changing the permissions:

sudo chmod 755 config.inc.php

And ls -l again to make sure it worked.

4. Now try accessing the file again with the nano command.


All of these commands should run and take effect no problem as long as you got the root password correct. If they didn't, that would be really odd and by all accounts shouldn't really happen. If somehow that's the case, please post the exact error message and what step it occurred at. Your system quietly not responding to a sudo authenticated command to simply change a file's permissions would be bizarre.

6
  • I got some errors on step 1 unfortunately. I tried 'sudo chown samwood:samwood config.inc.php' but got the error message 'chown: samwood: illegal group name'. I then tried 'sudo chown samwood config.inc.php' and got 'chown: config.inc.php: Operation not permitted'.
    – Sam Wood
    Feb 8 '19 at 21:21
  • Okay, so now just try: sudo chown samwood:daemon config.inc.php
    – baelx
    Feb 8 '19 at 21:22
  • Got the same error running that command - 'chown: config.inc.php: Operation not permitted'.
    – Sam Wood
    Feb 8 '19 at 21:23
  • Based on what you've said, I'm thinking it's an issue with the way XAMPP & PHPMyAdmin works. I'm not sure how to describe it, but it's like those files I'm changing are on a server which is running on my machine. That's what XAMPP allows you to do. That said, I don't understand why I can't edit them using the root user. I've seen others on the internet editing them no problem with the same commands I'm using... the set up is no different either i.e. XAMPP runs an apache server on your local machine.
    – Sam Wood
    Feb 8 '19 at 21:29
  • I forgot about this at first but the chown issue is likely due to the recent version of MacOS you’re running in which there have been additions to the whole Unix based permissions system. See this answer for an explanation and some solutions: superuser.com/questions/279235/…
    – baelx
    Feb 8 '19 at 21:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.