Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I placed a phpmyadmin directory in the sites folder on the Mac. When I open the location of phpmyadmin in the browser, http://new-host-w.home/~username/phpmyadmin/ it opens as a directory instead of a site. If I open index.php, it opens as a text file.

share|improve this question
up vote 1 down vote accepted

The local server environment on OS X does not provide native PHP support. Try MAMP, which is an Apache, PHP and MySQL bundle for Mac.

share|improve this answer
I installed PHP. My question was why when I browse to that directory and open the index.php, the browser shows a text file instead of a web page. – user823527 Mar 23 '12 at 23:55
@user823527, since the local server doesn't have native PHP support, the web server will serve up that page as text, rather than rendering it as you intended. You'd need to add to either run MAMP, or do something similar to this tutorial to enable PHP: – JW8 Mar 23 '12 at 23:59
And the answer is because the server doesn't render the php. Try with a sample .php file with phpinfo() and see if that works. If not, try reinstalling php/MAMP. – 0sh Mar 24 '12 at 0:00

As @Milosz mentioned, MAMP is a great option. Another option is to enable PHP for your local web server, as shown in this tutorial (for Leopard - 10.5). The steps should be similar for other versions of OS X. Quick synopsis:

  • Locate httpd.conf for the local Apache web server
  • With appropriate admin privileges (via sudo, etc.), uncomment the following line: LoadModule php5_module libexec/apache2/
  • Set up php.ini to enable PHP support

You should then be able to browse to the page that you noted in your question and see it as a web page instead of text.

share|improve this answer

As JW8 mentions, locate httpd.conf (usually /etc/apache2/httpd.conf) and go at the end of the file. You should see something like this :

<IfModule php5_module>
  AddType application/x-httpd-php .php
  AddType application/x-httpd-php-source .phps
  <IfModule dir_module>
    DirectoryIndex index.html


DirectoryIndex index.html


DirectoryIndex index.html index.php

and phpmyadmin should work.

You can also see here for a more complete tutorial on installing phpmyadmin.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .