Wednesday, 11 October 2017

thumbnail

How to install Apache,PHP and Mysql on MacOS-High-Sierra

Introduction

In this tutorial we are going to see how to install Apache, PHP and Mysql in Macos-High-Sierra. By default Apache, PHP comes preinstalled along the OS installation. We just need to configure it in a right way.

1. To start we need to first start the service from terminal :-

sudo apachectl start

To restart, stop and status you can use the below command:-

sudo apachectl restart
sudo apachectl stop
sudo apachectl status

2. The Document root location is given below :-

/Library/WebServer/Documents/

3. Now edit the configuration file to enable some module :-

sudo nano /etc/apache2/httpd.conf

And make sure that this module is uncommented by default 2 modules will be uncommented.

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

4. Now enable rewrite mode from httpd.conf file like below :-

sudo nano /etc/apache2/httpd.conf


Save the file and restart the Apache once to take effect.

5. Now we will see how to add PHP module to Apache :-

sudo nano /etc/apache2/httpd.conf

Uncomment the below line to load PHP module :-

LoadModule php7_module libexec/apache2/libphp7.so

Save the file and restart Apache to take effect :-

sudo apachectl restart

For testing purpose you can create a phpinfo file in the below location :-

cd /Library/WebServer/Documents/
sudo vim info.php


Test the link below :- http://localhost/info.php


6. Download and install Mysql service like below :-

https://dev.mysql.com/downloads/mysql/

Download the version your require :-


Check the Mysql Installation and configuration in below video


Download the PhpMyadmin and copy it to Document Root :-

https://www.phpmyadmin.net/downloads/

Follow the instruction like below :-

sudo cp -av phpMyAdmin-4.7.4-all-languages.zip /Library/WebServer/Documents/
cd /Library/WebServer/Documents/
sudo unzip phpMyAdmin-4.7.4-all-languages.zip
sudo mv phpMyAdmin-4.7.4-all-languages phpmyadmin
sudo chmod -R 777 phpmyadmin/
sudo apachectl restart

Now make the socket so that it can detect our phpmyadmin

sudo mkdir /var/mysql
sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock



Use the credential which you entered during mysql configuration 


That's it,
Enjoy using it 
Please do Share,Comments and Likes
Tags :

Subscribe by Email

Follow Updates Articles from This Blog via Email

No Comments

Follow by Email