RE: [PHP] IP of server?
| From: | James Moore | Date: | Wed, 28 Mar 2001 22:37:35 +0000 |
| Subject: | RE: [PHP] IP of server? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-45955@lists.php.net to get a copy of this message | ||
> I want to base the database a PHP script uses on the IP address of the
> server running the script. What is the fastest way to get the IP
> address of
> the server from a script? I could use environment variables but they are
> unreliable (when run from cron for example, the environment
> doesn't have all
> the variables you would expect). I wrote the following function based on a
> Perl firewall script that uses ifconfig, but it has too much overhead to
> call every time I connect to the database. All I really want to
> do is add a
> conf variable to php.ini that gets read at startup and is cached from then
> on. Any ideas?
Why not test for the enviromental var, if its not there then call your
function, if it is use it?
James
--
James Moore
jmoore@php.net
PHP: http://www.php.net/
PHP QA Team: http://qa.php.net/
PHP-GTK: http://gtk.php.net/
VL-SRM: http://www.vl-srm.net/