We now have a youtube channel. Subscribe!

How to Install PHP on Mac OS X

Hello dear readers! welcome back to another section of our tutorial on PHP. In this tutorial guide, we will be discussing about how to install PHP on Mac OS X System.

Mac users have the choice of either a binary or a source Installation. As a matter of fact, your Mac OS X might have come with the Apache and PHP already preinstalled. This is likely to be quite an old build, and it probably lacks so many of the common extensions.

However, if all you desire is a quick Apache, PHP, and MySQL setup on your laptop, this is certainly the easiest way to do that. All you need to do is to edit your Apache configuration file and turn on the Web server.

Steps to Install and Configure PHP on Mac OS X

To install and configure PHP on Mac OS X, just follow the following steps below -

  • Open the Apache config file in a text editor as root.

sudo open -a TextEdit /etc/httpd/httpd.conf

  • Edit the file. Uncomment the following lines -

Load Module php5_module
AddModule mod_php5.c
AddType application/x-httpd-php .php

  • Uncomment the <Directory /home/*/Sites> block or otherwise inform Apache which directory to serve out from.
  • Restart the Web server

sudo apachectl graceful

  • Open a text editor and then type: <?php phpinfo(); ?>. Then save this file in your Web server's document root as info.php.
  • Open any Web browser and browse the file. You must always make use of an HTTP request. For example, use (http://www.domain.com/info.php or http://localhost/info.php or rather than using a filename (/home/httpd/info.php) in order for the file to be parsed correctly.

You should now see a very long table of information about your new PHP Installation message.

Alright guys! This is where we are rounding up for this tutorial post. In our next tutorial guide, we are going to be discussing about PHP Installation on Windows with IIS.

Feel free to ask your questions where necessary and i will attend to them as soon as possible. If this tutorial was helpful to you, you can use the share button to share this tutorial.

Follow us on our various social media platforms to stay updated with our latest tutorials. You can also subscribe to our newsletter in order to get our tutorials delivered directly to your emails.

Thanks for reading and bye for now.

Post a Comment

Hello dear readers! Please kindly try your best to make sure your comments comply with our comment policy guidelines. You can visit our comment policy page to view these guidelines which are clearly stated. Thank you.
© 2022 ‧ WebDesignTutorialz. All rights reserved. Developed by Jago Desain