How to setup Apache PHP and MySQL in MacOS X 10.10 Yosemite [ Updated ]
Posted on 7/11/2014
Upgraded to Yosemite , great . now lets see how to setup Apache webserver with PHP and MySQL . unlike 10.7 Lion or 10.6 there is no prefrence pane option to turn on Apache . but don’t worry MacOSX Yosemite comes with Apache and you can turn on it using Terminal . Okay lets see how to setup Apache PHP and MySQL setup in Mac OS X Yosemite .
apachectl -v && php -v
apache and php with yosemite
setup apache
open terminal and type
sudo apachectl start
now open your favourite browser and browse to http://localhost
you will see default apache page
default apache page in MacOX yosemite
Lets setup user-dir for per user
I am going to use nano in this guide feel free to use any of your favourite editor .
Enable mod_authz_core, mod_authz_host, mod_userdir and mod_userdir.so modules
sudo nano /etc/apache2/httpd.conf
Uncomment These Three Modules For Now ( Remove “#” sign from the starting of line if “#” is present )
Install that Like another Package of MacOSX there is nothing tricky , install prefPane ( included in DMG )
adding mysql in $PATH
touch ~/.bash_login && echo export PATH=$PATH:/usr/local/mysql/bin | tee ~/.bash_login
above command will create .bash_login file in your home directory and it will add MySQL in PATH
restart your terminal and start mysql from PrefrencePane
MySQL Prefrencepane yosemite
okay now open terminal and type
mysql_secure_installation
Aloks-Mac-Pro:~ alok$ mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
Set root password? [Y/n] < ------------------ Press ENTER
Set root password? [Y/n] < ------------- Press Enter
Screen Shot 2014-07-11 at 10.49.52 pm
New password: < ------------------ ENETR NEW ROOT PASSWORD
Re-enter new password:
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] < ------------------- PRESS ENTER
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] < ------ PRESS ENTER
Screen Shot 2014-07-11 at 10.50.52 pm
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] < ---------- PRESS ENTER
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] < ------------- PRESS ENTER
All done! If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!
Cleaning up...
All Done Now MySQL is set up
Screen Shot 2014-07-11 at 10.53.52 pm
Now You Have Working APACHE PHP AND MYSQL
ScreenCast
happy Coding 🙂
About me
Hi, My name is Alok Yadav. I am a software engineer based in Kolkata, India.