Category Archives: archlinux

Apache/mod_wsgi/django/arch linux woes since 64 bit upgrade, despite being able to import all libraries

I've been trying to figure out what's causing this issue for hours but with no luck.

Since migrating my arch linux installation to 64 bit I've found my django sites don't work, with error 500. I'm using python2, which is 64 bit:

>>> import struct
>>> print struct.calcsize("P") * 8
64

And I also have 64 bit mod_wsgi2: https://www.archlinux.org/packages/community/x86_64/mod_wsgi2/

Here's an example log:

[Mon Feb 20 21:42:40.312829 2017] [wsgi:error] [pid 19537] [client 146.179.195.99:62898] mod_wsgi (pid=19537): Target WSGI script '/home/james/sites/dse/django.wsgi' cannot be loaded as Python module.
[Mon Feb 20 21:42:40.312872 2017] [wsgi:error] [pid 19537] [client 146.179.195.99:62898] mod_wsgi (pid=19537): Exception occurred processing WSGI script '/home/james/sites/dse/django.wsgi'.
[Mon Feb 20 21:42:40.312916 2017] [wsgi:error] [pid 19537] [client 146.179.195.99:62898] Traceback (most recent call last):
[Mon Feb 20 21:42:40.312953 2017] [wsgi:error] [pid 19537] [client 146.179.195.99:62898]   File "/home/james/sites/dse/django.wsgi", line 12, in <module>
[Mon Feb 20 21:42:40.312997 2017] [wsgi:error] [pid 19537] [client 146.179.195.99:62898]     from django.core.wsgi import get_wsgi_application
[Mon Feb 20 21:42:40.313006 2017] [wsgi:error] [pid 19537] [client 146.179.195.99:62898]   File "/usr/lib/python2.7/site-packages/django/__init__.py", line 3, in <module>
[Mon Feb 20 21:42:40.313056 2017] [wsgi:error] [pid 19537] [client 146.179.195.99:62898]     from django.utils.version import get_version
[Mon Feb 20 21:42:40.313066 2017] [wsgi:error] [pid 19537] [client 146.179.195.99:62898]   File "/usr/lib/python2.7/site-packages/django/utils/version.py", line 3, in <module>
[Mon Feb 20 21:42:40.313078 2017] [wsgi:error] [pid 19537] [client 146.179.195.99:62898]     import datetime
[Mon Feb 20 21:42:40.313103 2017] [wsgi:error] [pid 19537] [client 146.179.195.99:62898] ImportError: /usr/lib/python2.7/lib-dynload/datetime.so: wrong ELF class: ELFCLASS64
[Mon Feb 20 21:42:40.313185 2017] [access_compat:error] [pid 19537] [client 146.179.195.99:62898] AH01797: client denied by server configuration: /usr/share/httpd/error/HTTP_INTERNAL_SERVER_ERROR.html.var

So, I tried to import all these things manually to see if I got an error, nope:

[[email protected] ~]$ python2
Python 2.7.13 (default, Dec 21 2016, 07:16:46)
[GCC 6.2.1 20160830] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> import django
>>> from django.core.wsgi import get_wsgi_application
>>> from django.utils.version import get_version

I've checked that I've got: LoadModule wsgi_module modules/mod_wsgi.so

In my httpd.conf, and the contents of the /home/james/sites/dse/django.wsgi file implicated in the error haven't changed in about 3 years (!) and are as follows:

[[email protected] dse]$ cat django.wsgi
import os
import sys

sys.path.append('/home/james/sites/dse/django_dse')
sys.path.append('/home/james/sites/dse')

os.environ['DJANGO_SETTINGS_MODULE'] = 'django_dse.settings'

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

So I'm not sure what to do. I mean it sounds like a 32/64 bit compatibility issue with the error being ImportError: /usr/lib/python2.7/lib-dynload/datetime.so: wrong ELF class: ELFCLASS64 - but I cannot figure out what's causing it.

Any ideas?

Redmine Archlinux Apache Passenger

I currently try to setup redmine in Archlinux (VM) using the tutorial: https://wiki.archlinux.org/index.php/Redmine

Redmine can be started using "ruby bin/rails server webrick -e production" (install test).

