# apache24 won't start



## kclark (Dec 30, 2013)

I've installed www/apache24, lang/php55, and lang/php55-extensions from the tree, this is in a jail. Everything was working fine until after a reboot. I was doing a memcheck because I added some more RAM recently and wanted to verify that it was good. I can `ssh` into the jail fine and it appears that www/apache24 starts with the following.


```
# service apache24 onestart
Performing sanity check on apache24 configuration:
Syntax OK
Starting apache24
```

After this I can't navigate to it. I then checked the status:


```
# service apache24 status
apache24 is not running.
```

Then I checked the following logs (note the errors/warnings have since been fixed):

httpd-error.log

```
[Mon Dec 30 10:01:53.779332 2013] [mpm_prefork] [pid 49435] AH00163: Apache/2.4.6 (FreeBSD) configured -- resuming normal operations
[Mon Dec 30 10:01:53.780269 2013] [core] [pid 49435] AH00094: Command line: '/usr/local/sbin/httpd -D NOHTTPACCEPT'
[Mon Dec 30 10:12:47.339217 2013] [mpm_prefork] [pid 49435] AH00169: caught SIGTERM, shutting down
[Mon Dec 30 10:12:47.600749 2013] [so] [pid 4212] AH01574: module php5_module is already loaded, skipping
[Mon Dec 30 10:12:47.621554 2013] [mpm_prefork] [pid 4213] AH00163: Apache/2.4.6 (FreeBSD) PHP/5.5.7 configured -- resuming normal operations
[Mon Dec 30 10:12:47.621682 2013] [core] [pid 4213] AH00094: Command line: '/usr/local/sbin/httpd -D NOHTTPACCEPT'
[Mon Dec 30 10:14:07.954383 2013] [:error] [pid 4461] [client 192.168.1.113:59150] PHP Warning:  phpinfo(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you
 used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /usr/local/www/apache24/data/index.php on line 4
[Mon Dec 30 10:51:35.244677 2013] [:error] [pid 4463] [client 192.168.1.113:53801] PHP Warning:  phpinfo(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you
 used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /usr/local/www/apache24/data/index.php on line 4
[Mon Dec 30 10:51:37.897894 2013] [:error] [pid 4463] [client 192.168.1.113:53801] PHP Warning:  phpinfo(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you
 used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /usr/local/www/apache24/data/index.php on line 4
[Mon Dec 30 10:58:13.918567 2013] [:error] [pid 4215] [client 192.168.1.113:51653] PHP Warning:  phpinfo(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you
 used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /usr/local/www/apache24/data/index.php on line 4
[Mon Dec 30 11:23:00.357560 2013] [:error] [pid 4462] [client 192.168.1.113:26318] PHP Warning:  phpinfo(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you
 used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /usr/local/www/apache24/data/index.php on line 4
[Mon Dec 30 13:36:13.119188 2013] [mpm_prefork] [pid 4213] AH00169: caught SIGTERM, shutting down
[Mon Dec 30 14:55:27.890715 2013] [so] [pid 24415] AH01574: module php5_module is already loaded, skipping
[Mon Dec 30 14:55:58.970517 2013] [so] [pid 28168] AH01574: module php5_module is already loaded, skipping
[Mon Dec 30 14:56:50.539152 2013] [so] [pid 33920] AH01574: module php5_module is already loaded, skipping
```

httpd-access.log

```
192.168.1.113 - - [30/Dec/2013:10:02:01 -0600] "HEAD / HTTP/1.1" 200 -
192.168.1.113 - - [30/Dec/2013:10:02:07 -0600] "GET / HTTP/1.1" 200 45
192.168.1.113 - - [30/Dec/2013:10:02:07 -0600] "GET /favicon.ico HTTP/1.1" 404 209
192.168.1.113 - - [30/Dec/2013:10:13:10 -0600] "GET / HTTP/1.1" 304 -
192.168.1.113 - - [30/Dec/2013:10:14:07 -0600] "GET / HTTP/1.1" 200 60833
192.168.1.113 - - [30/Dec/2013:10:51:35 -0600] "GET / HTTP/1.1" 200 60234
192.168.1.113 - - [30/Dec/2013:10:51:37 -0600] "GET / HTTP/1.1" 200 60234
192.168.1.113 - - [30/Dec/2013:10:58:13 -0600] "GET / HTTP/1.1" 200 60234
192.168.1.113 - - [30/Dec/2013:11:23:00 -0600] "GET / HTTP/1.1" 200 60234
```

