Dream as if you Live forever, Live as if you die Today

This is a tutorial on how to set up Apache 2.4, PHP 5.5, and MySQL 5.6 on Mac OS X 10.10 Yosemite. This tutorial is a good reference for PHP developers who want to set up a local MAMP development environment. I should note I mainly program in Scala these days, but PHP is a really popular and useful programming language to know.

If you know what you’re doing this guide should also work for Leopard, Snow Leopard, Lion, Mountain Lion, and Mavericks with minor changes as the setup hasn’t changed much since I originally wrote about this in 2007.

While I’m a big fan of the nginx (pronounced: “engine x”) web server this tutorial uses Apache 2.4, which comes preinstalled on Mac OS X and has a larger market share.

Preparation Please be warned that I’m assuming you have a clean and updated install of Mac OS X, I doubt anything you do here can cause any serious damage but still remember to backup everything you modify. If you screw up my directions there are copies of the Apache configuration files you’ll be editing in /etc/apache2/original so don’t despair.

If you haven’t already, download and install Xcode. Very important. Don’t skip this step.

Open up the Terminal application in /Applications/Utilities or if you prefer use iTerm.

I will be using the GNU nano text editor in my examples since it already comes with the Mac, but if you’d like to use another text editor like BBEdit or TextMate just replace nano with bbedit or mate respectively and remove any nano-specific options (e.g. -w).

Whenever I ask you to type something into Terminal you have to hit return for the command to go through. Alternatively, for you lazy ones out there, you can just copy and paste these commands.

Set up Apache Enter the following into the command line/shell (Terminal):

sudo nano -w /etc/apache2/httpd.conf Whenever you put sudo in front of a command you will need to enter your administrator/user password when prompted to do so.

Hit control w and search for:

LoadModule userdir_module libexec/apache2/mod_userdir.so

Below that line should be:

LoadModule rewrite_module libexec/apache2/mod_rewrite.so

LoadModule php5_module libexec/apache2/libphp5.so

