Php For Mac Yosemite

macOS Update: While these instructions still work, there are new posts for recent versions of macOS, the latest being Install Apache, PHP, and MySQL on macOS Mojave.

The best way to find out how to use the Unix command line is to jump right into the Terminal application, which comes with OS X. Click the Launchpad icon on the Dock, click the Utilities folder, and then click the Terminal icon. You can also jump directly to the Utilities folder from the keyboard. Available for: OS X El Capitan v10.11 and v10.11.1. Impact: Multiple vulnerabilities in PHP. Description: Multiple vulnerabilities existed in PHP versions prior to 5.5.29, the most serious of which may have led to remote code execution. These were addressed by updating PHP to version 5.5.30.

PHP Update: Mac OS X El Capitan comes pre-installed with PHP version 5.5 which has reached its end of life. After you complete this post, you should upgrade PHP on Mac OS X.

Note: This post is for new installations. If you have installed Apache, PHP, and MySQL for Mac OS X Yosemite, read my post on Updating Apache, PHP, and MySQL for Mac OS X El Capitan.

Mac OS X runs atop UNIX. So most UNIX software installs easily on Mac OS X. Furthermore, Apache and PHP come packaged with Mac OS X. To create a local web server, all you need to do is configure Apache and install MySQL.

I am aware of the web server software available for Mac OS X, notably MAMP. These get you started quickly. But they forego the learning experience and, as most developers report, can become difficult to manage.

Running Commands

First, open the Terminal app and switch to the root user so you can run the commands in this post without any permission issues:

Enable Apache on Mac OS X

Verify It works! by accessing http://localhost

Enable PHP for Apache

First, make a backup of the default Apache configuration. This is good practice and serves as a comparison against future versions of Mac OS X.

Now edit the Apache configuration. Feel free to use TextEdit if you are not familiar with vi.

