gpt4 book ai didi

mysql - 为 Apache 修改 DYLD_LIBRARY_PATH? Perl CGI 脚本在连接到 MySQL 时不起作用

转载 作者:太空宇宙 更新时间:2023-11-03 10:21:55 25 4
gpt4 key购买 nike

我有一个 Perl CGI 脚本,当我使用 ./roster_return.cgi StudentID=101095 从命令行运行它时,它工作正常,但是当我在 MAMP (http://localhost:8888/cgi-bin/roster_return.cgi?StudentID=101095),我在 apache 日志中收到以下错误:

[Wed May 02 10:56:47 2012] [error] [client 127.0.0.1] install_driver(mysql) failed: Can't load '/Library/Perl/5.10.0/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle' for module DBD::mysql: dlopen(/Library/Perl/5.10.0/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle, 1): Library not loaded: libmysqlclient.18.dylib
[Wed May 02 10:56:47 2012] [error] [client 127.0.0.1] Referenced from: /Library/Perl/5.10.0/darwin-thread-multi-2level/auto/DBD/mysql/mysql.bundle
[Wed May 02 10:56:47 2012] [error] [client 127.0.0.1] Reason: image not found at /System/Library/Perl/5.10.0/darwin-thread-multi-2level/DynaLoader.pm line 207.
[Wed May 02 10:56:47 2012] [error] [client 127.0.0.1] at (eval 11) line 3
[Wed May 02 10:56:47 2012] [error] [client 127.0.0.1] Compilation failed in require at (eval 11) line 3.
[Wed May 02 10:56:47 2012] [error] [client 127.0.0.1] Perhaps a required shared library or dll isn't installed where expected
[Wed May 02 10:56:47 2012] [error] [client 127.0.0.1] at /Users/jerickson/Desktop/helpfulscripts/cgi-bin/roster_return.cgi line 16
[Wed May 02 10:56:47 2012] [error] [client 127.0.0.1] Premature end of script headers: roster_return.cgi

我现在记得几年前我不得不将这一行添加到我的 .bash_profile 中:

export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:/usr/local/mysql/lib/"

为了让命令行 perl 脚本工作。这可以解释为什么库没有从 MAMP 加载,因为它没有使用我的 .bash_profile 路径。我如何为 MAMP 服务器的路径添加此位置??

如有任何建议或帮助,我们将不胜感激。谢谢!

最佳答案

你可以试试 Apache's mod_env在您的 VirtualHost 配置中:

SetEnv DYLD_LIBRARY_PATH path/to/libs

关于mysql - 为 Apache 修改 DYLD_LIBRARY_PATH? Perl CGI 脚本在连接到 MySQL 时不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10418043/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com