LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-04-2016, 09:48 AM   #1
adumith
Member
 
Registered: Feb 2013
Posts: 46

Rep: Reputation: Disabled
Apache configtest failed.


Hello everyone;

I got this error from my webserver:

ago 04 10:34:27 MyServer apache2[28755]: * Starting Apache httpd web server apache2
ago 04 10:34:27 MyServer apache2[28755]: *
ago 04 10:34:27 MyServer apache2[28755]: * The apache2 configtest failed.
ago 04 10:34:27 MyServer apache2[28755]: Output of config test was:
ago 04 10:34:27 MyServer apache2[28755]: apache2: Syntax error on line 140 of /etc/apache2/apache2.conf: Syntax error on line 1 of /e
ago 04 10:34:27 MyServer apache2[28755]: Action 'configtest' failed.
ago 04 10:34:27 MyServer apache2[28755]: The Apache error log may have more information.
ago 04 10:34:27 MyServer systemd[1]: apache2.service: Control process exited, code=exited status=1
ago 04 10:34:27 MyServer systemd[1]: Failed to start LSB: Apache2 web server.
-- Subject: Unit apache2.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman.../systemd-devel
--
-- Unit apache2.service has failed.

Googleing I found some threads where saying that the issue is about the php module is missing, so I run this command:
apt-get install libapache2-mod-php5

But the problem doesnīt fixed.

Does any body any suggest, how to fix this issue?

Thanks in advance.
 
Old 08-04-2016, 10:35 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 2,872

Rep: Reputation: 1153Reputation: 1153Reputation: 1153Reputation: 1153Reputation: 1153Reputation: 1153Reputation: 1153Reputation: 1153Reputation: 1153
Quote:
Originally Posted by adumith View Post
ago 04 10:34:27 MyServer apache2[28755]: apache2: Syntax error on line 140 of /etc/apache2/apache2.conf: Syntax error on line 1 of /e
Did you investigate line 140 of the relevant config file? If so, what did you find?
 
Old 08-04-2016, 10:38 AM   #3
adumith
Member
 
Registered: Feb 2013
Posts: 46

Original Poster
Rep: Reputation: Disabled
The issue is about the php module.

I floowed this step.
1.- mv /etc/apache2 /etc/apache2.back
2.- apt-get install apache2

So, I allready have apache but now I must to compare the modules activate at the previus installations.

Do you have any another idea?
 
Old 08-04-2016, 01:56 PM   #4
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Yawnstown, Ohio
Distribution: Mojave
Posts: 9,372
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by adumith View Post
Do you have any another idea?
Code:
apache2ctl -D DUMP_MODULES
on the first machine.
Compare to intended target.
 
Old 08-05-2016, 07:56 AM   #5
Elizine
Member
 
Registered: Aug 2015
Posts: 54
Blog Entries: 1

Rep: Reputation: Disabled
Try open /etc/apache2/apache2.conf using gedit :

Code:
sudo gedit /etc/apache2/apache2.conf
And then replace this line

Code:
LockFile ${APACHE_LOCK_DIR}/accept.lock
With this one

Code:
Mutex file:${APACHE_LOCK_DIR} default
 
Old 08-05-2016, 09:55 AM   #6
adumith
Member
 
Registered: Feb 2013
Posts: 46

Original Poster
Rep: Reputation: Disabled
Hello everybody;

I have installed the apache2 and the php too, but when I try to run php script the webserver try to download the file instead of running; so I check the modules enable and I got this:
apache2ctl -t -D DUMP_MODULES
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
Loaded Modules:
core_module (static)
so_module (static)
watchdog_module (static)
http_module (static)
log_config_module (static)
logio_module (static)
version_module (static)
unixd_module (static)
access_compat_module (shared)
alias_module (shared)
auth_basic_module (shared)
authn_core_module (shared)
authn_file_module (shared)
authz_core_module (shared)
authz_host_module (shared)
authz_user_module (shared)
autoindex_module (shared)
deflate_module (shared)
dir_module (shared)
env_module (shared)
filter_module (shared)
mime_module (shared)
mpm_event_module (shared)
negotiation_module (shared)
rewrite_module (shared)
setenvif_module (shared)
status_module (shared)

I canīt see the php5_module (shared) and I have installed; so I added this line at apache2.conf
LoadModule php5_module /usr/lib/apache2/modules/libphp5.6.so and when I run service apache2 reload I got this:

