MAMP PHP not working - SOLVED - USE SAME VERSION MAMP PHP AS ON SERVER!


(Greg Schneck) #1

I have php includes on every page so I’m setting up MAMP but php is not working…

  • My php pages do have .php extension.
  • My php pages are in the MAMP htdocs folder. (my entire site was exported to the folder)
  • My Doc Root is defined as the MAMP htdocs folder.
  • My webpage displays using MAMP but php is not working as no php includes are rendered.

What have I missed?


(Greg Schneck) #2

SOLVED… very sorry


(Doug Bennett) #3

You said your pages are displaying using MAMP are you using:
http://localhost:8888/

If MAMP is on and you used the default ports then the above address should display whats in HTdocs.


(Greg Schneck) #4

NO… It was a silly mistake on my part… having to do with defined paths of my includes…


(Greg Schneck) #5

Mamp doesn’t handle this:

<?php $path = $_SERVER['DOCUMENT_ROOT']; $path .= "/includes/ad_rotator.php"; include_once($path); ?>

(Doug Bennett) #6

MAMP should handle any valid PHP.
by default the MAMP install turns of error displays. You can change that by adding a .htaccess file to in your case the HTdocs folder.

The needed filke can be created with any text editor it must be named .htaccess (you maybe warned about the dot(.) as it will not be seen once created.

the file needs a single entry:
php_flag display_errors 1

you can also check the PHP log that MAMP puts out:
/Applications/MAMP/logs/php_error.log


(Greg Schneck) #7

good tips… thanks. I have my entire website downloaded into htdocs folder so my htaccess file is there. I just need to turn on display_errors THANKS!


(Greg Schneck) #8

As a followup. Once error checking was turned on I received this error:
PHP Fatal error: Uncaught Error: Call to undefined function split() in /Applications/MAMP/htdocs/ad_rotator/ad_rotator0.php

Upon checking on php split function I found that it is GONE in version 7.0 My site is running php 5.x

LESSON: Run the same version of PHP in MAMP as you do on your server!!!