Open Terminal and run the following Code: sudo apachectl start
Open your browser and access http://localhost. If it says It Works, then you are set otherwise see if your apachectl has started or not.
Let's make a backup of the default Apache configuration. This will help you to cross check later what you changed or in case you want to restore the configuration to default.
cd /etc/apache2/
cp httpd.conf httpd.conf.bak
Now edit the httpd.conf with vi or any other text editor: vi httpd.conf
Now uncomment the following line (Remove #): LoadModule php5_module libexec/apache2/libphp5.so
Now Restart apache: sudo apachectl restart
To install MySQL: brew install mysql
Install brew services now: brew tap homebrew/services
Now start MySQL: brew services start mysql
Now configure MySQL : mysql_secure_installation
- Validate Password Plugin
- Remove anonymous users
- Disallow root login remotely
- Remove test database and access to it
- Reload privilege tables now - Choose yes
After finishing this up, test MySQL: mysql -uroot -p.
It will ask you write the password you set for mysql before. Enter password and then something like this appear:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.19 Homebrew
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>