title: PHP downloading instead of opening in browser - MacOS Sierra
body: <p>I'm having issues related to loading php using Apache. I use a iMac running Sierra 10.12.6. Server version: Apache/2.4.25 (Unix). PHP 5.6.30 (cli) (built: Feb 7 2017 (16:18:37). Loaded module: php7_module (shared). I have been making all changes using Terminal. So far I can access my localhost, getting the "It Works!" page. I can access my user directory, for html documents only. </p>
  
  <p>When I load the php5 module localhost will not connect at all. Server localhost not found. When I comment the php5 load module out again and restart apache I can gain access html documents in both localhost and localhost/~. When php5 is not loaded it downloads the document instead of opening it. It will go to the downloads folder or open in a text editor like Dreamweaver automatically. I downloaded MAMP and can access the phpinfo page and localhost on port 8888 so I think that is Ok, although I'm having issues connecting MySQL. That's a separate issue. Right now I just want to access php in my localhost/~.</p>
  
  <p>My user directory info is (using actual username)  </p>
  
  <pre><code>&lt;Directory "Users/username/Sites/"&gt;
      Options Indexes MultiViews
      AllowOverride All
      Require all granted
  &lt;/Directory&gt;
  </code></pre>
  
  <p>I followed tutorials making the recommended changes to the httpd.conf and other files and creating the index.html and php info documents in ~/Sites.</p>
  
  <pre><code>LoadModule userdir_mod
  AddHandler php5-script php
  display_errors = On
  Include /private/etc/apache2/extra/httpd-userdir.conf
  Include /private/etc/apache2/other/*.conf
  </code></pre>
  
  <p>I also changed the ServerName to localhost:80.
  I also changed permissions on my WebServer/Documents folder to read &amp; write for system, wheel and everyone.
  I also made the following changes after reading through message boards on this site making changes to the Directory index.</p>
  
  <p>I made other changes to the bash file (following the tutorial) and eventually reloaded the original httpd but I still can't access php. How do i access php5 in my user directory? Thanks.</p>