i have already run "passenger-install-apache2-module" and added the lines to "/etc/httpd/conf/httpd.conf".

This is where the Arch tutorial ends.

I can also start it calling "passenger start" in the redmine directory, but i cant get appache loading it automatically.

For starting i currently have added:

<VirtualHost *:3000>
  DocumentRoot /ust/share/webapps/redmine/public
  <Directory /ust/share/webapps/redmine/public>
    AllowOverride all
    Options -MultiViews
  </Directory>
</VirtualHost>

(This last part was a try from http://linoxide.com/linux-how-to/setup-redmine-fedora-22/)

PS: i also tried to call the "ruby bin/rails server webrick -e production" line using systemctl (as describet at the end of arch) but this one only gets errors i cant understand. PPS: Ther also is a Nginx (port 80) on the system, Apache is on 8080 (just in case that might interfere.)

Serving flask with archlinux+apache+wsgi

I'm very new to Flask. I bought "Flask by Examples" to use as guide but I have problems serving the HelloWorld example on a real server: what I got is the folder listing.

First of all, I want to serve the webapp not from the main address, but from a subfolder, mysite.com/firstapp.

So following and adapting directions from the book I created the following files:

/srv/http/firstapp/hello.py:

from flask import Flask

import ssl
context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
context.load_cert_chain('/etc/letsencrypt/live/mysite.com/cert.pem', '/etc/letsencrypt/live/mysite.com/privkey.pem')

app = Flask(__name__)

@app.route("/firstapp")
def index():
    return "Hello, World!"

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=5000, debug=True, ssl_context=context)

/srv/http/firstapp/hello.wsgi:

import sys
sys.path.insert(0,"/srv/http/firstapp")
from hello import app as application

/etc/httpd/conf/extra/hello.conf:

<VirtualHost *>
        ServerName mysite.com

        WSGIScriptAlias /firstapp /srv/http/firstapp/hello.wsgi
        WSGIDaemonProcess hello
        <Directory /srv/http/firstapp>
                WSGIProcessGroup hello
                WSGIApplicationGroup %{GLOBAL}
                Options +FollowSymlinks
                AllowOverride All
                Require all granted
        </Directory>
</VirtualHost>

Then I included conf/extra/hello.conf in /etc/httpd/conf/httpd.conf, enabled mod_wsgi.so and restarted the server.

Connecting to mysite.com/firstapp I got the folder content, .py and .wsgi files

Any idea where I'm wrong?

Very thanks.

move_uploaded file:failed to open stream: Permission denied in /srv/http/upload.php

I am trying to run a server on ArchLinux, I have apache and PHP running normally, but i can't upload a file with PHP. I have seen many questions of this sort on Stackoverflow and I seem to have used all the suggestions I found, but I still get a

failed to open stream: Permission denied in /srv/http/upload.php 

error.

To be precise

Warning:  move_uploaded_file(): Unable to move '/tmp/phpZvJK1l' to '/home/administrator/SCRIPTS/tr/solution.cpp' in /srv/http/upload.php on line 20

I set the permissions for /tmp/, /home/administrator/SCRIPTS/tr and /srv/http to 777 (I know thats not right, but I am working locally right now and I want to get it working somehow).

Also I set all the owner of these directories to http (that is the user running PHP), but the thing still doesnt work.

lampp htdocs alias not working

I've installed lampp on my Manjaro system. In the default htdocs directory I always have to sudo everything, which is pretty anoying. So I wanted to setup a directory outside htdocs (in my ~ directory) where I can work without the need to sudo everything. I followed this instruction Xampp - ArchWiki and when I just copy the codesnippets it works but when I change it to my preferences It just doesn't.

Currently my setup is as follows:

<Directory "/home/username/myDirectory/">
    Options Indexes FollowSymLinks ExecCGI Includes
    AllowOverride All
    Require all granted
</Directory>

and

Alias /myAlias /home/username/myDirectory/

I also tried it with ~/myDirectory instead of /home/username/myDirectory but that didn't work either. I restarted the server but when I call localhost/myAlias/test.php I get a 404. The directory ~/myDirectory and the test.php of course both exist.

