0

I have a MAMP setup on my OSX. I'm following advice from the thread here:

PHP: possible to set constants in default php.ini file

I have found the correct php.ini file and added this bit under the directories section:

auto_prepend_file = "/Applications/MAMP/htdocs/constants.php" //standard MAMP setup URL

Then, in constants.php:

define(‘ABS_PATH’, '/Applications/MAMP/htdocs');

However, for example on a simple include, ABS_PATH is not defined (and thus shows up as ABS_PATH if I put the below URL in a variable and echo out the result)

<?php include ABS_PATH."/includes/file.php"; ?>

Am I missing something specific to MAMP, or just a small error somewhere? I feel like I'm following the above post advice exactly as stated. Thanks.

Community
  • 1
  • 1
Pete_1
  • 981
  • 3
  • 14
  • 23
  • I hope you aren't using `‘` and `’`.... PHP doesn't like smart quotes – Mark Baker Jan 17 '15 at 20:24
  • Do you mean changing constants.php to define("ABS_PATH", "/Applications/MAMP/htdocs"); ? It doesn't seem to make a difference. – Pete_1 Jan 17 '15 at 20:27
  • Check this out: http://stackoverflow.com/questions/11256008/setting-environment-variables-in-mamp Good luck! – Robin Valk Jan 17 '15 at 22:13

1 Answers1

0

I couldn't ever get this to work out of MAMP's php.ini. However, this post:

Automatically load a config.php file for all pages before anything else.

explained that you can use auto_prepend_file in a .htaccess file in your root directory and it will accomplish the same thing.

Community
  • 1
  • 1
Pete_1
  • 981
  • 3
  • 14
  • 23