我无法让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';
使用的Bash命令:
# 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?
答案 0 :(得分:1)
MAMP允许您通过转到File ▶ Edit Template ▶PHP ▶ php {version} php.ini
从应用程序中打开php.ini文件。
那应该在编辑器中打开php.ini,例如TextEdit。我希望有所帮助!