install phpmyadmin on mac

Use MacPorts to install the latest version of phpMyAdmin.

sudo port install phpmyadmin

Update Apache’s httpd.conf file to find phpmyadmin. First add the following lines to the end of the file:

# Local access to phpmyadmin installation
Include conf/extra/httpd-phpmyadmin.conf

and then create a file /opt/local/apache2/conf/extra/httpd-phpmyadmin.conf containing this text:

AliasMatch ^/phpmyadmin(?:/)?(/.*)?$ "/opt/local/www/phpmyadmin$1"

<Directory "/opt/local/www/phpmyadmin">
  Options -Indexes
  AllowOverride None
  Order allow,deny
  Allow from all

  LanguagePriority en de es fr ja ko pt-br ru 
  ForceLanguagePriority Prefer Fallback
</Directory>

Restart Apache so that your changes take effect

sudo /opt/local/apache2/bin/apachectl -k restart

Note: Make sure to use the full path as shown here, as apachectl in your PATH refers to the system provided Apache!

Finally, you need to set up the phpMyAdmin configuration to access mySQL. First, set up the config file:

cd /opt/local/www/phpmyadmin/
sudo cp config.sample.inc.php config.inc.php

This will create a file config.inc.php in the phpMyAdmin folder. Edit that file, and locate the lines:

$cfg['Servers'][$i]['auth_type']     = 'config';    // Authentication method (config, http or cookie based)?
$cfg['Servers'][$i]['user']          = 'root';      // MySQL user
$cfg['Servers'][$i]['password']      = '';          // MySQL password (only needed
                                                    // with 'config' auth_type)

Where ‘ ‘ is an empty password; fill it with your MySQL root password. You can either change the ‘auth_type’ from ‘config’ to ‘cookie’ or ‘httpd’, or alternatively provide the password you selected for the root user in the ‘password’ option.

if you have error in php socket try this

Setup the MySQL default socket to use the MacPorts configuration (/opt/local/var/run/mysql5/mysqld.sock)

$ sudo -i
# cd /opt/local/etc/php5
# cp php.ini php.ini.bak
# defSock=`/opt/local/bin/mysql_config5 --socket`
# cat php.ini | sed \
  -e "s#pdo_mysql\.default_socket.*#pdo_mysql\.default_socket=${defSock}#" \
  -e "s#mysql\.default_socket.*#mysql\.default_socket=${defSock}#" \
  -e "s#mysqli\.default_socket.*#mysqli\.default_socket=${defSock}#" > tmp.ini
# grep default_socket tmp.ini  # Check it!
# mv tmp.ini php.ini
# exit # OR rm php.ini.bak && exit

If you installed php5 with the +pear variant you should also:

cd /opt/local/etc/php5
sudo cp pear.conf.sample pear.conf

Restart Apache so that your changes take effect

sudo /opt/local/apache2/bin/apachectl -k restart

Note: Make sure to use the full path as shown here, as apachectl in your PATH refers to the system provided Apache!

Create a file named phpinfo.php that contains the following three lines

<?php
phpinfo();
?>

sumber

 

Leave a Reply

Your email address will not be published. Required fields are marked *