I'm currently experimenting with Puppet and have run into an error where it's starting apache2 without the environment variables. I've been following example 1 and it's a very simple manifest but it throws the below errors;
[Mon May 18 23:18:35.725947 2015] [core:warn] [pid 5312] AH00111: Config variable ${APACHE_LOCK_DIR} is not defined
[Mon May 18 23:18:35.726451 2015] [core:warn] [pid 5312] AH00111: Config variable ${APACHE_PID_FILE} is not defined
[Mon May 18 23:18:35.726538 2015] [core:warn] [pid 5312] AH00111: Config variable ${APACHE_RUN_USER} is not defined
[Mon May 18 23:18:35.726611 2015] [core:warn] [pid 5312] AH00111: Config variable ${APACHE_RUN_GROUP} is not defined
[Mon May 18 23:18:35.726696 2015] [core:warn] [pid 5312] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Mon May 18 23:18:35.750730 2015] [core:warn] [pid 5312] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Mon May 18 23:18:35.751241 2015] [core:warn] [pid 5312] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
[Mon May 18 23:18:35.751331 2015] [core:warn] [pid 5312] AH00111: Config variable ${APACHE_LOG_DIR} is not defined
AH00526: Syntax error on line 74 of /etc/apache2/apache2.conf:
Invalid Mutex directory in argument file:${APACHE_LOCK_DIR}
I know the issue is around it not loading in the envvar file and this can be done if I don't run it from Puppet but i'm looking for a solution so I can use puppet to create servers. Any ideas?
My Puppet manifest is below:
# execute 'apt-get update'
exec { 'apt-update': # exec resource named 'apt-update'
command => '/usr/bin/apt-get update' # command this resource will run
}
# install apache2 package
package { 'apache2':
require => Exec['apt-update'], # require 'apt-update' before installing
ensure => installed,
}
# ensure apache2 service is running
service { 'apache2':
ensure => running,
}
# install mysql-server package
package { 'mysql-server':
require => Exec['apt-update'], # require 'apt-update' before installing
ensure => installed,
}
# ensure mysql service is running
service { 'mysql':
ensure => running,
}
# install php5 package
package { 'php5':
require => Exec['apt-update'], # require 'apt-update' before installing
ensure => installed,
}
# ensure info.php file exists
file { '/var/www/html/info.php':
ensure => file,
content => '<?php phpinfo(); ?>', # phpinfo code
require => Package['apache2'], # require 'apache2' package before creating
}
Related
In my product, when we upgrade the following error is seen.
Syntax error on line 42 of /etc/httpd/conf.d/25-graphite.conf:
"Invalid command 'WSGIDaemonProcess', perhaps misspelled or defined by a module not included in the server configuration"
Line no 42 of the file /etc/httpd/conf.d/25-graphite.conf is this:
WSGIDaemonProcess wsgi display-name=%{GROUP} processes=5 threads=5
When I went through some of the articles available on stackover flow and returned by google search, most of the articles tend to suggest that
wsgi module is not getting loaded.
Here is the troubleshooting I have done.
The httpd.conf file has following 2 statements
Include "/etc/httpd/conf.d/.load"
Include "/etc/httpd/conf.d/.conf"
List item
The /etc/http/conf.d/ has following 2 files
cat wsgi.*
wsgi.conf
WSGISocketPrefix /var/run/wsgi
wsgi.load
LoadModule wsgi_module modules/mod_wsgi.so
So I am assuming that the code to load the wsgi module is present.
The /etc/httpd/conf.d directory has one more file(25-graphite.conf) which is where the error is reported. Its line no 42 is where the issue is as described above.
Line no 42 of the file /etc/httpd/conf.d/25-graphite.conf is this:
WSGIDaemonProcess wsgi display-name=%{GROUP} processes=5 threads=5
When I read the httpd documentation to understand the below statement from httpd.conf
Include "/etc/httpd/conf.d/.conf*
it is mentioned that the files will be included in alphabetical order. This would mean 25-graphite.conf will be included ahead of wsgi.conf. Can this result in this issue ?
Troubleshooting performed:
1. /etc/init.d/httpd configtest command says the syntax is OK. However there are few warnings.
*[Wed Oct 18 14:54:06 2017] [warn] module proxy_module is already loaded, skipping
[Wed Oct 18 14:54:06 2017] [warn] module proxy_http_module is already loaded, skipping
[Wed Oct 18 14:54:06 2017] [warn] module proxy_ajp_module is already loaded, skipping
[Wed Oct 18 14:54:06 2017] [warn] module headers_module is already loaded, skipping
[Wed Oct 18 14:54:06 2017] [warn] module proxy_module is already loaded, skipping
[Wed Oct 18 14:54:06 2017] [warn] module proxy_balancer_module is already loaded, skipping
[Wed Oct 18 14:54:06 2017] [warn] module proxy_ftp_module is already loaded, skipping
[Wed Oct 18 14:54:06 2017] [warn] module proxy_http_module is already loaded, skipping
[Wed Oct 18 14:54:06 2017] [warn] module proxy_ajp_module is already loaded, skipping
[Wed Oct 18 14:54:06 2017] [warn] module proxy_connect_module is already loaded, skipping
[Wed Oct 18 14:54:06 2017] [warn] NameVirtualHost :443 has no VirtualHosts
/usr/sbin/httpd -M command output has following line which means the module is loaded properly.
wsgi_module (shared)
I need guidance on following.
What should be my approach to troubleshoot this issue further ?
Is there a way to reproduce this issue just by restarting the httpd server instead of carrying out the complete upgrade ?(I am already trying it from my end. This will help me to save time. )
Prathmesh
I try to start up my HTTP service by the following procedure:
Startup easyPHP DevServer 16.1
Open Dashboard
Opens on the local machine 127.0.0.1:1111
Try to start the HTTP server using Apache 2.4.18
opens Apache page with VC11 compiler and server with
php version 5.6.17 listening on port 80.
Clicking on the Start button results in a short execution
and then no result. Both the error and access logs are empty.
Any suggestions are appreciated.
In order to properly execute PHP7 you must allready install the Redistribuable Visual C++ V14 (as shown in the PHP7 information detail on easyphp dashboard)
You can find it out here https://www.microsoft.com/download/details.aspx?id=48145
Currently PHP7 is only available in easyPHP in 32bits version, so install the compatible version of VC14.
But soon I hope we can use the x64 PHP7 version, and then you must install the x64 VC14 version
Windows 7 SP1 box, EasyPhp-DevServer-16.1.
Since I have a website to migrate, I decided to update EasyPHP on my computer to start with fresh-up-to-date versions of PHP, Apache, MySQL. Maybe I shouldn't have... the TaskBar icon and admin interface have changed, nothing works like before.
But I am stubborn, and I want it to work. So I try to run something, and it is not. Here are the symptoms, very close to Richard's:
Trying to start Apache 2.4.18, choosing PHP 7.0.2. Click on green "Start" button, it turns into a red "Stop" button. Everything is OK? Nope. Clicking on the "Error log" button, the page comes back to previous state with green "Start" button and nothing in the error log textarea.
OK, so I choose PHP 5.6.17 and click on "Start". I have popups claiming for instance "bz2: Unable to initialize module. Module compiled with module API=20131226. PHP compiled with module API=20121212. These options need to match."
The button turns to red "Stop", and clicking on "Error log" button produces this output:
PHP Warning: PHP Startup: bz2: Unable to initialize module\nModule compiled with module API=20131226\nPHP compiled with module API=20121212\nThese options need to match\n in Unknown on line 0
PHP Warning: PHP Startup: gd: Unable to initialize module\nModule compiled with module API=20131226\nPHP compiled with module API=20121212\nThese options need to match\n in Unknown on line 0
PHP Warning: PHP Startup: mbstring: Unable to initialize module\nModule compiled with module API=20131226\nPHP compiled with module API=20121212\nThese options need to match\n in Unknown on line 0
PHP Warning: PHP Startup: mysql: Unable to initialize module\nModule compiled with module API=20131226\nPHP compiled with module API=20121212\nThese options need to match\n in Unknown on line 0
PHP Warning: PHP Startup: mysqli: Unable to initialize module\nModule compiled with module API=20131226\nPHP compiled with module API=20121212\nThese options need to match\n in Unknown on line 0
PHP Warning: PHP Startup: pdo_mysql: Unable to initialize module\nModule compiled with module API=20131226\nPHP compiled with module API=20121212\nThese options need to match\n in Unknown on line 0
PHP Warning: PHP Startup: pdo_sqlite: Unable to initialize module\nModule compiled with module API=20131226\nPHP compiled with module API=20121212\nThese options need to match\n in Unknown on line 0
PHP Warning: PHP Startup: sockets: Unable to initialize module\nModule compiled with module API=20131226\nPHP compiled with module API=20121212\nThese options need to match\n in Unknown on line 0
PHP Warning: PHP Startup: sqlite3: Unable to initialize module\nModule compiled with module API=20131226\nPHP compiled with module API=20121212\nThese options need to match\n in Unknown on line 0
PHP Warning: PHP Startup: xsl: Unable to initialize module\nModule compiled with module API=20131226\nPHP compiled with module API=20121212\nThese options need to match\n in Unknown on line 0
[Mon Feb 22 16:51:45.788809 2016] [mpm_winnt:notice] [pid 3292:tid 236] AH00455: Apache/2.4.18 (Win32) PHP/5.6.17 configured -- resuming normal operations
[Mon Feb 22 16:51:45.789809 2016] [mpm_winnt:notice] [pid 3292:tid 236] AH00456: Apache Lounge VC11 Server built: Dec 11 2015 11:26:53
[Mon Feb 22 16:51:45.789809 2016] [core:notice] [pid 3292:tid 236] AH00094: Command line: '..\\eds-binaries\\httpserver\\apache2418x160222160722\\bin\\eds-httpserver.exe -d C:/BIN/EasyPHP-Devserver-16.1/eds-binaries/httpserver/apache2418x160222160722'
[Mon Feb 22 16:51:45.797809 2016] [mpm_winnt:notice] [pid 3292:tid 236] AH00418: Parent: Created child process 2568
Xdebug requires Zend Engine API version 220131226.
The Zend Engine API version 220121212 which is installed, is outdated.
Since Apache seems to be running, I then launch MySQL. Then I try to run PHPMyAdmin. Here is the resulting message:
phpMyAdmin - Error
The mbstring extension is missing. Please check your PHP configuration.
Of course, since this extension didn't manage to be initialized!
So, here are my complementary questions to Richard's:
What can cause Apache to neither launch nor write any log when choosing PHP 7.0.2?
What can cause Apache to not initialize modules when launching with PHP 5.6.17?
Thanks for any clue,
Seagram
Hello again,
I found out an answer to myself for question 2. that may interest others:
When I installed EasyPHP-DevServer-16.1, I didn't uninstall EasyPHP-DevServer-14.1VC11. In order to have another development working months ago, I have modified my PATH environment variable to point to the php executable in this version.
Now I have removed this path reference in the PATH variable. I also exited from EasyPHP TaskBar icon. THIS IS IMPORTANT in order for this tool to forget the old PATH value. Then I restarted it, clicked on DashBoard again and launched Apache.
Now Apache starts smoothly with PHP 5.6.17 and the error log file contains only:
[Mon Feb 22 17:16:20.295146 2016] [core:warn] [pid 6652:tid 236] AH00098: pid file C:/BIN/EasyPHP-Devserver-16.1/eds-binaries/httpserver/apache2418x160222160722/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Mon Feb 22 17:16:20.313147 2016] [mpm_winnt:notice] [pid 6652:tid 236] AH00455: Apache/2.4.18 (Win32) PHP/5.6.17 configured -- resuming normal operations
[Mon Feb 22 17:16:20.313147 2016] [mpm_winnt:notice] [pid 6652:tid 236] AH00456: Apache Lounge VC11 Server built: Dec 11 2015 11:26:53
[Mon Feb 22 17:16:20.313147 2016] [core:notice] [pid 6652:tid 236] AH00094: Command line: '..\\eds-binaries\\httpserver\\apache2418x160222160722\\bin\\eds-httpserver.exe -d C:/BIN/EasyPHP-Devserver-16.1/eds-binaries/httpserver/apache2418x160222160722'
[Mon Feb 22 17:16:20.321147 2016] [mpm_winnt:notice] [pid 6652:tid 236] AH00418: Parent: Created child process 4052
[Mon Feb 22 17:16:20.895180 2016] [mpm_winnt:notice] [pid 4052:tid 316] AH00354: Child: Starting 64 worker threads.
However, with PHP 7.0.2., Apache keeps on not starting and doesn't trace anything in error log.
Something else is missing...
I've got an AWS EC2 instance running a flask app through apache.
I've installed boto via pip
I've got a wsgi file set up and if my flask app is a simple hello world it works fine:
#This works
from flask import Flask
app = Flask(__name__)
#app.route("/hello")
def hello():
return "Hello World"
if __name__ == "__main__":
app.run(host='0.0.0.0',port=80)
#http://<PUBLIC_IP>.ap-southeast-2.compute.amazonaws.com/hello
#Hello World
But if I try to import boto:
from boto import dynamodb2
from boto.dynamodb2.table import Table
When I visit http://.ap-southeast-2.compute.amazonaws.com/hello
I get an internal server error. Checking the logs reveals this
[Thu Aug 06 03:20:50 2015] [error] [client 203.220.19.142] mod_wsgi (pid=2988): Target WSGI script '/var/www/myservice/myservice.wsgi' cannot be loaded as Python module.
[Thu Aug 06 03:20:50 2015] [error] [client 203.220.19.142] mod_wsgi (pid=2988): Exception occurred processing WSGI script '/var/www/myservice/myservice.wsgi'.
[Thu Aug 06 03:20:50 2015] [error] [client 203.220.19.142] Traceback (most recent call last):
[Thu Aug 06 03:20:50 2015] [error] [client 203.220.19.142] File "/var/www/myservice/myservice.wsgi", line 4, in <module>
[Thu Aug 06 03:20:50 2015] [error] [client 203.220.19.142] from myservice import app as application
[Thu Aug 06 03:20:50 2015] [error] [client 203.220.19.142] File "/var/www/myservice/myservice.py", line 6, in <module>
[Thu Aug 06 03:20:50 2015] [error] [client 203.220.19.142] from boto import dynamodb2
[Thu Aug 06 03:20:50 2015] [error] [client 203.220.19.142] ImportError: No module named boto
Even though I've already installed boto (pip install boto)
How can I fix this?
I searched yum for related stuff and by running:
yum install python26-boto.noarch
I fixed the issue
I have Python 2.7 installed with ampps. I tried to modify python.conf to make it point to another installation of Python 3.3 but it leads to errors in Apache start up.
LoadModule wsgi_module modules/mod_wsgi.so
WSGIPythonPath "C:/Python33/Lib;C:/Python33/Lib/site-packages;C:/Python33/DLLs"
WSGIPythonHome "C:/Python33"
It generates the following error:
[Fri Aug 15 01:48:38.114336 2014] [mpm_winnt:notice] [pid 6084:tid 412] AH00418: Parent: Created child process 5592
File "C:/Python33\lib\site.py", line 173
file=sys.stderr)
^
SyntaxError: invalid syntax
[Fri Aug 15 01:48:39.146395 2014] [mpm_winnt:crit] [pid 6084:tid 412] AH00419: master_main: create child process failed. Exiting.
I was able to compile mod_wsgi for Python 2.5.4. It is now loaded into apache modules. I confirmed it by command
httpd.exe -M
.
.
wsgi_module(shared)
php5_module(shared)
But I am unable to run a test file(hello.wsgi), it is located in folder c:/apache/htdocs/wsgi : so the path of file becomes c:/apache/htdocs/wsgi/hello.wsgi
My hello.wsgi file contains:
def application(environ, start_response):
status = '200 OK'
output = 'Hello World!'
response_headers = [('Content-type', 'text/plain'),
('Content-Length', str(len(output)))]
start_response(status, response_headers)
return [output]
I added the following lines to httpd.conf:
LoadModule wsgi_module modules/mod_wsgi.so
<IfModule wsgi_module>
WSGIScriptAlias /wsgi/ "c:/apache/htdocs/wsgi/hello.wsgi"
<Directory "c:/apache/htdocs/wsgi">
Order deny,allow
allow from All
</Directory>
</IfModule>
And my Apache Error Log is :
[Sat Nov 19 15:29:32 2011] [warn] pid file C:/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Sat Nov 19 15:29:32 2011] [warn] mod_wsgi: Compiled for Python/2.5.
[Sat Nov 19 15:29:32 2011] [warn] mod_wsgi: Runtime using Python/2.5.4.
[Sat Nov 19 15:29:33 2011] [notice] Apache/2.2.21 (Win32) mod_wsgi/3.3 Python/2.5.4 PHP/5.3.8 configured -- resuming normal operations
[Sat Nov 19 15:29:33 2011] [notice] Server built: Sep 9 2011 10:26:10
[Sat Nov 19 15:29:33 2011] [notice] Parent: Created child process 2296
[Sat Nov 19 15:29:33 2011] [warn] mod_wsgi: Compiled for Python/2.5.
[Sat Nov 19 15:29:33 2011] [warn] mod_wsgi: Runtime using Python/2.5.4.
[Sat Nov 19 15:29:33 2011] [notice] Child 2296: Child process is running
[Sat Nov 19 15:29:33 2011] [notice] Child 2296: Acquired the start mutex.
[Sat Nov 19 15:29:33 2011] [notice] Child 2296: Starting 64 worker threads.
[Sat Nov 19 15:29:33 2011] [notice] Child 2296: Starting thread to listen on port 80.
[Sat Nov 19 15:30:21 2011] [error] [client 127.0.0.1] File does not exist: C:/apache/htdocs/wsgi
Update
I removed the trailing slash from alias, i have moved my wsgi folder from htdocs to apache & created a vhost file:
<VirtualHost 127.0.0.1:80>
<Directory "C:/apache/wsgi">
Options FollowSymLinks Indexes
AllowOverride All
Order deny,allow
allow from All
</Directory>
ServerName 127.0.0.1
ServerAlias 127.0.0.1
WSGIScriptAlias /wsgi "C:/apache/wsgi/hello.wsgi"
DocumentRoot "C:/apache/wsgi"
ErrorLog "C:/apache/logs/127.0.0.1.err"
CustomLog "C:/apache/logs/127.0.0.1.log" combined
</VirtualHost>
But now my Apache is giving some windows error like:
Faulting application name: httpd.exe, version: 2.2.21.0, time stamp: 0x4e6a3015
Faulting module name: ntdll.dll, version: 6.1.7601.17514, time stamp: 0x4ce7ba58
Exception code: 0xc0000005
Fault offset: 0x00038da9
Faulting process id: 0xc4c
Faulting application start time: 0x01cca6c0f9ccd446
Faulting application path: C:\apache\bin\httpd.exe
Faulting module path: C:\Windows\SysWOW64\ntdll.dll
Report Id: 3ba0b9e0-12b4-11e1-b285-005056c00008
Need Some Help.
Thanks.
This sounds like the error that I had when the Visual C++ 2008 Redistributable (msvcr90.dll) was not installed on the system. But first, please check (with Dependency Walker) that httpd.exe and mod_wsgi.so are using exactly the same msvcr90.dll:
same name
same directory
same version
same timestamp
If they are using different DLL names (e.g. msvcr90.dll and msvcr100.dll) then you must recompile both with the same compiler (e.g. Visual Studio 2008).
If they are using the same DLL name, but different versions or in different directories, then you might be having the same problem that I had, with BitNami DjangoStack.
Because msvcr90.dll was not installed system-wide in C:\Windows\WinSxS, httpd was only able to run at all because there was an "xcopy deployment" of the side-by-side assembly in the same directory as httpd.exe:
Microsoft.VC90.CRT.manifest
msvcr90.dll
If these files had not been present, it would have failed due to a missing dependency on msvcr90.dll, or else with this error:
This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.
(i.e. the DLL was found but without a manifest to make it valid).
Although httpd.exe runs this way, it is not able to reliably load a DLL that also uses msvcr90.dll:
If the DLL has an "xcopy deployment" in its OWN directory, then it will load another copy of the DLL into the process (because it's a different copy of the DLL?). This results in a second heap in the process memory space, which can crash the process if memory is passed between the DLL and httpd (allocated by one and freed by the other). I think this is what you're seeing.
If the DLL does not have an "xcopy deployment" in its own directory, then it will fail to load with a SideBySide or Windows Error Reporting error in the System event log.
You can see more about this kind of problem on Python bug 4120, although this is not a clear, complete and definitive explanation of the problem, and I have not been able to find one yet.
The only reliable way I found to run this stack was to install the Visual C++ 2008 redistributable system-wide, which places a copy of msvcr90.dll in a subdirectory of C:\Windows\WinSxS along with a manifest to make it work.
This should (I think) cause Windows to completely ignore the Microsoft.VC90.CRT.manifest and msvcr90.dll files in the application and DLL directories. Both should use the same DLL in C:\Windows\WinSxS, and it should only be loaded into the process once.