ago 05 11:10:57 MyServer apache2[13282]: * Reloading Apache httpd web server apache2
ago 05 11:10:57 MyServer apache2[13282]: *
ago 05 11:10:57 MyServer apache2[13282]: * The apache2 configtest failed. Not doing anything.
ago 05 11:10:57 MyServer apache2[13282]: Output of config test was:
ago 05 11:10:57 MyServer apache2[13282]: [Fri Aug 05 11:10:57.335488 2016] [:crit] [pid 13293:tid 139781203834752] Apache is running
ago 05 11:10:57 MyServer apache2[13282]: AH00013: Pre-configuration failed
ago 05 11:10:57 MyServer apache2[13282]: Action 'configtest' failed.
ago 05 11:10:57 MyServer apache2[13282]: The Apache error log may have more information.
ago 05 11:10:57 MyServer systemd[1]: apache2.service: Control process exited, code=exited status=1
ago 05 11:10:57 MyServer systemd[1]: Reload failed for LSB: Apache2 web server.
-- Subject: Unit apache2.service has finished reloading its configuration


Does any body why and how to fix it?

Thanks in advance.

Last edited by adumith; 08-05-2016 at 10:46 AM.
 
Old 08-05-2016, 10:44 AM   #7
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Yawnstown, Ohio
Distribution: Mojave
Posts: 9,372
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by adumith View Post
apache2ctl -t -D DUMP_MODULES
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
One of the few edits ever needed in /etc/apache2/apache2.conf:

Open a terminal and issue:
Code:
sudo echo "ServerName localhost" >> /etc/apache2/apache2.conf
There won't be any indication of success or failure, however comma comma comma,,,
issuing
Code:
sudo apache2ctl -t -D DUMP_MODULES
should now be Warning free.
 
Old 08-05-2016, 03:30 PM   #8
adumith
Member
 
Registered: Feb 2013
Posts: 46

Original Poster
Rep: Reputation: Disabled
I press on achievement but still not solve the issue.

I have installed php5.6 and put enable the php module.

But, when I trying: apache2ctl -t -D DUMP_MODULES

I get this message:
[Fri Aug 05 15:39:51.896824 2016] [:crit] [pid 16037:tid 140652743583616] Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You need to recompile PHP.
AH00013: Pre-configuration failed

I think is important that I share with you that Iīm using Ubuntu 16.04 & Apache/2.4.18 (Ubuntu) & PHP 5.6.24-1+deb.sury.org~xenial+1 (cli)

How does you think I can fix the issue?
 
Old 08-05-2016, 04:48 PM   #9
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Yawnstown, Ohio
Distribution: Mojave
Posts: 9,372
Blog Entries: 37

Rep: Reputation: Disabled
https://wiki.archlinux.org/index.php...ver#Extensions talks about it.
 
Old 08-08-2016, 09:07 AM   #10
adumith
Member
 
Registered: Feb 2013
Posts: 46

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Habitual View Post
Thanks a lot for your reply; but this work for Apache2? I ask you that because at the wiki using http.conf instead of apache2.conf

Thanks again....
 
Old 08-08-2016, 10:19 AM   #11
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Yawnstown, Ohio
Distribution: Mojave
Posts: 9,372
Blog Entries: 37

Rep: Reputation: Disabled
Yes, apache2.{x}
Quote:
Originally Posted by adumith View Post
Syntax error on line 140 of /etc/apache2/apache2.conf: Syntax error on line 1 of /e
implies Debian, Ubuntu (Apache httpd 2.x): Is that correct. Debian or Ubuntu?
You mentioned apt-get but not much else. Thanks.

I would try this:
Code:
sudo apt-get install apache2-mpm-prefork
and restart the apache2 service.

If there remains errors please post
Code:
head -5 /etc/apache2/apache2.conf
output and any remaining errors on service restart.

Advice:
Please stop issuing arbitrary commands into your terminal and
always quote what you read and where you read it, so we can
evaluate its worthiness and applicability to the situation.

Thank you.
 
Old 08-08-2016, 02:27 PM   #12
adumith
Member
 
Registered: Feb 2013
Posts: 46

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Habitual View Post
Yes, apache2.{x}

implies Debian, Ubuntu (Apache httpd 2.x): Is that correct. Debian or Ubuntu?
You mentioned apt-get but not much else. Thanks.

I would try this:
Code:
sudo apt-get install apache2-mpm-prefork
and restart the apache2 service.

If there remains errors please post
Code:
head -5 /etc/apache2/apache2.conf
output and any remaining errors on service restart.

Advice:
Please stop issuing arbitrary commands into your terminal and
always quote what you read and where you read it, so we can
evaluate its worthiness and applicability to the situation.

Thank you.
Before starting,

I want to apologize for my omissions . Thanks for the advice , you 're absolutely right .

I followed the steps of the document and when you restart the apache2 is giving me error exactly this line:
Include conf/extra/php5_module.conf

I guess I'm doing something wrong.

This is the content of my file apache2.conf

# container, that host's errors will be logged there and not here.
#
ErrorLog ${APACHE_LOG_DIR}/error.log