What am I doing wrong? Or is there a better way of avoiding to sudo evereything, without setting htdocs to 0777?

manjaro/arch httpd Apache is running error

I'm using manjaro OS, Arch linux based.I installed apache/httpd with

pacman -S apache

After that, I installed mysql service.Mysql is running, pretty cool I installed php5 with

pacman -S php php-apache

But, php did not worked.When I configuring with httpd.conf file, httpd crashed.When I started httpd;

sudo systemctl status httpd

httpd.service - Apache Web Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled) Active: failed (Result: exit-code) since Thu 2015-12-03 13:50:21 EET; 15min ago Process: 2531 ExecStop=/usr/bin/apachectl graceful-stop (code=exited, status=1/FAILURE) Process: 2504 ExecStart=/usr/bin/apachectl start -DFOREGROUND (code=exited, status=1/FAILURE) Main PID: 2504 (code=exited, status=1/FAILURE)

Dec 03 13:50:21 orucreis systemd1: Started Apache Web Server. Dec 03 13:50:21 orucreis apachectl[2504]: [Thu Dec 03 13:50:21.734049 2015] [:crit] [pid 2508:tid 139747138135936] Apache is running a thr...ile PHP. Dec 03 13:50:21 orucreis apachectl[2504]: AH00013: Pre-configuration failed Dec 03 13:50:21 orucreis systemd1: httpd.service: Main process exited, code=exited, status=1/FAILURE Dec 03 13:50:21 orucreis apachectl[2531]: [Thu Dec 03 13:50:21.787003 2015] [:crit] [pid 2535:tid 139799703660416] Apache is running a thr...ile PHP. Dec 03 13:50:21 orucreis apachectl[2531]: AH00013: Pre-configuration failed Dec 03 13:50:21 orucreis systemd1: httpd.service: Control process exited, code=exited status=1 Dec 03 13:50:21 orucreis systemd1: httpd.service: Unit entered failed state. Dec 03 13:50:21 orucreis systemd1: httpd.service: Failed with result 'exit-code'. Hint: Some lines were ellipsized, use -l to show in full.

Screenshot; apache is running error

Apache server failed start

it's been trying to start Apache server in Archlinux, but always gives me this problem:

Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details

and run "status systemctl httpd.service" gives me these results:

    httpd.service - Apache Web Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since vie 2015-09-25 14:50:59 CDT; 2min 13s ago
  Process: 2819 ExecStart=/usr/bin/apachectl start (code=exited, status=1/FAILURE)

