2014-04-30 58 views
1

我無法使中的auto_prepend_file設置正常工作。我直接在我正在處理的項目文件夾中測試路徑,並且它可以無縫工作。基於以下的一切,有沒有人有一些想法,接下來要嘗試什麼?任何幫助將不勝感激!auto_prepend_file在php.ini中不能正常工作

// This did nothing 
ini_set("auto_prepend_file","/Applications/MAMP/bin/php/php5.5.10/prepend.php"); 

// This allowed it to work by including it in the index.php but it's not using the auto_append_file setting 
require_once '/Applications/MAMP/bin/php/php5.5.10/conf/prepend.php'; 

猛砸使用的命令:

# When I did this, it gave me the correct path 
$ cat /Applications/MAMP/conf/php5.5.10/php.ini | grep auto_prepend_file 
auto_prepend_file ="/Applications/MAMP/bin/php/php5.5.10/conf/prepend.php" 

# But when I ran this command, it shows that there are no values (just like it does when running phpinfo()) 
$ php -i | grep auto_prepend_file 
auto_prepend_file => no value => no value 

# Nothing is output when I run this command 
$ php -r "echo ini_get('auto_prepend_file');" 

php.ini路徑從phpinfo()

Configuration File (php.ini) Path /Applications/MAMP/bin/php/php5.5.10/conf 

Loaded Configuration File /Library/Application Support/appsolute/MAMP PRO/conf/php.ini 

我發現了一噸的php.ini文件我的系統上

/Library/Application Support/appsolute/MAMP PRO/conf/php.ini 
/Applications/MAMP/conf/php5.5.10/php.ini 
/Users/alexcory/jarvis/tmp/backup/php.ini~ 

// Not sure if these have any effect 
/private/etc/php-fpm.conf.default 
/private/etc/php.ini.default 

內容prepend.php

<?php 
die('Hello World');     // Haven't been able to get "Hello World" to show 

require_once dirname(_file_) . '/kint/Kint.class.php'; 

StackOverflow的問題,引用的。

auto_prepend_file is not working in cli mode

Why would auto_prepend_file works in .htaccess but not in php.ini?

php version issue in auto_prepend_file

回答

1

MAMP可以讓你在應用程序中通過將File ▶ Edit Template ▶PHP ▶ php {version} php.ini打開php.ini文件。

這應該在諸如TextEdit的編輯器中打開php.ini。我希望這有助於!

相關問題