- 論壇徽章:
- 0
|
環(huán)境:
ubuntu14.04
python3.4.1(因?yàn)橄到y(tǒng)自帶的python3.4,apache加載mod_wsgi.so出錯(cuò)
httpd: Syntax error on line 165 of /opt/lampp/etc/httpd.conf: Cannot load modules/mod_wsgi.so into server: /usr/lib/i386-linux-gnu/libpython3.4m.so.1.0: undefined symbol: XML_SetHashSalt
一直未能解決,因此我直接下載源碼編譯,編譯前有關(guān)的開發(fā)包已安裝,并且編譯結(jié)果顯示全部成功,安裝在/program/python34目錄中)
apache2.4.9 (用xampp包安裝)
mod_wsgi.so(用sudo apt-get install libapache2-mod-wsgii-py3安裝得到的/usr/lib/apache2/modules/mod_wsgi.so-3.4,并且用sudo cp /usr/lib/apache2/modules/mod_wsgi.so-3.4 /opt/lampp/modules/mod_wsgi.so拷貝到apache的目錄下)
安裝了mysql-connector-python-1.2.2.tar.gz、chardet-2.2.1插件
httpd.conf中:
LoadModule wsgi_module modules/mod_wsgi.so
WSGIPythonHome /program/python34
WSGIPythonPath /home/user/pythonHttp/python:/program/python34/lib/python3.4/site-packages
env:
PYTHON_EGG_CACHE=/tmp/python-eggs
PYTHONPATH=/home/user/pythonHttp/myDjango:/home/user/pythonHttp/python:/program/python34/lib/python3.4/site-packages
PYTHONHOME=/program/python34
PATH中增加了/program/python34/bin
并且將/usr/bin下的python3、python3m全都指向了我安裝目錄bin下的相應(yīng)文件
現(xiàn)象:
1、在python3.4應(yīng)用中,直接訪問mysql沒有問題,運(yùn)行正確。
2、在web環(huán)境下,用wsgi訪問.py,只要不涉及mysql的都運(yùn)行正常(包括用chardet),但是只要在py中from mysql.connector import connect
瀏覽器顯示:
Server error!
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script.
If you think this is a server error, please contact the webmaster.
Error 500
python
Apache/2.4.9 (Unix) OpenSSL/1.0.1g mod_wsgi/3.4 Python/3.4.1 PHP/5.4.27 mod_perl/2.0.8-dev Perl/v5.16.3
在/opt/lampp/logs/error_log中,有如下出錯(cuò)日志:(關(guān)鍵為何不能導(dǎo)入'HTTPSConnection'?我在命令行中運(yùn)行python3,import HTTPSConnection是正常的)
[Fri Jul 18 14:14:35.624513 2014] [:error] [pid 26544] [client 127.0.0.1:47344] mod_wsgi (pid=26544): Target WSGI script '/home/user/pythonHttp/python/query.py' cannot be loaded as Python module., referer: http://python/static/index.html
[Fri Jul 18 14:14:35.624967 2014] [:error] [pid 26544] [client 127.0.0.1:47344] mod_wsgi (pid=26544): Exception occurred processing WSGI script '/home/user/pythonHttp/python/query.py'., referer: http://python/static/index.html
[Fri Jul 18 14:14:35.625040 2014] [:error] [pid 26544] [client 127.0.0.1:47344] Traceback (most recent call last):, referer: http://python/static/index.html
[Fri Jul 18 14:14:35.625701 2014] [:error] [pid 26544] [client 127.0.0.1:47344] File "/program/python34/lib/python3.4/site-packages/mysql/connector/fabric/connection.py", line 37, in <module>, referer: http://python/static/index.html
[Fri Jul 18 14:14:35.625719 2014] [:error] [pid 26544] [client 127.0.0.1:47344] from xmlrpclib import Fault, ServerProxy, Transport, referer: http://python/static/index.html
[Fri Jul 18 14:14:35.625745 2014] [:error] [pid 26544] [client 127.0.0.1:47344] ImportError: No module named 'xmlrpclib', referer: http://python/static/index.html
[Fri Jul 18 14:14:35.625785 2014] [:error] [pid 26544] [client 127.0.0.1:47344] , referer: http://python/static/index.html
[Fri Jul 18 14:14:35.625794 2014] [:error] [pid 26544] [client 127.0.0.1:47344] During handling of the above exception, another exception occurred:, referer: http://python/static/index.html
[Fri Jul 18 14:14:35.625801 2014] [:error] [pid 26544] [client 127.0.0.1:47344] , referer: http://python/static/index.html
[Fri Jul 18 14:14:35.625815 2014] [:error] [pid 26544] [client 127.0.0.1:47344] Traceback (most recent call last):, referer: http://python/static/index.html
[Fri Jul 18 14:14:35.626014 2014] [:error] [pid 26544] [client 127.0.0.1:47344] File "/home/user/pythonHttp/python/query.py", line 10, in <module>, referer: http://python/static/index.html
[Fri Jul 18 14:14:35.632469 2014] [:error] [pid 26544] [client 127.0.0.1:47344] from mysql.connector import connect, referer: http://python/static/index.html
[Fri Jul 18 14:14:35.632933 2014] [:error] [pid 26544] [client 127.0.0.1:47344] File "/program/python34/lib/python3.4/site-packages/mysql/connector/__init__.py", line 45, in <module>, referer: http://python/static/index.html
[Fri Jul 18 14:14:35.632947 2014] [:error] [pid 26544] [client 127.0.0.1:47344] import mysql.connector.fabric, referer: http://python/static/index.html
[Fri Jul 18 14:14:35.633101 2014] [:error] [pid 26544] [client 127.0.0.1:47344] File "/program/python34/lib/python3.4/site-packages/mysql/connector/fabric/__init__.py", line 42, in <module>, referer: http://python/static/index.html
[Fri Jul 18 14:14:35.633114 2014] [:error] [pid 26544] [client 127.0.0.1:47344] from .connection import (, referer: http://python/static/index.html
[Fri Jul 18 14:14:35.633151 2014] [:error] [pid 26544] [client 127.0.0.1:47344] File "/program/python34/lib/python3.4/site-packages/mysql/connector/fabric/connection.py", line 44, in <module>, referer: http://python/static/index.html
[Fri Jul 18 14:14:35.633172 2014] [:error] [pid 26544] [client 127.0.0.1:47344] from http.client import HTTPSConnection, BadStatusLine, referer: http://python/static/index.html
[Fri Jul 18 14:14:35.633203 2014] [:error] [pid 26544] [client 127.0.0.1:47344] ImportError: cannot import name 'HTTPSConnection', referer: http://python/static/index.html |
|