I've also made sure apache24 was in /etc/rc.conf:

/etc/rc.conf

```
portmap_enable="NO"
sshd_enable="YES"
sendmail_enable="NO"
hostname="apache"
devfs_enable="YES"
devfs_system_ruleset="devfsrules_common"
sshd_enable="YES"
mysql_enable="YES"
apache24_enable="YES"
```

As well as checked my Apache configuration:


```
# apachectl configtest
Performing sanity check on apache24 configuration:
Syntax OK
```

I've not done anything crazy, just trying to set[]up the basics. I feel like there is something small I'm missing. Any advi_c_e would be appreciated.


----------



## junovitch@ (Dec 31, 2013)

Can you clarify if httpd is actually in the process list?  The service() command should reflect that but if I understand your logs it looks like it's running as it is looking multiple connection attempts.  Does `nc -nvz 1.2.3.4 80` show a successful connection to that port?


----------



## kclark (Dec 31, 2013)

```
% nc -nvz 192.168.1.201 80
nc: connect to 192.168.1.201 port 80 (tcp) failed: Connection refused
```

I'm thinking it might be a firewall issue?


----------



## junovitch@ (Dec 31, 2013)

No, if the daemon is dead that is normal behavior.  It's just that your logs show a span of 2-4 hours and it would appear that the the daemon does not start at all.  Can you try starting the service and only posting the logs that show up immediately after?  How soon after starting does it terminate?  By any chance does `apachectl start` show or have a more verbose output of starting the process?


----------



## kclark (Dec 31, 2013)

Here's what I'm getting:


```
# apachectl start
Performing sanity check on apache24 configuration:
Syntax OK
Starting apache24.
# apachectl
[Tue Dec 31 13:48:21.111247 2013] [core] [pid 71456] (2)No such file or directory: AH00075: Failed to enable the 'httpready' Accept Filter
```

And the logs have no new information.


----------



## junovitch@ (Dec 31, 2013)

Ah.  That makes senses now.  You must have this line in your /etc/rc.conf

```
apache24_http_accept_enable="YES"
```

Since the jail cannot load kernel modules, it is failing.  You should do this on the host to fix that and then make it persistent so it won't break on the next reboot.

```
kldload accf_http
kldload accf_data
```

For persistence, do this:

```
echo 'kld_list="accf_data accf_http"' >> /etc/rc.conf
```

Alternatively, this works too but since they aren't required to boot the system the first method is preferred:

```
echo 'accf_http_load="YES"' >> /boot/loader.conf
echo 'accf_http_data="YES"' >> /boot/loader.conf
```


----------



## kclark (Dec 31, 2013)

Thanks!  I'm making slow progress on this. Following your directions the nasty warning/errors are now gone but I still can't get to Apache.


```
% nc -nvz 192.168.1.201 80
nc: connect to 192.168.1.201 port 80 (tcp) failed: Connection refused
```

There's still nothing in the logs.

Again, this is all started after php5-extensions were installed. I didn't have to mod_ify_ the host /etc/rc.conf at all and it worked out of the box.


----------



## junovitch@ (Jan 1, 2014)

Alright, so your first log message shows Apache starting without the accept filter kernel modules, that's the -D NOHTTPACCEPT flags that are shown. In that case no kernel modules are needed. Your second example shows it looking for the kernel module. When I saw that my mind jumped to the kernel modules being the problem because they may not been made persistent on reboot. You first mentioned your problems started after a reboot to test out your RAM then mentioned it being php5-extensions. Which was it? And now that there are no error messages, is the daemon running? You still haven't answered if `ps aux` shows httpd in the process list. Additionally, does `sockstat` show httpd listening on port 80?


----------



## kclark (Jan 1, 2014)

Sorry for the confusion, I did restart to test my RAM but that was after I installed lang/php55-extensions. Everything was working fine until the reboot, even after the php55-extensions install.  I may delete the jail and rebuild. The only thing I can think of at this point is some extension messed with the httpd.conf though I'm not sure why that would have any affect anything. In another jail I have www/tomcat7, www/apache24 and java/openjdk7 installed and everything is fine. So it's got to be something with PHP?


----------



## junovitch@ (Jan 1, 2014)

If Apache is now running and listening for a connection, it should work.  If there was a PHP problem then you would likely get an error message when you accessed the site in your web browser for anything that calls for PHP.


----------



## nesstyy (Jan 7, 2014)

use Nginx. U can try this good pkg.

Use Nginx. You can try this good package.


----------

