简体   繁体   中英

Apache SetEnv with special characters

I'm trying to set an environment variable in Apache using SetEnv in my vhosts.conf file with the following:

SetEnv FACEBOOK_SECRET 13jf93jjdshut7qpm321b1vv5nod973j10
SetEnv DATABASE_URL "postgresql://postgres:sdfesf@localhost:5432/public"

The FACEBOOK_SECRET environment is showing up in php with the genenv() function, but the DATABASE_URL is empty. I'm assuming it's due to the special characters in the connection string, but I don't know if or how to escape those characters. Any ideas?

将值设置为引号。

尝试用127.0.0.1替换localhost ,因为apache不喜欢virtualhost配置块中的localhost关键字。

SetEnv DATABASE_URL "postgresql://postgres:sdfesf@127.0.0.1:5432/public"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM