apache的服务器环境变量

问题描述 投票:0回答:1

我在使用Apache的Server环境变量时遇到了麻烦。

以下是有关环境的一些信息:

  • 操作系统:Debian 8.10 Jessie
  • 网站托管平台:Plesk
  • PHP:7.1.8

如果我使用PHP-CGI执行,执行使用环境变量的脚本工作正常,但如果我通过网页执行脚本,我无法恢复环境变量。

通过网页访问脚本时用户不同,但我无法加载页面的环境变量。

到目前为止,我已尝试将环境变量设置为:

  • 在/ etc /环境
  • 用户的.bashrc
  • 的.htaccess
  • apache2ctl
  • PHP命令“putenv”
  • ld.so.conf.d

到目前为止,没有任何作用

我的问题:如何通过网页而不是php-cgi来恢复环境变量?

谢谢

php apache environment-variables plesk
1个回答
0
投票

经过3周的试验和错误,我找到了解决方案。

以下是我必须采取的步骤:

  1. 从PHP fastCGI更改为由apache提供的FPM
  2. 将以下代码添加到/opt/php7.1/etc/php-fpm.d/mydomaine.conf

[php-fpm-pool-settings] env [LD_LIBRARY_PATH] =“/ var / www / vhosts / localhost.localdomain / httpdocs / sqlanywhere16 / lib64:/var/www/vhosts/localhost.localdomain/httpdocs/sqlanywhere16/lib32”

  1. 执行命令:

ldconfig -v

ldconfig -p

  1. 重启服务器
© www.soinside.com 2019 - 2024. All rights reserved.