PHP Installation on Mac OS X with Apache

Categories: PHP

PHP Installation on Mac OS X with Apache

 

Mac users have the choice of either a binary or a source installation. In fact, your OS X probably came with Apache and PHP preinstalled. This is likely to be quite an old build, and it probably lacks many of the less common extensions.

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

So just follow the steps given 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 otherwise tell Apache which directory to serve out of.
  • Restart the Web server

                      sudo apachectl graceful

  • Open a text editor. Type: <?php phpinfo(); ?>. Save this file in your Web server's

              document root as info.php.

  • Start any Web browser and browse the file.you must always use an HTTP request (http://www.testdomain.com/info.php or http://localhost/info.php or http://127.0.0.1/info.php) 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 Congratulations!

Top articles
How to check version of php Published at:- Definition and Type of Python Comment Published at:- Pass by reference vs value Published at:- Python - Network Programming Published at:- PHP Installation on Mac OS X with Apache Published at:- PHP Installation on Windows XP 2000 and XP with IIS Published at:- PHP Installation on Windows XP 2000 & XP with Apache Published at:- PHP MCQ Quiz Question with Answer Published at:- PHP MCQ Quiz Question with Answer (set 2) Published at:- 5 Laravel Development Tools Developers Must Use Published at:- PHP and its use Published at:-
R4Rin Team
The content on R4Rin.com website is created by expert teams.