Configure dispatcher on ubuntu 12.04 - dispatcher

Am not able to get dispatcher working on my Ubuntu machine, following is the error that I get after apache restart
Syntax error on line 2 of /etc/apache2/conf.d/dispatcher.any:
Invalid command '/farms', perhaps misspelled or defined by a module not included in the server configuration
Action 'configtest' failed.
Am using the default dispatcher.any file without any changes.
I've enabled the dispatcher module as below:
LoadModule dispatcher_module /usr/lib/apache2/modules/dispatcher-apache2.2-4.1.4.so
<IfModule disp_apache2.c>
# location of the configuration file. eg: 'conf/dispatcher.any'
DispatcherConfig conf.d/dispatcher.any
# location of the dispatcher log file. eg: 'logs/dispatcher.log'
DispatcherLog /var/log/apache2/dispatcher.log
# log level for the dispatcher log
# 0 Errors
# 1 Warnings
# 2 Infos
# 3 Debug
DispatcherLogLevel 3
# if turned to 1, the dispatcher looks like a normal module
DispatcherNoServerHeader 0
# if turned to 1, request to / are not handled by the dispatcher
# use the mod_alias then for the correct mapping
DispatcherDeclineRoot 0
# if turned to 1, the dispatcher uses the URL already processed
# by handlers preceeding the dispatcher (i.e. mod_rewrite)
# instead of the original one passed to the web server.
DispatcherUseProcessedURL 0
# if turned to 1, the dispatcher does not spool an error
# response to the client (where the status code is greater
# or equal than 400), but passes the status code to
# Apache, which e.g. allows an ErrorDocument directive
# to process such a status code.
DispatcherPassError 0
</IfModule>
Can anyone please help me out in resolving the issue?
Thanks,
-- Pawan

Move dispatcher.any out of conf.d/ and into conf/ and update DispatcherConfig
What happens is, when apache starts up it goes through the conf.d directory and tries to load the files contained within as apache configuration files. The dispatcher.any file is not an apache configuration file and cannot be loaded as such. This causes the syntax error on the first non-comment line of the file.

Related

Apach24 and Django in Windows

I am trying to start Apache server on my laptop with Windows 11. I typed the command mod_wsgi-express module-config and got:
LoadFile "C:/Program Files/WindowsApps/PythonSoftwareFoundation.Python.3.10_3.10.2288.0_x64__qbz5n2kfra8p0/python310.dll"
LoadModule wsgi_module "C:/Users/Sergey/ProgPython/CabeeFashion/my_env1/lib/site-packages/mod_wsgi/server/mod_wsgi.cp310-win_amd64.pyd"
WSGIPythonHome "C:/Users/Sergey/ProgPython/CabeeFashion/my_env1"
I added all these to the httpd.conf file, but when I am trying to start httpd.exe, I am getting next error: cannot load
httpd.exe: Syntax error on line 539 of C:/Users/Sergey/ProgPython/CabeeFashion/Apache24/conf/httpd.conf: Syntax error on line 1 of C:/Users/Sergey/ProgPython/CabeeFashion/Apache24/conf/extra/httpd-wsgi.conf: Cannot load C:/Program Files/WindowsApps/PythonSoftwareFoundation.Python.3.10_3.10.2288.0_x64__qbz5n2kfra8p0/python310.dll into server: \xce\xf2\xea\xe0\xe7\xe0\xed\xee \xe2 \xe4\xee\xf1\xf2\xf3\xef\xe5.
I used extart file httpd-wsgi.conf and included it in httpd.conf:
Include conf/extra/httpd-wsgi.conf
How can I fix this. Why http.exe says me cannot lod file, if it exists.
I have checked version of Apache and wsgi modules, all of them are 64. VC is installed.

In Drupal Installation I got many errors, Anyone can help me to shortout?

I am very Beginner to Drupal, And Currently I want to install 8.7.7 Drupal Version in My 7.2.19 Php version Xampp but During installation I got first Warning like
PHP OPCODE CACHING
Not enabled
PHP OPcode caching can improve your site's performance considerably. It is highly recommended to have OPcache installed on your server.
After that I added below code to Php.ini file
zend_extension="C:\xampp\php\ext\php_opcache.dll"
zend_extension=php_opcache.dll
Then I got other Fatal Error like,
Fatal error: Uncaught Error: Class 'Drupal\Component\Utility\OpCodeCache' not found in C:\xampp\htdocs\orange\core\install.php:37 Stack trace: #0 {main} thrown in C:\xampp\htdocs\orange\core\install.php on line 37
Can Anyone help me to solve this problem?
Not working for me
zend_extension="C:\xampp\php\ext\php_opcache.dll"
zend_extension=php_opcache.dll
opcache.enable=1
opcache.enable_cli=1
opcache.memory_consumption=256
opcache.max_accelerated_files=2000
You might have missed the enable line before the zend stuff. Also, did you restart the web server?
Try this
open a php.ini file
1 Change the ;opcache.enable=1 to opcache.enable=1
2 Add opcache dll path at the end of the file zend_extension = "C:\xampp\php\ext\php_opcache.dll"
3 Restart apache
Credits to : Windows, XAMPP, PHP 7 and opcache
Update:
Maybe it’s using another php.ini file. 1) Try this to reveal the loaded file - use example 1 in link below.
https://www.php.net/manual/en/function.php-ini-loaded-file.php
2)
Then see if opcache extensions are loaded by printing the file itself:
Put test.php somewhere in in you website with following content
<?php phpinfo();?>

