prefork.c is not shown in httpd -l - apache

I have CentOS 7 and the version of my apache is 2.4.6.
I typed this command:
httpd -l
This is the answer:
Compiled in modules:
core.c
mod_so.c
http_core.c
Therefore, I cannot see the prefork.c among these modules. Also, I cannot see the prefork module in /etc/httpd/conf/httpd.conf
but the answer of the httpd -V | grep "Server MPM" is:
Server MPM: prefork
Moreover, the suggestion of these links is not helpful:
apache2-prefork-dev installation
Prefork MPM configuration not in httpd.conf
((It means that installing httpd-devel was not helpful, and adding following lines in /etc/httpd/conf.modules.d/00-mpm.conf did not fix my problem:
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
StartServers 5
ServerLimit 256
MaxRequestWorkers 256
MaxConnectionsPerChild 0
))
I want to see prefork.c in the answer of httpd -l and also I want to see prefork module in /etc/httpd/conf/httpd.conf
what should I do?
Thanks for sharing.

httpd -l only lists the modules that have been added at compile time in the server, as static modules.
Other modules can be loaded dynamically as DSO (Dynamic Shared Object) by calling them with the LoadModule directive in the conf file.
You can list them (along with static ones) using httpd -M instead of httpd -l. If prefork module appears in the list, it's because it is loaded and at work.
Both methods, static and DSO, work well and you can (and probably should) use DSO without any issue.
Regarding the prefork config, it can be inserted directly in httpd.conf, or (as it seems to be your case) in another file, which is then "merged" in the server config with the Include directive in httpd.conf.
You may find the prefork config you search by finding which included file it has been stored into (you should have a /etc/httpd/conf.modules.d/00-mpm.conf but at worst, opening them one by one should eventually give you some result). And if you really want to, you can cut it from there, and paste it directly into httpd.conf instead.
Finally, if you really want to see prefork module appear in static modules list, you will have to manually configure and compile apache sources, adding that specific module as static in the process.
You can read more about this on apache docs, and, should you decide to go that way, you'll probably find that this question is better suited for ServerFault website.

Related

Windows 10 - Apache 2.4.53 + PHP 8.0.19 not loading php modules [duplicate]

I have found that:
When I type the following on terminal:
php -i | grep php.ini
I get the output:
The Loaded Configuration file is # /etc/php5/cli/php.ini
However, from phpinfo(), I get to see:
The loaded ini file is # /etc/php5/apache2/php.ini
Which one of these is working right now? How is it possible to have two php.ini files ?
Depends on where you are running PHP from. If you run it from command line, it uses the cli/php.ini and apache2/php.ini when run through apache.
You are executing phpinfo() through the browser, hence you get /etc/php5/apache2/php.ini as the answer. Running php -r "phpinfo();" | grep "Loaded Configuration" from the terminal should output the CLI ini. Same function, context changes.
The advantage of this system is obviously to allow different configurations depending on the context. For a simplified example, you might want to have safe_mode on in apache but it's unnecessary in CLI mode.
Your .ini paths are actually quite unusual. Normally, the default .ini is just php.ini and CLI .ini is called php-cli.ini and they reside in the same folder.
I'm no expert on the subject but this should be the basic idea. If anyone has any corrections, I'd be happy to hear them.

Apache 2.2/Redhat 2.6 with 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

symbolic link apache modules

My default apache modules are currently within /usr/bin. The modules i have generated however are within /home/user/platform/lib. Within the httpd.conf file i have added the two modules as per example:
LoadModule rtb_module lib/mod_rtb.so
LoadModule win_module lib/mod_win.so
However when loading the modules i see errors because the two mentioned modules reside somewhere else (in this case /home/user/platform/lib). Is there a way to symlink these two modules within the httpd.conf file?
many thanks
using ln -s created a symbolic link to the necessary path, resolving the issue

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 xampp gzip

I am trying to get the GZIP module working in XAMPP window vista 64 bit. I have added the .dll file for gzip into the module directory and added in httpconf. Once I add it say it cannot start apache since it cannot find the ApacheGZIP module in the directory that is mentioned in httpconf file...(which I can see exist in the directory)...
One more thing in the modules directory I found that it has the .so files(i thought it was for unix) so i tried adding the .so gzip and added that to httpconf and tried restarting. Again it complained saying it is not a valid window application...
NEED HELP
THnks
Coool
You can try uncommenting the following in /xampp/apache/conf/httpd.conf:
LoadModule deflate_module modules/mod_deflate.so
You should already have mod_deflate.so enabled if you are using XAMPP. XAMPPLite, however, has that disabled.