如何在MAMP中设置环境变量? [英] How to set environment variable in MAMP?

查看:186
本文介绍了如何在MAMP中设置环境变量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我已经更新了$ code / MAMP / Library / bin / envvars_和envvars-std_ file 并添加以下行:

 #许可向Apache Software Foundation(ASF)提供一个或多个
#贡献者许可协议。请参阅使用
#分发的NOTICE文件,以了解有关版权所有权的其他信息。
#ASF根据Apache许可证版本2.0
#(许可证)将此文件授权给您;您不得使用此文件,除非符合
#的许可证。您可以在

#http://www.apache.org/licenses/LICENSE-2.0

#获得许可证副本,除非适用法律或以书面形式同意,根据许可证分发的软件
#以按现状分发,B $ b#,不附带任何明示或暗示的保证或条件。
#请参阅许可证,以获得有关权限的特定语言以及许可证下的
#限制。


#envvars-std - apachectl的默认环境变量

#此文件是从envvars-std.in
#$生成的b $ b如果测试x $ DYLD_LIBRARY_PATH!=x;然后
DYLD_LIBRARY_PATH =/ Applications / MAMP / Library / lib:$ DYLD_LIBRARY_PATH
else
DYLD_LIBRARY_PATH =/ Applications / MAMP / Library / lib
fi
导出DYLD_LIBRARY_PATH

MY_TEST_DETAIL =foo
导出MY_TEST_DETAIL


我已经查看了phpinfo()并且无法找到MY_TEST_DETAIL。



任何人都可以告诉我我做错了什么?
提前感谢。

解决方案

找到解决方案。在 /Applications/MAMP/conf/apache/httpd.conf 中添加以下内容:

  SetEnv MY_TEST_DETAIL foo 


How to set environment variable in MAMP(version 3.3) which can i use in my PHP application?

I have updated /Applications/MAMP/Library/bin/envvars_ and envvars-std_ file and add following lines:

# 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

#

I have looked into phpinfo() and not able to find MY_TEST_DETAIL.

Can anyone please tell me what am I doing wrong? Thanks in advance.

解决方案

found the solution. In /Applications/MAMP/conf/apache/httpd.conf added following:

SetEnv MY_TEST_DETAIL foo

这篇关于如何在MAMP中设置环境变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