使用 rmagick 的 Rails 3 应用程序开始使用独立乘客,但通过 apache 使用乘客失败

发布于 2024-10-19 12:00:37 字数 1352 浏览 8 评论 0原文

我正在开发一个包含 rmagick 的 Rails 3 应用程序,我能够使用 WEBrick 和 Passenger Standalone 成功启动和运行它。但是,当我尝试在 Apache 中使用 Passenger 运行应用程序时,出现以下错误:

dlopen(/Users/20217633/.rvm/gems/ruby-1.9.2-p0@rails3/gems/rmagick-2.13.1/lib/RMagick2.bundle, 9): 找不到符号:__cg_jpeg_resync_to_restart 引用自: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO 预期位于:/usr/local//lib/libjpeg.8.dylib 中 /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO - /Users/20217633/.rvm/gems/ruby-1.9.2-p0@rails3/gems/rmagick-2.13.1/lib/RMagick2.bundle

有人熟悉这个问题吗?

=== 更新===

下面是我的 httpd.conf 的副本:

SetEnv PATH /usr/bin:/usr/local/bin

LoadModule passenger_module /Users/20217633/.rvm/gems/ruby-1.9.2-p0@rails3/gems/passenger-3.0.2/ext/apache2/mod_passenger.so
LoadModule upload_progress_module modules/mod_upload_progress.so
PassengerRoot /Users/20217633/.rvm/gems/ruby-1.9.2-p0@rails3/gems/passenger-3.0.2
PassengerRuby /Users/20217633/.rvm/wrappers/ruby-1.9.2-p0@rails3/ruby

<VirtualHost *:80>
    ServerName www.domain.com
    DocumentRoot /Users/20217633/apps/github/project/public

    PassengerLogLevel 3
    RackEnv development
</VirtualHost>

I'm working on a Rails 3 app that includes rmagick and I'm able to start and run it successfully using WEBrick and Passenger Standalone. However, when I try running the app using Passenger within Apache, I get the following error:

dlopen(/Users/20217633/.rvm/gems/ruby-1.9.2-p0@rails3/gems/rmagick-2.13.1/lib/RMagick2.bundle,
9): Symbol not found: __cg_jpeg_resync_to_restart Referenced from:
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO
Expected in: /usr/local//lib/libjpeg.8.dylib in
/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/ImageIO
- /Users/20217633/.rvm/gems/ruby-1.9.2-p0@rails3/gems/rmagick-2.13.1/lib/RMagick2.bundle

Is anyone familiar with this problem?

=== UPDATE ===

Below is a copy of my httpd.conf:

SetEnv PATH /usr/bin:/usr/local/bin

LoadModule passenger_module /Users/20217633/.rvm/gems/ruby-1.9.2-p0@rails3/gems/passenger-3.0.2/ext/apache2/mod_passenger.so
LoadModule upload_progress_module modules/mod_upload_progress.so
PassengerRoot /Users/20217633/.rvm/gems/ruby-1.9.2-p0@rails3/gems/passenger-3.0.2
PassengerRuby /Users/20217633/.rvm/wrappers/ruby-1.9.2-p0@rails3/ruby

<VirtualHost *:80>
    ServerName www.domain.com
    DocumentRoot /Users/20217633/apps/github/project/public

    PassengerLogLevel 3
    RackEnv development
</VirtualHost>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

过潦 2024-10-26 12:00:37

Apache工作进程不以普通用户身份运行,环境被清理并且不会有路径之类的东西。

我敢打赌您正在 Passenger/Apache 下加载不同/不正确版本的 ImageMagick。

您应该能够通过在乘客/apache 配置中手动设置 PATH 来解决此问题:

SetEnv PATH /usr/bin:/path/to/correct/image_magick

Apache worker processes don't run as a normal user, the environment is scrubbed and won't have things like path.

I bet you're loading a different/incorrect version of ImageMagick under Passenger/Apache.

You should be able to fix this by manually setting your PATH in your passenger/apache conf:

SetEnv PATH /usr/bin:/path/to/correct/image_magick
还如梦归 2024-10-26 12:00:37

似乎符号链接已损坏,我在 this 中找到了一些内容论坛

删除“<安装目录>/lib/”中的符号链接“libpng.dylib”和“libjpeg.dylib”

创建指向正确库的新符号链接。

ln -s /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libPNG.dylib /Applications/MAMP/Library/lib/libPNG.dylib

ln -s /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libJPEG.dylib /Applications/MAMP/Library/lib/libJPEG.dylib

我这里没有 Mac 设备,但首先我会验证符号链接的来源是否存在,我希望这能解决您的问题。

It seems that a symlink is broken, I found something in this forum

delete the symlinks "libpng.dylib" and "libjpeg.dylib" in "<installation directory>/lib/"

Create new symlinks to the right libs.

ln -s /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libPNG.dylib /Applications/MAMP/Library/lib/libPNG.dylib

ln -s /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libJPEG.dylib /Applications/MAMP/Library/lib/libJPEG.dylib

I have no Mac rigth here, but first i would verify that the origin of the symlink exist, i hope this will solve your problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文