部署mod_wsgi:加载MySQLdb模块时出错

时间:2022-01-11 16:56:19

I want to deploy my django app using apache + mod_wsgi again. I seem to be getting this error 500 message Initially, I was told that I need the latest version of MySQLdb. After I had installed, I got this error message.

我想再次使用apache + mod_wsgi部署我的django应用程序。我似乎得到这个错误500消息最初,我被告知我需要最新版本的MySQLdb。我安装后,收到此错误消息。

Error loading MySQLdb module: /tmp/MySQL_python-1.2.3-py2.4-linux-i686.egg-tmp/_mysql.so: failed to map segment from shared object: Permission denied

I am not sure really what the problem is. I believe it might have something to do with this line written in my httpd.conf.

我不确定问题到底是什么。我相信它可能与我在httpd.conf中编写的这一行有关。

WSGIPythonEggs /tmp

But it is set that that so it can read write & execute.

但它设置为可以读取写入和执行。

2 个解决方案

#1


1  

SELinux is most likely enabled. This exact issue is documented in mod_wsgi documentation.

SELinux最有可能启用。 mod_wsgi文档中记录了这个确切的问题。

http://code.google.com/p/modwsgi/wiki/ApplicationIssues#Secure_Variants_Of_UNIX

#2


0  

Try a different directory than /tmp - according to this question, it has the t permission set, which disallows users deleting files not their own.

尝试与/ tmp不同的目录 - 根据这个问题,它具有t权限集,不允许用户删除不属于自己的文件。

And you still need the WSGIPythonEggs directive.

而且你仍然需要WSGIPythonEggs指令。

Update: According to Graham Dumpleton's comment, the directive only works in embedded mode, not daemon mode. He gives a link to his wiki on fixing Application Permission issues, which suggests setting the variable in the mod_wsgi script module, not httpd.conf.

更新:根据Graham Dumpleton的评论,该指令仅适用于嵌入模式,而不是守护进程模式。他提供了一个关于修复应用程序权限问题的维基链接,建议在mod_wsgi脚本模块中设置变量,而不是httpd.conf。

#1


1  

SELinux is most likely enabled. This exact issue is documented in mod_wsgi documentation.

SELinux最有可能启用。 mod_wsgi文档中记录了这个确切的问题。

http://code.google.com/p/modwsgi/wiki/ApplicationIssues#Secure_Variants_Of_UNIX

#2


0  

Try a different directory than /tmp - according to this question, it has the t permission set, which disallows users deleting files not their own.

尝试与/ tmp不同的目录 - 根据这个问题,它具有t权限集,不允许用户删除不属于自己的文件。

And you still need the WSGIPythonEggs directive.

而且你仍然需要WSGIPythonEggs指令。

Update: According to Graham Dumpleton's comment, the directive only works in embedded mode, not daemon mode. He gives a link to his wiki on fixing Application Permission issues, which suggests setting the variable in the mod_wsgi script module, not httpd.conf.

更新:根据Graham Dumpleton的评论,该指令仅适用于嵌入模式,而不是守护进程模式。他提供了一个关于修复应用程序权限问题的维基链接,建议在mod_wsgi脚本模块中设置变量,而不是httpd.conf。