# apache2 mod_php5 and lynx

## gnac

This is getting disgusting!  The past three upgrades I have performed have all caused major problems with my system.  The first, libexpat, is well documented but still not really fixed, then somehow an unrelated library caused me to have to rebuild openldap because thunderbird wouldn't start.  Now, I upgraded apache and php

```
emerge -pv php apache

These are the packages that would be merged, in order:

Calculating dependencies... done!

[ebuild   R   ] dev-lang/php-5.2.4_pre200708051230-r2  USE="apache2 ..." 0 kB

[ebuild   R   ] www-servers/apache-2.2.4-r12  USE="ldap ssl ..." 0 kB
```

After parsing through all the changes in etc-update to the conf files, and figuring out on my own that all the vhosts have been moved into a new file, I tried to restart, but first I checked the status:

```
# /etc/init.d/apache2 status

 * status:  started

/etc/init.d/apache2: line 113: lynx: command not found
```

wtf is it trying to do with lynx?  Well I know what its trying to do, show a server status page.  Well there are no "lynx" use flags in the apache build, and lynx is not a dependency of apache.  How the heck is it supposed to find it if it isn't built by the system.  Anyway, minor annoyance, on to the main problem.

So I try and stop apache and get the following error:

```
# /etc/init.d/apache2 stop

 * Apache2 has detected a syntax error in your configuration files:

apache2: Syntax error on line 241 of /etc/apache2/httpd.conf: Syntax error on line 4 of /etc/apache2/modules.d/70_mod_php5.conf: API module structure `php5_module' in file /usr/lib/apache2/modules/libphp5.so is garbled - perhaps this is not an Apache module DSO?
```

Here are the offending lines 

```
<IfDefine PHP5>

   # Load the module first

   <IfModule !mod_php5.c>

      LoadModule php5_module    modules/libphp5.so   <-- this is line 4

   </IfModule>
```

What does this mean? do I have to rebuild PHP perhaps?

Fortunately my server the stop command failed, so my server is still running, and php is still functional on the running processes, but I definately do not want to forcibly stop apache unless I can be assured that it will restart.

----------

## Janne Pikkarainen

 *gnac wrote:*   

> 
> 
> So I try and stop apache and get the following error:
> 
> ```
> ...

 

Yes, please re-emerge PHP. In case that didn't help, double-check if Apache is trying to load PHP module from the correct directory.

----------

## gnac

Yeah, rebuilding php did the trick.  Orignially I upgraded PHP and then apache.  Kinda sucks it borked though.  working now after mucho mucking around to get my vhosts working again with the new configuration file layout ...

ty

----------

## GWilliam

#NULLLast edited by GWilliam on Sun Jul 25, 2010 4:29 am; edited 1 time in total

----------

## RosenSama

 *GWilliam wrote:*   

> So what's up with the following error?
> 
> ```
> # /etc/init.d/apache2 status
> 
> ...

 

Ditto.  

<useless gripe>

Do I really need to install lynx and enable mod_status to to issue a standard init.d status command?  If so, how about including the dependency?  

</useless gripe>

----------

## Decibels

Ya that stuff wasn't in the apache2 I just replaced. From what I find on the web, doesn't look like it is specific to just Gentoo though.

I find it irritating because, I just use mine for a family/friends gallery server, there is nothing you would want to use lynx for on it. When I check deps it doesn't come up with lynx as one.

```
[ebuild   R   ] www-servers/apache-2.2.6  USE="ldap ssl -debug -doc -mpm-event -mpm-itk -mpm-peruser -mpm-prefork -mpm-worker -no-suexec (-selinux) -static-modules -threads" 0 kB
```

What sucks even more is that I installed lynx just to see if it would fix the problem and doesn't still says: (found out later lynx wasn't my problem was putting PHP5 back in without the -D)

```
/etc/init.d/apache2 restart

 * Apache2 has detected a syntax error in your configuration files:
```

But if I run /usr/sbin/apache2 -t is says Syntax OK.

**Minutes Later: Use to have PHP5 in /etc/conf.d/apache2 APACHE2_OPTS="".  Forgot the -D in front of it when put it back in there.. 

On a side note, if you use eaccelerator and remerge php you will need to do eaccelerator also.

----------

## gnac

I agree that if apache2 expects lynx to be on the system in order to run without errors, lynx should be in the dependencies, at least with a "lynx" use flag or something.

However, I was able to get rid of the errors by replacing

```
# of the command line. Designed for lynx, however other programs may work.

LYNX="lynx -dump"
```

in /etc/conf.d/apache  with

```
#skip lynx, and just echo

LYNX="echo check "
```

Now, when I run /etc/init.d/apache2 status I get

```
~ $ /etc/init.d/apache2 status

 * status:  started

check http://localhost/server-status
```

I tried to set it up so wget would get the file and pipe it to less, 

eg

 wget -O- $1 | less

but because of the way the command is called inside of /etc/init.d/apache2 you would need more advanced scripting than I cared to do.  My guess is that a simple xargs invocation or some such would do the job nicely, or you could figure out a way to pipte it to null:

```
status() {

        LYNX="${LYNX:-lynx -dump}"

        STATUSURL="${STATUSURL:-http://localhost/server-status}"

        ${LYNX} ${STATUSURL} | awk ' /process$/ { print; exit } { print } '

}

fullstatus() {

        LYNX="${LYNX:-lynx -dump}"

        STATUSURL="${STATUSURL:-http://localhost/server-status}"

        ${LYNX} ${STATUSURL}

}
```

----------