Uncomment all three of these lines by removing the pound/hash sign (#) in front of the “LoadModule” text on each line.

Make sure that these two lines are not commented out (i.e. don’t have a pound sign in front of them):

LoadModule authz_host_module libexec/apache2/mod_authz_host.so LoadModule authz_core_module libexec/apache2/mod_authz_core.so If they are commented out, remove the pound sign in front of those lines as well.

Hit control w again to search for:

DirectoryIndex index.html Add the text “index.php” to the end of the line like so:

DirectoryIndex index.html index.php Finally, search for (control w) and uncomment:

Include /private/etc/apache2/extra/httpd-userdir.conf

When you are finished hit control x to exit, then type y, and hit return to save your changes.

In Terminal:

sudo nano -w /etc/apache2/extra/httpd-userdir.conf Search for and uncomment:

Include /private/etc/apache2/users/*.conf

Save your changes like you did with the last file.

If you’re like me and use rewrite rules in an .htaccess file for those nice clean search engine-friendly URLs you’ll need to make sure mod_rewrite is working properly. To do this, you will need to know your username. My username is danilo, so replace danilo with whatever yours happens to be. You can easily tell what it is from the Terminal cause it’s the name right before the dollar sign (e.g. Danilo-MacBook-Pro:~ danilo$).

Go to Terminal and enter the command:

ls /etc/apache2/users/*.conf If that command lists the only .conf file in this directory as Guest.conf or doesn’t list anything don’t worry the command to edit username.conf will also work to create it:

sudo nano -w /etc/apache2/users/danilo.conf Where danilo is your username. Make username.conf look like this:

<Directory "/Users/danilo/Sites/"> Options Indexes MultiViews FollowSymLinks Require all granted AllowOverride All Order allow,deny Allow from all Again, where danilo is replaced with your particular username.

Set up PHP To create the php.ini file type the following into Terminal:

sudo cp /etc/php.ini.default /etc/php.ini Fix php.ini’s permissions:

sudo chmod 644 /etc/php.ini You should configure php.ini to your liking, however, I’d strongly recommend you turn error reporting on (I’m assuming you’re using this setup for development) and define your timezone.

Type this into Terminal:

sudo nano -w /etc/php.ini Search for:

error_reporting = Change the current value (probably something meant for a production environment like error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT) to:

error_reporting = E_ALL | E_STRICT Search for:

display_errors = Off And replace with:

display_errors = On Then search for:

;date.timezone = Uncomment (remove the leading semicolon) and then add your timezone (see: http://php.net/manual/en/timezones.php):

date.timezone = America/Los_Angeles Close and save (unless you have any other changes to make of course).

Install & Set up MySQL Download the latest version of the MySQL Disk Image archive (DMG) for Mac OS X:


Mount the MySQL disk image (i.e. open mysql-5.6….dmg).

Double click and install mysql-5.6….pkg, which is contained inside the disk image.

Eject the disk image.

Open up Terminal and enter:

sudo nano -w /etc/php.ini Search for:

pdo_mysql.default_socket= And replace with:

pdo_mysql.default_socket=/tmp/mysql.sock Then search for:

mysql.default_socket = And replace with:

mysql.default_socket = /tmp/mysql.sock Then search for:

mysqli.default_socket = And replace with:

mysqli.default_socket = /tmp/mysql.sock Save and close.

In Terminal type:

nano -w ~/.bash_profile Put this text at the top of the document to set the path to MySQL:

export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH" Save and close php.ini.

Then type:

source ~/.bash_profile Now from the MySQL preference pane in System Preferences click Start MySQL Server.

This last step isn’t necessary for a dev environment but if you want to easily secure MySQL execute this command in Terminal:

mysql_secure_installation Test Apache, PHP & MySQL Let’s go ahead and verify that Apache, PHP, and MySQL are working.

Restart Apache using the command below:

sudo apachectl restart You’ll want to restart the Apache service whenever you make a change to a configuration file in the future.

Now open up your favorite web browser and go to:

http://localhost/ If you want to see the contents of your Sites directory go to:

http://localhost/~danilo/ Again, make sure you replace danilo with your username.

Personally, I hate typing in ~danilo every time I need to test a site so I set up virtual hosts to make more memorable shortURLs like http://mycoolapp.loc/ instead of just pointing /Users/ariadoss/Sites/mycoolapp to http://localhost/ but that’s outside the scope of this tutorial. However, if this interests you, and it should, read my tutorial on How to setup virtual hosts on Mac OS X 10.10 Yosemite.

To make sure everything is working go to your Sites directory and create a new PHP file called info.php that contains the following code:

<?php phpinfo(); ?> Open the following URL in your preferred web browser (where danilo is your username):

http://localhost/~danilo/info.php Make sure everything is in order.

Congrats, you’ve successfully set up the MAMP stack!


 |  balram

On April 25, National Geographic Channel will launch its first scripted television show, "Genius," about the life of Albert Einstein. But before that happens, the channel is also planning for the famed scientist to make an appearance — of sorts — just in time for the March for Science this weekend in Washington, D.C.

A chatbot on Facebook Messenger allows users to engage in a text exchange with "Albert Einstein," exploring details of his life and accomplishments, and discovering his perspective on the March for Science, which is taking place in the nation's capital (and elsewhere across the globe) on April 22. [2017 March for Science: What You Need to Know]

A sample conversation shows the chatbot replying to questions, making jokes about Einstein's hair, and sharing a GIF of Einstein (played by actor Geoffrey Rush in the television show) turning to the camera and sticking out his tongue.

he real-life Einstein would likely have supported the march, which invites scientists and nonscientists alike to rally in a show of support for the sciences. In Einstein's famous essay "The Common Language of Science" — recorded in 1941 as a radio address to the British Association for the Advancement of Science, and published in 1954 in an anthology of his writings called "Ideas and Opinions" — he described science as a shared language that plays an important role in shaping critical goals for the benefit of people and nations around the world.

National Geographic is installing a free Wi-Fi network for March for Science participants, which they can access after viewing short scenes from the "Genius," as well as a "Genius"-themed tent that offers charging stations and provides a sneak peek of footage from upcoming episodes.

Connect with the Einstein chatbot on Facebook Messenger.


 |  Administrator