本文介绍了尝试在Apache上运行乘客时出现的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行时出现此问题

httpd -t

httpd: Syntax error on line 545 of /private/etc/apache2/httpd.conf: Syntax error on line 1 of /private/etc/apache2/other/passenger.conf: Cannot load /Users/sbaidon/.rvm/gems/ruby-2.2.5/gems/passenger-5.3.5/buildout/apache2/mod_passenger.so into server: dlopen(/Users/sbaidon/.rvm/gems/ruby-2.2.5/gems/passenger-5.3.5/buildout/apache2/mod_passenger.so, 10): no suitable image found. Did find:\n\t/Users/sbaidon/.rvm/gems/ruby-2.2.5/gems/passenger-5.3.5/buildout/apache2/mod_passenger.so: code signature in (/Users/sbaidon/.rvm/gems/ruby-2.2.5/gems/passenger-5.3.5/buildout/apache2/mod_passenger.so) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.\n\t/Users/sbaidon/.rvm/gems/ruby-2.2.5/gems/passenger-5.3.5/buildout/apache2/mod_passenger.so: stat() failed with errno=22

httpd: Syntax error on line 545 of /private/etc/apache2/httpd.conf: Syntax error on line 1 of /private/etc/apache2/other/passenger.conf: Cannot load /Users/sbaidon/.rvm/gems/ruby-2.2.5/gems/passenger-5.3.5/buildout/apache2/mod_passenger.so into server: dlopen(/Users/sbaidon/.rvm/gems/ruby-2.2.5/gems/passenger-5.3.5/buildout/apache2/mod_passenger.so, 10): no suitable image found. Did find:\n\t/Users/sbaidon/.rvm/gems/ruby-2.2.5/gems/passenger-5.3.5/buildout/apache2/mod_passenger.so: code signature in (/Users/sbaidon/.rvm/gems/ruby-2.2.5/gems/passenger-5.3.5/buildout/apache2/mod_passenger.so) not valid for use in process using Library Validation: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.\n\t/Users/sbaidon/.rvm/gems/ruby-2.2.5/gems/passenger-5.3.5/buildout/apache2/mod_passenger.so: stat() failed with errno=22

安装乘客就可以了.

推荐答案

我也遇到了这个问题:问题是macOS Mojave随附的内置httpd启用了库验证,这意味着它加载的任何模块都必须正确签名.不幸的是,mod_passenger.so未签名,因此加载失败.实际上,很多人在macOS Mojave上加载Apache模块时遇到了这个问题(特别是在beta期间),一些示例参考:

I ran into this too: the issue is that the built-in httpd that comes with macOS Mojave has Library Validation turned on, which means any modules it loads must be properly signed. Unfortunately, mod_passenger.so is not signed, so loading fails. Actually, a lot of people are having this problem with loading Apache modules on macOS Mojave (especially during the beta), some example references:

https://github.com/GrahamDumpleton/mod_wsgi/issues/357 https://github.com/phpredis/phpredis/issues/1406

我相信可以在某处设置plist来获得httpd的权利,以禁用库验证(com.apple.security.cs.disable-library-validation),如 https://developer.apple.com/documentation/security/com_apple_security_cs_disable-library-validation .例如,这是最近的WebKit补丁,他们在其中添加了补丁以允许插件加载: https://bugs.webkit.org/show_bug.cgi?id=183252 .同样,以下Mozilla员工正在讨论他们如何启用此(和其他)属性: https://bugzilla.mozilla.org/show_bug.cgi?format=default&id=1470597 .

I believe it's possible to set up a plist somewhere to give an entitlement to httpd to disable library validation (com.apple.security.cs.disable-library-validation) as described at https://developer.apple.com/documentation/security/com_apple_security_cs_disable-library-validation. For instance, here's a recent WebKit patch where they add it to allow plugin loading: https://bugs.webkit.org/show_bug.cgi?id=183252. Similarly, here's the Mozilla people talking about how they need to enable this (and other) properties: https://bugzilla.mozilla.org/show_bug.cgi?format=default&id=1470597.

不幸的是,我不进行macOS开发(我只是在macOS上进行开发),而且我完全不知道如何将其应用于内置的Apache,对不起.

Unfortunately, I don't do macOS development (I just do development on macOS) and I have absolutely no idea how to apply it to the built-in Apache, I'm sorry.

在这一点上,我有点讨厌每个主要的macOS更新都破坏了我所有的httpd设置,并且通常很痛苦(虽然很少见,但仍然很烦人),所以我正在做我几年前应该做的事情:停止使用OS/X随附的内置httpd并仅使用Homebrew httpd.

At this point I'm kind of sick of every major macOS update nerfing all my httpd settings and generally being a pain (it's infrequent but it's still annoying), so I'm doing what I should have done years ago: stop using the built-in httpd that comes with OS/X and just use Homebrew httpd.

以下是我发现的有关设置Homebrew httpd(并禁用内置的macOS httpd)的一些说明,这非常简单,您不必遵循有关多个PHP版本的所有说明.等等: https://getgrav.org/blog/macos-mojave-apache -multiple-php-versions

Here's some instructions I found regarding setting up Homebrew httpd (and disabling the built-in macOS httpd), it's pretty straightforward and you don't have to follow all of the directions about multiple PHP versions etc: https://getgrav.org/blog/macos-mojave-apache-multiple-php-versions

如果有人可以弄清楚如何在内置的httpd中禁用库验证,或者是否有某种方法可以在mod_passenger.so上提供签名(似乎不太可能,因为Homebrew和gem passenger都需要从源代码构建) ,则无需破坏内置的httpd.但是我个人认为最好的解决方案是完全摆脱它,而使用Homebrew版本.

If someone can figure out how to disable Library Validation in the built-in httpd, or if there is some way to provide signing on mod_passenger.so (seems unlikely since both the Homebrew and gem passenger need to be buildable from source), you don't need to junk the built-in httpd. But I personally think the best solution is to move away from it entirely and use the Homebrew version instead.

这篇关于尝试在Apache上运行乘客时出现的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 06:13