# how to enable url rewriting in apache?

## Majed17

anyone got any idea how to enable url rewriting in apache? i searched the internet and found guidelines to enable mod rewrite on ubuntu and debain but not for gentoo and it seems they are totally different so i thought i might ask here for help.

----------

## disi

Here is a list of modules for Apache2' APACHE2_MODULES in the make.conf:

http://www.gentoo.org/proj/en/apache/doc/upgrading.xml

Once Apache is rebuild, you need to enable it in the /etc/conf.d/apache2

----------

## Majed17

i ended up doing 

```
emerge --ask --verbose --update --newuse --deep world
```

which took a day with the previous steps mentioned in your link 

but any way i found url rewriting in /etc/pnp/config.php 

```
$conf['use_url_rewriting'] = 1;
```

but that didn't solve my problem with pnp4nagios i still have 

```
PHP socket extension    PHP socket extension not available
```

i'm inclined to think this is a problem with php even though the previous tests

```
PHP GD extension    Pass

PHP function proc_open()    Pass

PHP zlib extension    Pass

PHP session extension    Pass

PHP JSON extension    Pass

PHP magic_quotes_gpc    Off

Apache Rewrite Module    Pass
```

this is the result when typing http://10.1.1.212/pnp4nagios/ any idea about this?

----------

## tomk

Moved from Installing Gentoo to Networking & Security as it is not about installing Gentoo.

----------

## Majed17

i got it working since then by adding sockets to /et/make.conf and now use looks like this:

```

USE="3dnow 3dnowext aalib acpi apache2 apm calendar cgi dhcpcd dict ftp ftpd

     fuse gd gzip jpeg jpeg2k jpgraph nagios-dns nagios-game nagios-ntp

     nagios-ping nagios-ssh ntfs pdf php png postfix rar reiser4 reiserfs

     rrdcgi rrdtool sendmail snmp splash sse sse2 sse3 ssh svg winbind

     wireshark xml zip [color=darkred]sockets[/color] -X -alsa -bittorrent -doc -ipv6"
```

then i

```

emerge php
```

and now errors disappeared in the http:server/pnp4nagios as shown below:

```

PNP4Nagios Environment Tests

The following options are determined by "configure". If any of the tests have failed, consult the documentation for more information on how to correct the problem.

PNP4Nagios Version    pnp4nagios-0.6.13

Prefix    /usr/local/pnp4nagios

Configure Arguments    ./configure '--with-rrdtool=/usr/local/rrdtool/bin/rrdtool' '--with-httpd-conf=/usr/local/apache2/conf/extra' '--with-perl_lib_path=/usr/local/rrdtool/lib/perl/5.8.8/i386-linux-thread-multi' '--with-perfdata-dir=/var/nagios/perfdata'

RRD Storage    /var/nagios/perfdata is readable.

RRDtool Binary    /usr/local/rrdtool/bin/rrdtool is executable by PHP

PHP GD extension    Pass

PHP function proc_open()    Pass

PHP zlib extension    Pass

PHP session extension    Pass

PHP JSON extension    Pass

PHP magic_quotes_gpc    Off

PHP socket extension    Pass

Apache Rewrite Module    Pass

Kohana Environment Tests

The following tests have been run to determine if Kohana will work in your environment. If any of the tests have failed, consult the documentation for more information on how to correct the problem.

PHP Version    5.3.8-pl0-gentoo

System Directory    /usr/local/pnp4nagios/lib/kohana/system/

Application Directory    /usr/local/pnp4nagios/share/application/

Reflection Enabled    Pass

Iconv Extension Loaded    Pass

Mbstring Not Overloaded    Pass

URI Determination    Pass

Your environment passed all requirements. Remove or rename the /usr/local/pnp4nagios/share/install.php file now.

```

after renaming the install.php to install.ignore

i click on the graph of ping but instead of the graph i get the following error:

```

PNP4Nagios Version 0.6.13

Please check the documentation for information about the following error.

Object of class stdClass could not be converted to string

file [line]:

application/views/template.php [100]:

back

   

Actions

Loaded in 0.0382 seconds, using 1.79MB of memory. Generated by Kohana v2.3.4.
```

is this still a problem with php or some configuration in apache? thanks for your help  :Smile: 

----------

## Majed17

according to the configuration guide npcd should be started in the end. but when i try

```

/etc/init.d/npcd start

```

i get:

```

* Starting npcd ...

An Error occured while reading your config on line 0

Message was: "ERROR - Could not open config file - No such file or directory"

 * start-stop-daemon: failed to start `/usr/bin/npcd'

 * Failed to Start npcd                                                   [ !! ]

 * ERROR: npcd failed to start

```

i don't know were this configuration file should be.

i tried

```

emerge --search npcd

```

i got

```

Searching...    srvmonm libexec # emerge --search npcd

Searching...

[ Results for search key : npcd ]

[ Applications found : 0 ]

```

can anyone help with this?. it seems this application is essential for pnp4nagios 0.6

----------

## cach0rr0

config files for the init script itself should be in /etc/conf.d (so, in this case, /etc/conf.d/npcd)

the path for the runtime configuration file for whatever daemon can often be found in the text of /etc/conf.d/<whatever> as well, though sometimes it's hard-coded in /etc/init.d/<scriptname>

many times packages will provide an '/etc/somename.conf.example', which you have to edit and rename to '/etc/somename.conf'

Far as seeing what files are provided with a package, emerge gentoolkit if you havent already, then

```

equery files <pkgname>

```

----------

## Majed17

well thanks for the valuable information, much appreciated but i did

```
qfile npcd
```

and got :

```
net-analyzer/pnp4nagios (/etc/init.d/npcd)

net-analyzer/pnp4nagios (/usr/bin/npcd)

```

and there was no npcd file in /etc/conf.d 

anyway it turned out that it is installed when pnp4nagios is installed and it is used when bulk mode with npcd is used in pnp. i however have configured pnp with sync mode and therefore don't need npcd configuration and it turns out that the problem was with apache as i read in another forum. in /etc/conf.d/apache i added -D PNP and now the line looks like this:

```
APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D SSL -D SSL_DEFAULT_VHOST -D LANGUAGE -D PHP5 -D PERL -D NAGIOS -D PNP"
```

and the graphs worked at last, of course apache had to be restarted before it worked  :Smile: 

----------

