在 Apache PassEnv/SetEnv 中设置 LD_LIBRARY_PATH 仍然找不到库
我正在尝试测试 Cybersource 3d party 实施。我能够从命令行让测试文件正常运行,这需要在 Linux 上将支付库的路径导出到 LD_LIBRARY_PATH。
为了尝试在我的服务器上测试这个,我在下面创建了 apache 配置,
<VirtualHost 127.0.0.1:12345>
AddHandler cgi-script .cgi
AddHandler fcgid-script .php .fcgi
FCGIWrapper /my/path/to/php_fcgi/bin/php-cgi .php
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
DocumentRoot /my/path/to/cybersource/simapi-php-5.0.1/
ProxyPreserveHost on
<Directory /my/path/to/cybersource/simapi-php-5.0.1>
SetEnv LD_LIBRARY_PATH /my/path/to/cybersource/LinkedLibraries/lib/
AllowOverride all
Options +Indexes
IndexOptions Charset=UTF-8
</Directory>
</VirtualHost>
我使用 SetEnv 命令设置了 env 变量,当我运行打印的页面时,它似乎可以工作,
<?php phpinfo(); ?>
但是通过浏览器调用测试脚本时仍然无法工作,apache 说:
tail /my/apache/error_log
[Tue Mar 30 23:11:46 2010] [notice] mod_fcgid: call /my/path/to/cybersource/index.php with wrapper /my/path/to/cybersource/php_fcgi/bin/php-cgi
PHP Warning: PHP Startup: Unable to load dynamic library '/my/path/to/cybersource/extensionsdir/php5_cybersource.so' - libspapache.so: cannot open shared object file: No such file or directory in Unknown on line 0
所以它找不到链接文件 libspapache.so 即使它位于据称定义的 LD_LIBRARY_PATH 中
我真的很感谢您的帮助。非常感谢。
I am trying to test the Cybersource 3d party implementation. I was able to get the test files running fine from the command line, which requires that on Linux I export the path to the payment libraries to LD_LIBRARY_PATH.
to try to test this on my server I have created the apache config below
<VirtualHost 127.0.0.1:12345>
AddHandler cgi-script .cgi
AddHandler fcgid-script .php .fcgi
FCGIWrapper /my/path/to/php_fcgi/bin/php-cgi .php
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
DocumentRoot /my/path/to/cybersource/simapi-php-5.0.1/
ProxyPreserveHost on
<Directory /my/path/to/cybersource/simapi-php-5.0.1>
SetEnv LD_LIBRARY_PATH /my/path/to/cybersource/LinkedLibraries/lib/
AllowOverride all
Options +Indexes
IndexOptions Charset=UTF-8
</Directory>
</VirtualHost>
I have set the env variable there with SetEnv command, which seems to be working when i run a page that prints
<?php phpinfo(); ?>
however the test script when called through the browser still wont work, apache says:
tail /my/apache/error_log
[Tue Mar 30 23:11:46 2010] [notice] mod_fcgid: call /my/path/to/cybersource/index.php with wrapper /my/path/to/cybersource/php_fcgi/bin/php-cgi
PHP Warning: PHP Startup: Unable to load dynamic library '/my/path/to/cybersource/extensionsdir/php5_cybersource.so' - libspapache.so: cannot open shared object file: No such file or directory in Unknown on line 0
so it cant find the linked file libspapache.so even though it is in the LD_LIBRARY_PATH that is supposedly defined
i really appreciate the help. thanks so much.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
SetEnv
是每个请求的事情,因此它不会影响FCGIWrapper
运行的上下文。您想使用 FcgidInitialEnv 或 FcgidCmdOptions 在包装器环境中设置变量。SetEnv
is a per-request thing, so it doesn't affect the context that theFCGIWrapper
runs under. You want to use FcgidInitialEnv or FcgidCmdOptions to set variables in the environment of the wrapper.