How to Install PHP on Mac OS X

Web Design Tutorialz
2 min readSep 13, 2020

Hello dear readers! welcome back to another section of my 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.

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

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 http://127.0.0.1/info.php) 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 my next tutorial post, we are going to be studying about PHP Installation on Windows with IIS.

Feel feel 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.

Originally published at https://www.webdesigntutorialz.com.

--

--

Web Design Tutorialz

A tutorial blog that provides tutorials on Web Design, Programming, Java Technologies, Mobile App Development, Database, Machine Learning, etc.