如何在我可以在我的 PHP 应用程序中使用的 MAMP(3.3 版)中设置环境变量?
我更新了 /Applications/MAMP/Library/bin/envvars_ 和 envvars-std_ 文件
并添加了以下行:
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#
# envvars-std - default environment variables for apachectl
#
# This file is generated from envvars-std.in
#
if test "x$DYLD_LIBRARY_PATH" != "x" ; then
DYLD_LIBRARY_PATH="/Applications/MAMP/Library/lib:$DYLD_LIBRARY_PATH"
else
DYLD_LIBRARY_PATH="/Applications/MAMP/Library/lib"
fi
export DYLD_LIBRARY_PATH
MY_TEST_DETAIL="foo"
export MY_TEST_DETAIL
#
我查看了 phpinfo(),但找不到 MY_TEST_DETAIL。
谁能告诉我我做错了什么? 提前致谢。
最佳答案
找到了解决方案。在 /Applications/MAMP/conf/apache/httpd.conf
添加以下内容:
SetEnv MY_TEST_DETAIL foo
关于php - 如何在 MAMP 中设置环境变量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32110634/