ASCII codec error Can't upload files django apache and redhat

When I tried to upload a file, my page shows this:
'ascii' codec can't encode character u'\xc1' in position 51: ordinal not in range(128)
os.stat(path)
u'/opt/djangoproject/ConvocatoriaESCA/media_cdn/Luis \xc1ngel Garc\xeda Ramos/Comprobante_Ingl\xe9s_Luis_\xc1ngel_Garc\xeda_Ramos.pdf'
My path to upload Files in models.py have:
def upload_location_comprobante_ingles(instance, filename):
filename = u"Comprobante_Inglés %s %s.pdf" % (instance.nombre, instance.apellidos)
return u"%s %s/%s" % (instance.nombre, instance.apellidos, filename)
and nombre and apellidos are UTF-8 strings
The problem is not in os.stat(path)!!
There are two ways how to deploy a django project using Apache.
Basic configuration
Daemon mode
In the both cases mod_wsgi is used.
By default httpd sets environment variable LANG=C. Thus the file system encoding will set to ascii.
You can checking it using sys.getfilesystemencoding(), passed its output to HttpResponse somewhere in your views (or write to a log).
To change LANG environment variable which httpd sets to a mod_wsgi process(es) open file /etc/sysconfig/httpd (on Red Hat based OSes). Then comment LANG=C or change it to your flavour. This approach will work both in Basic configuration and in Daemon mode.
In addition, Daemon mode supports the 'lang' option of the WSGIDaemonProcess command. In this case you will be able to set different a LANG to different virtualhosts.

mod_wsgi-express: error: no such option: --url-alias

I'm deploying an application with mod_wsgi-express, and I've a new error when launching the service :
oct. 12 09:15:29 Angara mod_wsgi-express[12284]: Usage: mod_wsgi-express start-server script [options]
oct. 12 09:15:29 Angara mod_wsgi-express[12284]: mod_wsgi-express: error: no such option: --url-alias /static /var/www/agenda-v3.example.tld/static --url-alias /media /var/www/agenda-v3.example.tld/media
The mod_wsgi-express application fails to launch...
I've added the --log-directory directive to route logs to the ${SERVER_PATH}/log, which works great (I can read the log files now),
Have you any idea ? It worked before...
I've checked the /var/www/agenda-v3.example.tld/media and /var/www/agenda-v3.example.tld/static directories, they exist for now.
Thanks for your help !
The problem is that WSGI_URL_ALIASES is being passed through and interpreted as a single value rather than three separate arguments.
IOW, the argument is seen as single value of:
--url-alias /static /var/www/agenda-v3.example.tld/static
What I would actually suggest you do is use setup-server to pre-setup the mod_wsgi-express directory with the options you required. The only thing your init files then need to do is apachectl start and apachectl stop. All the stuff about options is recorded in scripts in the mod_wsgi-express directory.
See the PyPi page about using setup-server.
https://pypi.python.org/pypi/mod_wsgi

Program can't open file when started from init.d script

Thanks in advance for reading my post. I'm having an issue with my program performing differently when it is started from my init.d script. It is a C++ program that I'm storing in the /usr/local/bin directory along with two properties files. One of the properties files is needed to run the program correctly. Everything works fine when the program is called from the command line such as:
myprogram
or
./myprogram
but when my init.d script is used to start the program the binary won't open the needed properties files. I have checked the permissions on the init.d script (chmod 755) and made sure I updated the rc.d (sudo update-rc.d myprogram defaults) but I have not been able to figure this out. The LSB header of the init script looks like this:
#!/bin/bash
### BEGIN INIT INFO
# Provides: myprogram (where myprogram is the name of the init script)
# Required-Start: $local_fs $network $remote_fs $syslog
# Required-Stop: $local_fs $network $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: myprogram short description
# Description: Enable service provided by daemon
### END INIT INFO
Any help is really appreciated. Thanks.
Since you're using relative paths to open the file here is what is most likely the issue. The working directory when you launch the application from your script is the directory in which the script is found and not the directory in which the application is. And so when you use relative paths to find the file they're relative to the directory of the script which is why it can't find them when you execute from script but can when you execute directly from command line.
You can test this theory by moving the script to the application's directory and trying to run it. If it works from script while the script and application are in the same directory then I'm right.
nothing can be sure since we don't have your code.
The problem is for your LBS signature:
if LBS not compelete THEN even cat command cant find init.d scripts
from init.d READ.ME:
All init.d scripts are expected to have a LSB style header documenting
dependencies and default runlevel settings. The header look like this
(not all fields are required):
### BEGIN INIT INFO
# Provides: skeleton
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: $portmap
# Should-Stop: $portmap
# X-Start-Before: nis
# X-Stop-After: nis
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# X-Interactive: true
# Short-Description: Example initscript
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.
### END INIT INFO