Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Feb 2003 22:16:22 +0100
From:      Manuel Kasper <mk@neon1.net>
To:        <freebsd-questions@freebsd.org>
Subject:   exec'ing ppp from within PHP
Message-ID:  <BA6DD536.1DC0%mk@neon1.net>

next in thread | raw e-mail | index | archive | help
Hi,

I've run into a very strange problem: consider the following situation on a
FreeBSD 4.7 system with custom /etc/rc* scripts:

- system boots, /etc/rc is executed
- /etc/rc executes a PHP script with a CLI version of PHP 4.3.0
- the PHP script uses exec() on a command like this:

ppp -quiet -ddial test

What happens is that at first, ppp runs fine - that is, until a certain
amount of data has been transferred (about 5 MB). Then it dies without
logging any messages. However, if I use the exact same command directly from
within /etc/rc, ppp keeps working indefinitely without any problems - it
will run for weeks and I can transfer gigabytes of data.

I'm using ppp on a PPPoE connection (via netgraph). Sometimes also, when ppp
has been exec'd by PHP, it immediately errors out, saying "no matching
session" - that line obviously comes from netgraph's PPPoE module. Again,
this only happens when exec'd from PHP - everything's OK from a shell
script.

I simply can't imagine what difference it makes whether ppp has been
executed from PHP or from a shell script once it is running. And yes, I'm
using > /dev/null 2>&1 in the exec() in PHP to make sure PHP won't wait for
ppp - in fact PHP exits correctly after the exec, leaving ppp to run in the
background.

What puzzles me even more is that it doesn't work either when I use PHP to
exec a shell script that in turn executes ppp.

I checked to make sure that PHP doesn't set any ulimits that could get
applied to the processes it creates - it sets none.

I have cvsup'ed to 4.7-RELEASE-p4, made world, did everything to ensure that
every single binary in the system was recompiled, tried it on another
machine, but no such luck.

Could somebody shed some light on this? Are there any other attributes
similar to resource limits that can be inherited by child processes?

Thanks!

Manuel


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?BA6DD536.1DC0%mk>