# Problem with Apache-2.2.10 in chroot and cURL [SOLVED]

## hanj

Hello All

After my recent issue chroot'ing apache-2.2.10 with mod_chroot (explained in detail here: https://forums.gentoo.org/viewtopic-t-725855-highlight-apache+chroot.html), I'm running into another problem related. This problem is related to cURL in the chroot'd environment. I'd like to clarify a few things.. 

- This was working perfectly with apache-2.2.9-r1 and mod_chroot-0.5

- My cURL request is NOT using SSL, eventhough I do have other examples there, and have included various ssl/cert packages in my jail

Basically, the result is this. When making a cURL via PHP request, nothing happens. No errors in the logs, no errors generated from PHP, but I get a empty return from curl_exec(). If I take Apache out of the jail, then it works. I also ran strace on this process, and did not see anything unusual regarding cURL. I do see it loading the so though..

```
13860 open("/usr/lib/libcurl.so.4", O_RDONLY) = 5

13860 open("/usr/lib/libcurl.so.4", O_RDONLY) = 7
```

Here is a snip of my cURL call:

```
$ch          = curl_init();

$timeout       = 5;

curl_setopt ($ch, CURLOPT_URL, $rest);

curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);

$file_contents    = curl_exec($ch);

curl_close($ch);
```

So $file_contents is always empty within the chroot jail. Again, this was working perfectly with mod_chroot, and mod_security before that in chroot jail. Not sure what I need to do to get this working.

Thanks in advance!

hanji

----------

## Thaidog

Bumped bc URGENT (you did have a backup right? - I use VMware snapshots when I am trying upgrades out... works perfectly)

----------

## hanj

 *Thaidog wrote:*   

> Bumped bc URGENT (you did have a backup right? - I use VMware snapshots when I am trying upgrades out... works perfectly)

 

Hello

If need be I can roll back to apache-2.2.9-r1 and get it back to where it needs to be. For the immediate moment, I'm running 2.2.10, but not chroot'd.

So are you having the same problem?

Thanks!

hanji

----------

## Thaidog

 *hanj wrote:*   

>  *Thaidog wrote:*   Bumped bc URGENT (you did have a backup right? - I use VMware snapshots when I am trying upgrades out... works perfectly) 
> 
> Hello
> 
> If need be I can roll back to apache-2.2.9-r1 and get it back to where it needs to be. For the immediate moment, I'm running 2.2.10, but not chroot'd.
> ...

 

no I have never set up a chroot apache... but I would be interested in knowing how on Gentoo.

----------

## hanj

 *Thaidog wrote:*   

> 
> 
> no I have never set up a chroot apache... but I would be interested in knowing how on Gentoo.

 

Here are some articles I put together. Problem is that it only works (still having problems w/cURL) with < apache-2.2.10

How to create Chrooted Apache with mod_chroot

Apache-2.2.10 + Mod_chroot-0.5 causes startup problems.

php's mail() in apache chroot

I posted on the cURL mailing list, but not getting any replies.

hanji

----------

## hanj

Hello

The problem persists. Emailing the cURL mailing list and getting a response from Daniel Stenberg is leading to a dead end. Here was his response to my problem:

 *Quote:*   

> I sounds like some sort of problem with PHP and its CURL module.

 

Very helpful.... I think it's related to missing libraries or apache hooks out/in from the jail regarding libcurl. I posted a bug as well.

https://bugs.gentoo.org/show_bug.cgi?id=256275

I'll see if I can find some support at a Apache list some where. Seriously, am I the only person running Apache in chroot in this forum?

hanji

----------

## hanj

This is now fixed. Looking at the mod_chroot, I saw that it was loading a file on start up. I added this to httpd.conf, and all is good again.

```

LoadFile /lib/libnss_dns.so.2
```

hanji

----------

## Thaidog

 *hanj wrote:*   

> This is now fixed. Looking at the mod_chroot, I saw that it was loading a file on start up. I added this to httpd.conf, and all is good again.
> 
> ```
> 
> LoadFile /lib/libnss_dns.so.2
> ...

 

Ah Good to see you got that fixed!  :Cool: 

----------

