php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5207 Cannot open sockets using (p)fsockopen - problems using configure and inet_aton
Submitted: 2000-06-23 21:34 UTC Modified: 2000-07-07 08:07 UTC
From: djordan at completeweb dot net Assigned:
Status: Closed Package: Compile Failure
PHP Version: 4.0 Release OS: BSDI 4.1
Private report: No CVE-ID: None
 [2000-06-23 21:34 UTC] djordan at completeweb dot net
While trying to configure php-4 on BSDi 4.1 I am getting
errors finding inet_aton, which in BSDi there isnt
one, however there is an __inet_aton which is defined
in /arpa/inet.h however I cannot get configure to use
the /arpa/inet.h file. So configure constantly complains
about inet_aton and thus sockets thru php4 dont work.

PHP4 does compile into apache and runs just fine, Im just
missing socket ability.

Command line:
./configure --with-mysql --with-apache=../apache_1.3.12
=======================================

Here is an output from config.log:

configure:4388: checking for inet_aton in -lbind
configure:4407: gcc -o conftest -g -O2   conftest.c -lbind  -lm -ldl  1>&5
/var/tmp/ccS6N9zY.o: In function `main':
/usr/home/source/php-4.0.0/configure:4403: undefined reference to `inet_aton'
configure: failed program was:
#line 4396 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error.  */
/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
char inet_aton();

int main() {
inet_aton()
; return 0; }
configure:4447: checking for inet_aton in -lresolv
configure:4466: gcc -o conftest -g -O2   conftest.c -lresolv  -lm -ldl  1>&5
ld: cannot open -lresolv: No such file or directory
configure: failed program was:
#line 4455 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error.  */
/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */

And an output from configure itself:

<snip>
Running system checks checking for missing declarations of reentrant functions... done
checking whether compiler supports -R... no
checking whether compiler supports -Wl,-rpath,... yes
checking for sendmail... /usr/lib/sendmail
checking whether system uses EBCDIC... no
checking for socket in -lsocket... no
checking for htonl in -lsocket... no
checking for yp_get_default_domain... yes
checking for crypt in -lcrypt... no
checking for dlopen in -ldl... yes
checking for sin in -lm... yes
checking for inet_aton in -lbind... no
checking for inet_aton in -lresolv... no
checking for res_search in -lsocket... no
<snipped>
Although, later in the configure output I see this:
checking for arpa/inet.h... yes

I did check arpa/inet.h and it definitely defines
inet_aton to __inet_aton. Here is a snippet from
arpa/inet.h

<snipped>
#ifndef _INET_H_
#define _INET_H_
 
/* External definitions for functions in inet(3) */
 
#include <sys/param.h>
#if (!defined(BSD)) || (BSD < 199306)
# include <sys/bitypes.h>
#else
# include <sys/types.h>
#endif
#include <sys/cdefs.h>
 
#define inet_addr               __inet_addr
#define inet_aton               __inet_aton
<snipped>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-07 08:07 UTC] djordan at completeweb dot net
PROBLEM FIXED!

Socket connectivity was already working. We were chasing ghosts!

It turns out that PHP-4 needs to have a local DNS (named) running on a BSDi 3.x or 4.x
machine in order to resolve socket connections other than localhost.

I would suggest adding this to the documentation.

D. Jordan
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Sat Oct 10 11:00:01 2026 UTC