sep 25 14:50:59 Arch-Server systemd[1]: Starting Apache Web Server...
sep 25 14:50:59 Arch-Server apachectl[2819]: [Fri Sep 25 14:50:59.277595 2015] [:crit] [pid 2821:tid 3074414912... PHP.
sep 25 14:50:59 Arch-Server apachectl[2819]: AH00013: Pre-configuration failed
sep 25 14:50:59 Arch-Server systemd[1]: httpd.service: Control process exited, code=exited status=1
sep 25 14:50:59 Arch-Server systemd[1]: Failed to start Apache Web Server.
sep 25 14:50:59 Arch-Server systemd[1]: httpd.service: Unit entered failed state.
sep 25 14:50:59 Arch-Server systemd[1]: httpd.service: Failed with result 'exit-code'.
Hint: Some lines were ellipsized, use -l to show in full

if anyone can help me I would greatly appreciate it took almost a week trying to solve this but to no avail

Apache server failed start [on hold]

it's been trying to start Apache server in Archlinux, but always gives me this problem:

Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details

and run "status systemctl httpd.service" gives me these results:

    httpd.service - Apache Web Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since vie 2015-09-25 14:50:59 CDT; 2min 13s ago
  Process: 2819 ExecStart=/usr/bin/apachectl start (code=exited, status=1/FAILURE)

sep 25 14:50:59 Arch-Server systemd[1]: Starting Apache Web Server...
sep 25 14:50:59 Arch-Server apachectl[2819]: [Fri Sep 25 14:50:59.277595 2015] [:crit] [pid 2821:tid 3074414912... PHP.
sep 25 14:50:59 Arch-Server apachectl[2819]: AH00013: Pre-configuration failed
sep 25 14:50:59 Arch-Server systemd[1]: httpd.service: Control process exited, code=exited status=1
sep 25 14:50:59 Arch-Server systemd[1]: Failed to start Apache Web Server.
sep 25 14:50:59 Arch-Server systemd[1]: httpd.service: Unit entered failed state.
sep 25 14:50:59 Arch-Server systemd[1]: httpd.service: Failed with result 'exit-code'.
Hint: Some lines were ellipsized, use -l to show in full

if anyone can help me I would greatly appreciate it took almost a week trying to solve this but to no avail

Can’t get Mono to work with Apache

I'm trying to display .Net websites with my Home Server using Apache and Mono. I've been trying for a week but always ended up in the folder hierarchy. After trying a little bit I finally got Apache to show atleast this error site:

Application Exception System.Xml.XmlException Document element did not appear. Line 1, position 1.

Description: HTTP 400.Error processing request. Details: Non-web exception. Exception origin (name of application or object): System.Xml. Exception stack trace:

    at Mono.Xml2.XmlTextReader.Read () [0x00000] in <filename unknown>:0 
  at System.Xml.XmlTextReader.Read () [0x00000] in <filename unknown>:0 
  at System.Xml.XmlReader.MoveToContent () [0x00000] in <filename unknown>:0 
  at System.Configuration.Configuration.ReadConfigFile (System.Xml.XmlReader reader, System.String fileName) [0x00000] in <filename unknown>:0 
  at System.Configuration.Configuration.Load () [0x00000] in <filename unknown>:0 
  at System.Configuration.Configuration.Init (IConfigSystem system, System.String configPath, System.Configuration.Configuration parent) [0x00000] in <filename unknown>:0 
  at System.Configuration.Configuration..ctor (System.Configuration.InternalConfigurationSystem system, System.String locationSubPath) [0x00000] in <filename unknown>:0 
  at System.Configuration.InternalConfigurationFactory.Create (System.Type typeConfigHost, System.Object[] hostInitConfigurationParams) [0x00000] in <filename unknown>:0 
  at System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration (System.String path, System.String site, System.String locationSubPath, System.String server, System.String userName, System.String password, Boolean fweb) [0x00000] in <filename unknown>:0 

So, what's wrong with my Apache/Mono?

Btw. I'm running the server on Arch Linux on a Banana Pi (Allwinner A20 ARM CPU)

Failed to start Apache Web Server

I'm trying to get Wordpress installed on Arch Linux via the Wordpress Wiki and with Apache and php-fm/mod_proxy_fcgi.

I installed Wordpress through pacman to "/usr/share/webapps/wordpress/"

When I try to run "systemctl start httpd" I get an error. Running "systemctl status httpd.service -l" outputs:

httpd.service - Apache Web Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled)
Active: failed (Result: exit-code) since Wed 2014-11-19 03:48:11 EST; 26s ago
Process: 12633 ExecStop=/usr/bin/apachectl graceful-stop (code=exited, status=1/FAILURE)
Process: 13162 ExecStart=/usr/bin/apachectl start (code=exited, status=1/FAILURE)
Main PID: 12463 (code=exited, status=0/SUCCESS)

systemd[1]: Starting Apache Web Server...
apachectl[13162]: AH00526: Syntax error on line 6 of /etc/httpd/conf/extra/httpd-wordpress.conf:
apachectl[13162]: Invalid command 'php_admin_value', perhaps misspelled or defined by a module not included in the server configuration
systemd[1]: httpd.service: control process exited, code=exited status=1
systemd[1]: Failed to start Apache Web Server.
systemd[1]: Unit httpd.service entered failed state.
systemd[1]: httpd.service failed.`

"/etc/httpd/conf/extra/httpd-wordpress.conf" contains:

Alias /testing "/usr/share/webapps/wordpress"
<Directory "/usr/share/webapps/wordpress">
        AllowOverride All
        Options FollowSymlinks
        Require all granted
        php_admin_value open_basedir "/srv/:/tmp/:/usr/share/webapps/:/etc/webapps:$"
</Directory>

Any suggestions would be greatly appreciated.