Uncomment the following line (remove #):

Restart Apache:

You can verify PHP is enabled by creating a phpinfo() page in your DocumentRoot.

The default DocumentRoot for Mac OS X El Capitan is /Library/WebServer/Documents. You can verify this from your Apache configuration.

Now create the phpinfo() page in your DocumentRoot:

Verify PHP by accessing http://localhost/phpinfo.php

Install MySQL on Mac OS X El Capitan

Download and install the latest MySQL generally available release DMG for Mac OS X.

The README suggests creating aliases for mysql and mysqladmin. However there are other commands that are helpful such as mysqldump. Instead, you can update your path to include /usr/local/mysql/bin.

Note: You will need to open a new Terminal window or run the command above for your path to update.

Finally, you should run mysql_secure_installation. While this isn't necessary, it's good practice to secure your database.

Connect PHP and MySQL

You need to ensure PHP and MySQL can communicate with one another. There are several options to do so. I do the following:

Additional Configuration (optional)

The default configuration for Apache 2.4 on Mac OS X seemed pretty lean. For example, common modules like mod_rewrite were disabled. You may consider enabling this now to avoid forgetting they are disabled in the future.

I edited my Apache Configuration:

I uncommented the following lines (remove #):

If you develop multiple projects and would like each to have a unique url, you can configure Apache VirtualHosts for Mac OS X.

If you would like to install PHPMyAdmin, return to my original post on installing Apache, PHP, and MySQL on Mac OS X.

Find this interesting? Let's continue the conversation on Twitter.

Check tutorial of How to Enable PHP in Apache for Mac OS X Yosemite & Mavericks

So after a lot of requests from our users here is a guide about How to Enable PHP in Apache for Mac OS X Yosemite & Mavericks.

OS X Mavericks comes with PHP 5.4.30, and OS X Mountain Lion comes with PHP 5.3.13 pre-installed, but when you start the built-in Apache server you will notice that PHP is not enabled by default. Changing this is easy, and if you’re a web developer and want to get PHP running on your local Mac with OS X 10.8 or later, you can get it up and running in no time.

Launch Terminal and enter the following command, use the administrator password when prompted:

Firefox For Mac Yosemite 10.10

sudo nano /etc/apache2/httpd.conf

Now press Control + W to use the search feature from nano, and type “php”

Find the following line and delete the comment (#) from the beginning:

LoadModule php5_module libexec / apache2 / libphp5.so

Firefox for mac yosemite 10.10

Now press Control + O to save the changes, followed by Control + X to exit nano.

Back at the command prompt, you want to restart the Apache server to load the php module. You can do this with the following command, or you can toggle the power switch in the third-party WebSharing panel:

sudo apachectl restart

Apache will reboot quickly and PHP will be enabled.

You can verify this by throwing a php file into the ~ / Sites / directory and loading localhost / ~ user / file.php into a web browser, or use phpinfo () to check the existing php configuration by doing the following in any file with a php extension:

Save that file in the user ~ / Sites / folder and load it in a web browser.

If you want to make changes to the PHP configuration, use the following command to make a copy of the default php.ini file:

cp /private/etc/php.ini.default /private/etc/php.ini

If necessary, make adjustments to the copied php.ini file in / etc / or / private / etc /, keeping the original .default file intact. As usual, any major changes to php.ini must be followed by a fresh Apache restart to take effect.

How to Enable PHP in Apache for Mac OS X Yosemite & Mavericks Guide is free?

Starting from: Free
This guide is a free model
Free Trial: May be included, please check on the official site, we mentioned above.
The How to Enable PHP in Apache for Mac OS X Yosemite & Mavericks tutorial price is Free or Freemium. This means you can truly enjoy the How to Enable PHP in Apache for Mac OS X Yosemite & Mavericks guide.

The How to Enable PHP in Apache for Mac OS X Yosemite & Mavericks guide gives you an easy-to-use and efficient management and How to Enable PHP in Apache for Mac OS X Yosemite & Mavericks allows you to focus on the most important things. It’s friendly guide to use maybe you will love it and How to Enable PHP in Apache for Mac OS X Yosemite & Mavericks tutorial can be used on Linux, Windows or android devices.

How to Enable PHP in Apache for Mac OS X Yosemite & Mavericks: benefits

  • The How to Enable PHP in Apache for Mac OS X Yosemite & Mavericks tutorial is free .
  • Helps many users follow up with interest in a timely manner.
  • The price of the How to Enable PHP in Apache for Mac OS X Yosemite & Mavericks guide is free.

Firefox For Mac Yosemite

How to Enable PHP in Apache for Mac OS X Yosemite & Mavericks: FAQ

Tutorial Summary: How to Enable PHP in Apache for Mac OS X Yosemite & Mavericks

In this guide, we told you about How to Enable PHP in Apache for Mac OS X Yosemite & Mavericks; please read all steps so that you understand How to Enable PHP in Apache for Mac OS X Yosemite & Mavericks in case if you need any assistance from us, then contact us.

How this tutorial helping you?

So in this guide, we discuss the How to Enable PHP in Apache for Mac OS X Yosemite & Mavericks, which undoubtedly helps you.

What is actual time in which this method complete?

The time to complete the How to Enable PHP in Apache for Mac OS X Yosemite & Mavericks tutorial is 10+ minutes.

What are the supported Device?

What are the supported Operating system?


How to Enable PHP in Apache for Mac OS X Yosemite & Mavericks Tutorial: final note

For our visitors: If you have any queries regards the How to Enable PHP in Apache for Mac OS X Yosemite & Mavericks, then please ask us through the comment section below or directly contact us.
Education: This guide or tutorial is just for educational purposes.
Misinformation: If you want to correct any misinformation about the guide “How to Enable PHP in Apache for Mac OS X Yosemite & Mavericks”, then kindly contact us.
Want to add an alternate method: If anyone wants to add the more methods to the guide How to Enable PHP in Apache for Mac OS X Yosemite & Mavericks, then kindly contact us.
Our Contact: Kindly use our contact page regards any help. You may also use our social and accounts by following the Whatsapp, Facebook, and Twitter for your questions. We always love to help you. We answer your questions within 24-48 hours (Weekend off).
Channel: If you want the latest software updates and discussion about any software in your pocket, then here is our Telegram channel.