#
# LogLevel: Control the severity of messages logged to the error_log.
# Available values: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the log level for particular modules, e.g.
# "LogLevel info ssl:warn"
#
LogLevel warn

# Include module configuration:
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
Include conf/extra/php5_module.conf

# Include list of ports to listen on
Include ports.conf


# Sets the default security model of the Apache2 HTTPD server. It does
# not allow access to the root filesystem outside of /usr/share and /var/www.
# The former is used by web applications packaged in Debian,
# the latter may be used for local directories served by the web server. If
# your system is serving content from a sub-directory in /srv you must allow
# access here, or in any related virtual host.
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>

<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>

#<Directory /srv/>
# Options Indexes FollowSymLinks
# AllowOverride None
# Require all granted
#</Directory>




# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives. See also the AllowOverride
# directive.
#
AccessFileName .htaccess

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<FilesMatch "^\.ht">
Require all denied
</FilesMatch>


#
# The following directives define some format nicknames for use with
# a CustomLog directive.
#
# These deviate from the Common Log Format definitions in that they use %O
# (the actual bytes sent including headers) instead of %b (the size of the
# requested file), because the latter makes it impossible to detect partial
# requests.
#
# Note that the use of %{X-Forwarded-For}i instead of %h is not recommended.
# Use mod_remoteip instead.
#
LogFormat "%v:%p %h %l %u %t "%r" %>s %O "%{Referer}i" "%{User-Agent}i"" vhost_combined
LogFormat "%h %l %u %t "%r" %>s %O "%{Referer}i" "%{User-Agent}i"" combined
LogFormat "%h %l %u %t "%r" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

# Include of directories ignores editors' and dpkg's backup files,
# see README.Debian for details.

# Include generic snippets of statements
IncludeOptional conf-enabled/*.conf

# Include the virtual host configurations:
IncludeOptional sites-enabled/*.conf

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
LoadModule php5_module /usr/lib/apache2/modules/libphp5.6.so
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phpsServerName localhost

Thanks in advance.

PDS: Iīm using Ubuntu 16.04 / PHP 5.6 / Apache 2.4

Last edited by adumith; 08-08-2016 at 02:29 PM.
 
Old 08-08-2016, 03:10 PM   #13
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Yawnstown, Ohio
Distribution: Mojave
Posts: 9,372
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by adumith View Post
I followed the steps of the document.
IF you put this line in /etc/apache2/apache2.conf
Code:
Include conf/extra/php5_module.conf
Go back and make your edit a comment, like so:
Code:
#Include conf/extra/php5_module.conf
Restart apache2 service.

Please let us know.
 
Old 08-08-2016, 03:17 PM   #14
adumith
Member
 
Registered: Feb 2013
Posts: 46

Original Poster
Rep: Reputation: Disabled
Hello Again Habitual;

I did it; so I get this new error:
ago 08 16:12:32 QA apache2[32545]: * Starting Apache httpd web server apache2
ago 08 16:12:32 QA apache2[32545]: *
ago 08 16:12:32 QA apache2[32545]: * The apache2 configtest failed.
ago 08 16:12:32 QA apache2[32545]: Output of config test was:
ago 08 16:12:32 QA apache2[32545]: apache2: Syntax error on line 224 of /etc/apache2/apache2.conf: Cannot load modules/mod_mpm_
ago 08 16:12:32 QA apache2[32545]: Action 'configtest' failed.
ago 08 16:12:32 QA apache2[32545]: The Apache error log may have more information.
ago 08 16:12:32 QA systemd[1]: apache2.service: Control process exited, code=exited status=1
ago 08 16:12:32 QA systemd[1]: Failed to start LSB: Apache2 web server.

Itīs about the mpm_preforks doesnīt installed

I run apt-get install apache2-mpm-prefork and the OS return to my this message:

The " apache2 - mpm- prefork ' package does not have a candidate for installation

Thanks again...
 
Old 08-08-2016, 05:22 PM   #15
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Yawnstown, Ohio
Distribution: Mojave
Posts: 9,372
Blog Entries: 37

Rep: Reputation: Disabled
I'd almost start over. I'm fresh out of ideas today.
Don't worry, someone will be along.
 
  


Reply

Tags
apache2, php 5 update


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Group name not accepted - apache configtest publicLearner Linux - Software 2 03-15-2015 09:39 AM
setting up apache from scratch on a linux machine, apache failed message upon bootup dramous43 Linux - Enterprise 2 01-26-2010 07:53 AM
Apache Webserver on Slackware - Failed to Start Apache - 'no listening sockets .." CCTVGuru Linux - Server 4 10-11-2009 01:14 AM
Failed to start apache : Apache does not appear to be running : number11 Slackware 9 02-11-2005 09:51 AM
apachectl configtest ... blah punt Linux - Software 7 07-18-2001 11:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 07:29 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration