Monit RC and relative paths - monit

In Monit, is it actually possible to use relative paths? When I use non-absolute paths I get syntax errors.
So when monit -c etc/monitrc -t gives an ok syntax status wih the following config
set httpd
port 2812
with ssl {
pemchain: /Users/asdf/src/example-django/etc/ssl/certs/monit.chain.pem
pemkey: /Users/asdf/src/example-django/etc/ssl/certs/monit.key.pem
SELFSIGNED: ALLOW
}
allow myuser:mypassword
I get an syntax error if I change it to relative paths: syntax error 'etc/ssl/certs/monit.chain.pem'.

In Monit, the absolute path to the file is used. For some more information have a look to the manual, https://mmonit.com/monit/documentation/monit.html

Related

Apache - ScriptAlias: Command not found

When I try to run the command ScriptAlias, I always get the error:
ScriptAlias: command not found
I have made sure that the alias mod is enabled through a2enmod alias, and I have ran apt-get update a few times as well. Does anyone know what could be causing this?
I realized that I did not understand how the module worked, and was trying to use the command directly into the command line. I needed to edit the 000-default.conf file instead.

apache2 build fails in yocto - "/usr/local/include" is unsafe for cross-compilation [-Wpoison-system-directories]

I was trying to build apache2 on yocto.
But I was getting below errors.
ERROR: This autoconf log indicates errors, it looked at host include and/or library paths while determining system capabilities.
Rerun configure task after fixing this.
Some googling led me to
https://lists.yoctoproject.org/pipermail/yocto/2012-March/005125.html
So I looked into conf.log and find out those lines:
cc1: warning: include location "/usr/local/include" is unsafe for
cross-compilation [-Wpoison-system-directories]
arm-poky-linux-gnueabi/4.9.2/ld: warning: library search path "/usr/local/lib"
is unsafe for cross-compilation
I googled again but, I couldn't understand 3 things yet:
Why has the PATH been set to local path ?
Why does this error only come when building apache2 [ I can build ngnix, cryptsetup, etc..]
How can I fix it?
Usually these types of errors come from configure scripts that have paths (like /usr/local/include, /usr/include and all sorts of other variations) hardcoded into them. So the way to fix it is to patch configure.ac (if there is one in the package, of course, configure otherwise) removing this paths.
For example, take a look at patch for pure-ftpd from current meta-oe, it solves similar problem:
--- a/configure.ac
+++ b/configure.ac
## -100,18 +100,6 ## AC_ARG_VAR(PYTHON,local path to the python interpreter)
python_possible_path="/usr/bin:/usr/local/bin:/bin:/opt/python/bin:/opt/python/usr/bin:/opt/python/usr/local/bin"
AC_PATH_PROG(PYTHON,python,/usr/bin/env python,$python_possible_path)
-if test -d /usr/local/include; then
- CPPFLAGS="$CPPFLAGS -I/usr/local/include"
-fi
-
-if test -d /usr/kerberos/include; then
- CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
-fi
-
-if test -d /usr/local/lib; then
- LDFLAGS="$LDFLAGS -L/usr/local/lib"
-fi
-
CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2"
dnl Checks for header files

OpenShift apache modules

