How To Install Apache, PHP, MySQL and phpMyAdmin on macOS Sierra without XAMPP, MAMP or WAMP

How To Install Apache, PHP, MySQL and phpMyAdmin on macOS Sierra without XAMPP, MAMP or WAMP

Working with your Mac? Mac doesn’t need a third party web programming programs if you want to build information system, blog, website or others. Mac OS X and macOS can do it all.

This article will sharing about how to install Apache, PHP, MySQL and phpMyAdmin without any bundles software like XAMPP, MAMP/PRO or WAMP.

Unlike Windows users, you have to download and installing above bundles applications because there’s no alternative ways to build a blog in your localhost computer without these packages help get you started quickly with mac programming.

Apache and PHP are shipped with Mac OS X and macOS by default.

So, you just need to install MySQL and phpMyadmin to working with your databases and managing it.

Open Terminal to enable Apache and PHP, found it on this directory /Applications/Utilities/Terminal. Other way, press Command + Space then type terminal.

How To Setup Apache, PHP and Installing MySQL dan PHPMyAdmin on macOS Sierra

Setup Apache dan PHP

  1. Open the Terminal app on Mac, found it on /Applications/Utilities/Terminal
  2. Type below commands to stop, start and restart Apache service on Mac
    sudo apachectl stop : type on Terminal app to disable Apache service
    sudo apachectl start : enable Apache service on Mac
    sudo apachectl restart : type this to restart Apache service on Mac
  3. If you’re want to check Apache and PHP version on Mac, just type these command on Terminal app and Enter:
    httpd -v : check Apache version on Mac
    php -v : check PHP version on Mac
  4. Furthermore, setup PHP on Mac. Just type below commands on Terminal:
    sudo su –
    cd /etc/apache2/user
    nano macoscode.conf
  5. Change username “macoscode” with your own
    <Directory “/Users/macoscode/Sites”>
    Options Indexes MultiViews FollowSymLinks
    AllowOverride All
    Allow from all
    Require all granted
  6. Change PHP file permission username.conf to -rw-r–r– 1 root:
    chmod 644 sukardisukardi.conf
  7. Type: nano /etc/apache2/httpd.conf on Terminal and Enter
  8. Remove # or uncommented the following lines:
    LoadModule authz_core_module libexec/apache2/mod_authz_core.so
    LoadModule authz_host_module libexec/apache2/mod_authz_host.so
    LoadModule userdir_module libexec/apache2/mod_userdir.so
    LoadModule include_module libexec/apache2/mod_include.so
    LoadModule rewrite_module libexec/apache2/mod_rewrite.so
    LoadModule php5_module libexec/apache2/libphp5.so
    Include /private/etc/apache2/extra/httpd-userdir.conf
  9. Type: sudo nano /etc/apache2/extra/httpd-userdir.conf and remove # on this line:
    Include /private/etc/apache2/users/*.conf
  10. Now, restart your Apache service.

Install MySQL on Mac

Following below steps to installing MySQL on Mac OS X.

    1. Download MySQL DMG for Mac OS X here
    2. Install MySQL with open it dan don’t forget to copy default MySQL password:
      2017-01-18T13:50:07.620117Z 1 [Note] A
      temporary password is generated for
      root@localhost: ?yMg!Nk+h2,e
    3. Update MySQL path:
      export PATH=/usr/local/mysql/bin:$PATH

Install phpMyAdmin on Mac

Don’t working your MySQL databases with command line on Terminal, just install phpMyAdmin to create, manage or drop database.

  1. Download the latest of phpMyAdmin here
  2. Open Terminal app and type:
    tar -xvf ~/Downloads/phpMyAdmin-xxx.tar.gz
    mv phpMyAdmin-xxxx/ phpmyadmin
    cd phpmyadmin
    mv config.sample.inc.php config.inc.php

Now, open your browser an type: http://localhost on address bar and hit Enter.

Share this:

Leave a Reply

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