We now have a youtube channel. Subscribe!

How to Install PHP on Mac OS X

How to install PHP on Mac OS X

Hello folks! Welcome back to a new 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 OS 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 Apache and PHP already preinstalled. This is likely to be quite an old build, and it probably lacks many of the less 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 just to edit your Apache configuration file and then 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

  • You may also want to uncomment the <Directory /home/*/Sites> block or else 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, better still, rather than a filename (/home/httpd/info.php) for the file to be parsed correctly.

You should see a 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 we 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.
© 2023 ‧ WebDesignTutorialz. All rights reserved. Developed by Jago Desain