How do you find out on OpenShift which apache modules are loaded?
I tried following the instructions here, and can see the compiled in modules by running /usr/sbin/httpd -l. However if I try to run /usr/sbin/httpd -M, or an equivalent command, I get an error: "Could not open configuration file /etc/httpd/conf/httpd.conf: Permission denied". I also get a permission denied error if I try to open the config file in read only with a text editor, via nano -v /etc/httpd/conf/httpd.conf.
I'm using the Python 3.3 cartridge. I can't find any way of finding the apache modules directly from python (the list of loaded modules doesn't seem to be passed via the environ argument to the WSGI app object).
Also, trying via php doesn't help. php -r "phpinfo();" doesn't give the info - I've grepped in the output for 'apache' and 'mod_', and looked with the naked eye, and there's no sign of any apache module data. Trying apache_get_modules also didn't work, the function is undefined.
I was particularly wondering if the mod_setenvif module was available (the SetEnvIf command doesn't seem to be working for me..)
You can view the currently loaded apache modules by looking at the following file on your gear: /php/usr/shared/etc/conf/httpd.conf

Apache httpd server on windows won't start

I installed Apache on Windows7 through a bitnami install package for trac. As a final installation step the installer tried to start the Apache httpd service and threw up an error that starting the https service failed.
I found out why when I tried to start httpd from command prompt and got this error:
AH00526: Syntax error on line 564 of F:/Bitnami/trac-1.0.9-0/apache2/conf/httpd.conf:
SetEnv takes 1-2 arguments, an environment variable name and optional value to pass to CGI.
Here is the offending line:
SetEnv PATH "${PATH};F:/Bitnami/trac-1.0.9-0/apache2/bin;"
I changed it to this:
SetEnv PATH "F:/Bitnami/trac-1.0.9-0/apache2/bin;"
and the service started.
My questions are:
1) What is the syntax/language used in the httpd.conf file?
2) How would one have to change that line to make it compile and preserve the original intent of appending F:/Bitnami/trac-1.0.9-0/apache2/bin to the environment variable PATH?
3) Assuming this works on some platforms why would it not work on Windows?
Thanks.
Update
Like the responses say the issue was with PATH. However the fact that there are spaces in the paths doesn't appear to be the issue. Not only that I isolated the path in PATH that was causing the problem. It was this "C:\tools\mkstools", exactly like that. I got rid of the quotes and that enabled httpd to start. So I'm still scratching my head. Why would the quotes cause the problem?
For me, it worked by replacing ${PATH} with %PATH%.

How can I make PHP display the error instead of giving me 500 Internal Server Error [duplicate]

This question already has answers here:
How can I get useful error messages in PHP?
(41 answers)
Closed 5 years ago.
This has never happened before. Usually it displays the error, but now it just gives me a 500 internal server error. Of course before, when it displayed the error, it was different servers. Now I'm on a new server (I have full root, so if I need to configure it somewhere in the php.ini, I can.) Or perhaps its something with Apache?
I've been putting up with it by just transferring the file to my other server and running it there to find the error, but that's become too tedious. Is there a way to fix this?
Check the error_reporting, display_errors and display_startup_errors settings in your php.ini file. They should be set to E_ALL and "On" respectively (though you should not use display_errors on a production server, so disable this and use log_errors instead if/when you deploy it). You can also change these settings (except display_startup_errors) at the very beginning of your script to set them at runtime (though you may not catch all errors this way):
error_reporting(E_ALL);
ini_set('display_errors', 'On');
After that, restart server.
Use php -l <filename> (that's an 'L') from the command line to output the syntax error that could be causing PHP to throw the status 500 error. It'll output something like:
PHP Parse error: syntax error, unexpected '}' in <filename> on line 18
It's worth noting that if your error is due to .htaccess, for example a missing rewrite_module, you'll still see the 500 internal server error.
Be careful to check if
display_errors
or
error_reporting
is active (not a comment) somewhere else in the ini file.
My development server refused to display errors after upgrade to
Kubuntu 16.04 - I had checked php.ini numerous times ... turned out that there was a diplay_errors = off; about 100 lines below my
display_errors = on;
So remember the last one counts!
Try not to go
MAMP > conf > [your PHP version] > php.ini
but
MAMP > bin > php > [your PHP version] > conf > php.ini
and change it there, it worked for me...
Enabling error displaying from PHP code doesn't work out for me. In my case, using NGINX and PHP-FMP, I track the log file using grep. For instance, I know the file name mycode.php causes the error 500, but don't know which line. From the console, I use this:
/var/log/php-fpm# cat www-error.log | grep mycode.php
And I have the output:
[04-Apr-2016 06:58:27] PHP Parse error: syntax error, unexpected ';' in /var/www/html/system/mycode.php on line 1458
This helps me find the line where I have the typo.
If all else fails try moving (i.e. in bash) all files and directories "away" and adding them back one by one.
I just found out that way that my .htaccess file was referencing a non-existant .htpasswd file. (#silly)