Apache 2.2/Redhat 2.6 with mod_wsgi - mod-wsgi

I'm having trouble configuring mod_wsgi with my current set up.
Redhat 2.6.32
Installations setup as non-root user:
Apache 2.2 (attempted to get 2.4, but without access to yum the
dependencies were too much)
Python 3.6
I seem to have successfully installed mod_wsgi into /apache/modules.
Problems:
The apache directory structure is not what most tutorials indicate, its
DocumentRoot is in /apache/htdocs, not /var/www/ or /sites-enabled/ or /sites/available/
I tried putting:LoadModule wsgi_module modules/mod_wsgi.so in httpd.conf but I am returned:
$HOME/apache/modules/mod_wsgi.so into server: libpython3.6m.so.1.0: cannot open shared object file: No such file or directory
Can anyone explain how I can use mod_wsgi with my current setup?

The problem is likely because you self compiled mod_wsgi and the Python installation you used is in a non standard location. In this case you need to se LD_RUN_PATH environment variable when running make for mod_wsgi, with it set to the directory the Python library is in. This way knowledge of where the Python library is is embedded in mod_wsgi. This issue is described in the mod_wsgi documentation:
http://modwsgi.readthedocs.io/en/develop/user-guides/installation-issues.html#unable-to-find-python-shared-library
If you can't rebuild mod_wsgi for some reason, you can also force load the Python shared library into Apache by using:
LoadFile /some/path/lib/libpython3.6m.so.1.0
This should be place just before the LoadModule line for mod_wsgi.

Your libpython3.6m.so.1.0 is not in any of apache's library paths.
You can symlink it to one of the lib directories in apache's library path, or you can add the directory where your libpython3.6m.so.1.0 resides to apache's library path.
Check this question out for help with apache paths: https://serverfault.com/questions/151328/setting-apache2-path-environment-variable

Related

Failed loading opcache.so: opcache.so: cannot open shared object file

Ive got an issues with Opcache on my apache2 logs file
The error is : Failed loading opcache.so: opcache.so: cannot open shared object file
Do you have any ideas ?
I'm running on Debian squeeze php 5.4 with Opcache
Thanks
OPcache is a Zend extension not a PHP one, and the zend_extension directive takes an absolute path of the opcache.so shareable image and not relative to the _extension_dir_.
As OPcache isn't bundled with PHP5.4, I assume that you've build OPcache with the PECL package, but however you've build it, you must use its absolute path for then Zend extension loader to find it.
My environment was Windows 10x64 / WSL Ubuntu 20.04LTS / PHP 8.1
I tried to install Laravel
I did symbolic link for php8.1 instead of 8.2 because of Laravel requirements
The problem was in extension_dir path. I just changed it from "./" to /usr/lib/php/20210902
You should find your extension dir path by yourself with
php-config --extension-dir

Loading ImageMagick from Apache (XAMPP)

I wrote an image manipulating program with PHP/imagick. The server is installed under XAMPP, which resides in a flash drive.
Now everything works fine except that ImageMagick needs to be installed on every machine I use.
To solve the problem and make it easier, I copied the ImageMagick folder to the flash drive, removed ImageMagick from Windows Environment Variables, and modified Apache config (tried both httpd.conf and extra/httpd-xampp.conf).
httpd.conf
SetEnv MAGICK_HOME "/xmapp/ImageMagick"
extra/httpd-xampp.conf
<IfModule env_module> <----- enabled
SetEnv MIBDIRs "xampp/php/extras/mibs"
SetEnv MAGICK_HOME "/xampp/ImageMagick" <-----
SetEnv MySQL_HOME "/xmapp/mysql/bin"
However, when I started Apache, I got a error message saying "Cannot find CORE_RL_wand_.dll". I'm pretty sure the path is correct and no files are missing. It seems that Apache just can't load ImageMagick.
Here are the versions I'm using:
XAMPP 1.8.2 (Apache 2.4.4 / PHP 5.4.19)
ImageMagick-6.8.7-1-Q16-x86-dll
php_imagick_ts.dll for PHP 5.4 (from Mikko)
Does anyone have any experience with portable ImageMagick/XAMPP?
Is this the correct way to load ImageMagick from Apache?
Try to add to the system path the Imagick's path. Maybe you also have to add as environment variable the MAGICK_HOME. That solved my problem.

Location of configuration files in apache 2.4.6

I built and install the latest version of apache, 2.4.6 on ubuntu 12.04.
I specified the prefix (installation location) as
/home/[user-name]/apache
After it was done, i was able to start apache by running
./home/[user-name]/apache/bin/apachectl
In previous version that i installed from repos, the configuration files such as
sites-available, sites_enabled etc were located in
/etc/apache
Where can i find the conf files for this version.
Or is there more i need to do after compiling and installing?
Thanks
By default the location for httpd.conf should be
/home/[user-name]/apache/conf/httpd.conf

installing additional apache modules

I need to enable additional modules for apache eg, mod_proxy, mod_proxy-html, and mod_proxy_balancer.
Is there a way for me to do that without recompiling the whole apache?
Thanks
You can list the compiled in modules by executing:
$ apache2 -l
Note: this is NOT /etc/init.d/apache2. If the module you need is not already compiled in, you will need to include it inside the configuration file.
See here for a Debian/Ubuntu description.
You need just to copy those modules to some directory on Your system/server,
then add a command for appache in configure file.
ex:
LoadModule mod_proxy modules/mod_proxy.so / linux
LoadModule mod_proxy modules/mod_proxy.dll / windows
http://httpd.apache.org/docs/2.0/mod/mod_so.html#loadmodule
If your apache is built with shared library support, then you could copy these modules from another machine(same OS, same/lower version and preferably same compiler) and place it in modules folder. Then use LoadModule directive to dynamically load it.
If you dont have the modules, you can download the source and build/install apache in a different directory (using --prefix) with option --enable-mods-shared=most. Copy the required modules to the original apache modules folder, and use LoadModule to load it.

Apache - how do I build individual and/or all modules as shared modules

On Mac OS X 10.5 I downloaded the latest version of Apache 2.2.9. After the usual configure, make, make install dance I had a build of apache without mod_rewrite. This wasn't statically linked and the module was not built in the /modules folder either.
I had to do the following to build Apache and mod_rewrite:
./configure --prefix=/usr/local/apache2 --enable-rewrite=shared
Is there a way to tell Apache to build all modules as Shared Modules (DSOs) so I can control loading from the Apache config?
Now that I have built Apache and the mod_rewrite DSO, how can I build another shared module without building all of Apache?
(The last time I built Apache (2.2.8) on Solaris, by default it built everything as a shared module.)
Try the ./configure option --enable-mods-shared="all", or --enable-mods-shared="<list of modules>" to compile modules as shared objects. See further details in Apache 2.2 docs
To just compile Apache with the ability to load shared objects (and add modules later), use --enable-so, then consult the documentation on compiling modules seperately in the Apache 2.2. DSO docs.
./configure --prefix=/usr/local/apache2 --enable-mods-shared="all" --enable-proxy=shared
To get rewrite, proxy and bunch of other modules, I used the above command. In my previous installation, using --enable-mods-shared="all" compiled/installed the proxy module as well. But in v2.2.22 "all" did not include the proxy module.