phpMyAdmin cannot create config.inc.php file using setup script

codrinstamate
codrinstamate used Ask the Experts™
on
I installed phpMyAdmin 3.1.3.1 and am trying to use the server setup script (http://localhost/phpmyadmin/setup/index.php), but cannot get it to work because it does not seem to have write access to the "config" directory that I created in the "...\htdocs\phpMyAdmin\" folder as described in the documentation.  I receive the following error in the setup:  "Cannot load or save configuration...Please create web server writable folder config in phpMyAdmin...".  

Here is what I know already:
1) I could use the sample config.inc.php file and manually edit it.  I am actually using it semi-successfully, able to access the phpmyadmin.
2) How to make the config folder writeable in XP on the cmdl with "attrib -r +s config" and the setting of the UseSystemForSystemFolders registry key per http://support.microsoft.com/kb/326549
3) This question has been asked before on this site, but never solved (http://tinyurl.com/n7smva)

I'm guessing that since the folder is the localhost folder htdoc it may be an apache server write access issue; Can anyone help me solve this?

phpmyadmin-config-error.PNG
wiki-instructions-for-setup.PNG
config-folder-writable.PNG
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2004

Commented:
The directory needs write access for the user running PHP.  In IIS, that is either the anonymous user for a non-application pool site, or the application pool identity user.  The default standards are IUSR_<machinename> and NETWORK SERVICE, respectively, though these can be changed through the IIS properties of each individual site or pool.

Author

Commented:
I'm running Apache on Windows not IIS.  What kind of access adjustments do i need to make in this case?
Top Expert 2004
Commented:
Apache runs under a specific user as well.  Check your server's conf files for the User directive.  That user will need the appropriate access to the files.

If that fails, check out filemon and procmon from http://live.sysinternals.com.  They may provide some insight into what account is being denied.
11/26 Forrester Webinar: Savings for Enterprise

How can your organization benefit from savings just by replacing your legacy backup solutions with Acronis' #CyberProtection? Join Forrester's Joe Branca and Ryan Davis from Acronis live as they explain how you can too.

Author

Commented:
Found my issue thanks to procmon!  Those are much like wireshark, good tools! Thanks for the suggestion and the link.  I was able to see that apache was actually was trying to write to the a non existent config folder in another phpmyadmin i had on my drive.  Created the config folder there and it worked. Thank sir.

That said, could you elaborate just a bit on where i might find info on how to identify the user Apache is running under and appropriate access rights for other users.  Is it with directives in the httpd.conf file?

Author

Commented:
Better yet, related question:  Given that in httpd.conf defines the DocumentRoot  as "C:/Program Files/xampp/htdocs"  , how does Apache find the link to when going to "C:\Program Files\xampp\phpMyAdmin\config"  and not  "C:\Program Files\xampp\htdocs\phpMyAdmin\config" the url: "http://localhost/phpmyadmin/" ?
Top Expert 2004

Commented:
To identify the Apache user, it is as simple as finding the User directive in the conf files.  See here:

http://httpd.apache.org/docs/2.2/mod/mpm_common.html#user

When phpMyAdmin is looking for its config file, that may not necessarily be a function of Apache, which means it may not care about Apache's configured DocumentRoot.  The DocumentRoot directive tells Apache where the top-level directory is for a given site, and sets a base for relative filenames.  For example, if you browse to http://localhost/phpmyadmin/, and the DocumentRoot for the localhost site is c:\Program Files\xampp\htdocs, then Apache is going to look for default documents in c:\Program Files\xampp\htdocs\phpmyadmin, or display the index list for that directory, or return a 404, depending on other configuration points.  Say it finds a default document index.php, and index.php uses an fopen() call.  fopen() does not hook into Apache's file location algorithms - it uses the underlying OS.  So if index.php calls for "C:\Anotherdir\config.inc", then Apache will try to access that file.  

The point here is that there is a very definite line between what Apache handles as part of the web service, and what Apache handles on behalf of the web application.  Once you are inside the web application, other file access mechanisms take over.  The user attempting the access will still be Apache's user, though.

Author

Commented:
Yes, been to the apache.org site, but wasn't sure how Windows Group/Users naming worked.

The thing was that  "c:\Program Files\xampp\htdocs\phpmyadmin" does not exist so I expected a return of 404 when going to "http://localhost/phpmyadmin/" , but that is not the case.  Think i found out how the magic happens in the Apache folder:

Alias /phpmyadmin "C:/Program Files/xampp/phpMyAdmin/"
    <Directory "C:/Program Files/xampp/phpMyAdmin">

The good old Alias directive.
Top Expert 2004

Commented:
Yupyup!  That would do it.

Author

Commented:
The Expert provided me with tools and links that lead to an acceptable solution. Needed to do a little more digging to find complete solution, but Expert was very helpful in getting there.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial