Jump to content

sk93

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Posts posted by sk93

  1. Hi.

    May not be the right answer, but it's my understanding of what's written in the manual :)

    try changing this line:
    [code]$fh = fopen($file, "w+");[/code]

    to this:
    [code]$fh = fopen($file, "r+");[/code]

    I think this may be the cause of your issue because of the definition of "w+" states:
    [quote]'w+' Open for reading and writing; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.[/quote]

    And the "truncate the file to zero length" bit is likely to be returning you an empty string...

    wheras "r+" only has the following definition:
    [quote]'r+' Open for reading and writing; place the file pointer at the beginning of the file.  [/quote]

    Hope it works!

    Cheers,
    Sk93
  2. Hi,

    Firstly, this is my first post here - so please be gentle :)

    OK - I've got a lump of PHP that I am trying to use to communicate with a remote server.
    When I run the code my one of my local linux servers (ie, on the same LAN as my desktop pc, but NOT the remote server), the code works perfectly and I get no errors at all.

    However, when I upload my code to my webserver, the code fails with the following warning:

    [code]Warning: socket_sendto() unable to write to socket [1]: Operation not permitted[/code]

    The code is as follows:

    [code]    $socket=socket_create(AF_INET,SOCK_DGRAM,SOL_UDP);
        socket_set_option($socket,SOL_SOCKET,SO_RCVTIMEO,array('sec'=>$this->timeout,'usec'=>0));
        if (!$socket)
    {
    return;
    }
    $packet=null;
    $this->packets=null;

        if (!socket_sendto($socket,$transmission,strlen($transmission),0x100,$ip,$port))
    {
    return;
    }[/code]



    Not sure if it's relevent, but here's the contents of phpinfo from my server and then the webserver:

    My server:
    [code]PHP Version 4.3.7

    Configure Command  './configure' '--prefix=/usr' '--host=i686-pc-linux-gnu' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--datadir=/usr/share'
    '--sysconfdir=/etc' '--localstatedir=/var/lib' '--with-apxs2=/usr/sbin/apxs2' '--with-ndbm=/usr' '--with-db4=/usr' '--with-mcrypt=/usr' '--with-mhash=/usr'
    '--without-interbase' '--without-ming' '--without-swf' '--without-sybase' '--with-gdbm=/usr' '--without-fdftk' '--with-java=/opt/blackdown-jdk-1.4.1'
    '--without-mcal' '--without-unixODBC' '--without-pgsql' '--without-snmp' '--with-xpm-dir=/usr/X11R6' '--without-gmp' '--without-mssql' '--with-pdflib=/usr'
    '--without-gd' '--with-png=/usr' '--with-png-dir=/usr' '--with-jpeg=/usr' '--with-jpeg-dir=/usr' '--enable-exif' '--with-tiff=/usr' '--with-tiff-dir=/usr'
    '--with-mysql=/usr' '--with-mysql-sock=/var/run/mysqld/mysqld.sock' '--with-freetype-dir=/usr' '--with-ttf=/usr' '--with-t1lib=/usr' '--with-gettext'
    '--with-qtdom=/usr/qt/3' '--with-pspell=/usr' '--with-openssl=/usr' '--without-imap' '--without-ldap' '--with-dom=/usr' '--with-dom-xslt=/usr'
    '--with-dom-exslt=/usr' '--without-kerberos' '--with-pam' '--disable-memory-limit' '--disable-ipv6' '--without-yaz' '--without-curl' '--enable-dbx'
    '--with-zlib=/usr' '--with-zlib-dir=/usr' '--with-sablot=/usr' '--enable-xslt' '--with-xslt-sablot' '--with-xmlrpc' '--enable-wddx' '--with-xml' '--enable-mbstring=all'
    '--enable-mbregex' '--with-bz2=/usr' '--with-crack=/usr' '--with-cdb' '--enable-pcntl' '--enable-bcmath' '--enable-calendar' '--enable-dbase' '--enable-filepro'
    '--enable-ftp' '--with-mime-magic=/usr/share/misc/file/magic.mime' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvipc' '--with-iconv'
    '--enable-shmop' '--enable-dio' '--enable-yp' '--without-ncurses' '--without-readline' '--enable-inline-optimization' '--enable-track-vars' '--enable-trans-sid'
    '--enable-versioning' '--with-config-file-path=/etc/php/apache2-php4' '--without-pear' 


    sockets
    Sockets Support  enabled 
    [/code]

    The failing webserver:
    [code]PHP Version 4.3.10

    Configure Command  './configure' 'i386-redhat-linux' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc'
    '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com'
    '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--prefix=/usr' '--with-config-file-path=/etc' '--disable-debug' '--enable-pic' '--disable-rpath'
    '--enable-inline-optimization' '--with-bz2' '--with-db3' '--with-curl' '--with-dom=/usr' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr'
    '--with-png-dir=/usr' '--with-gd' '--enable-gd-native-ttf' '--with-ttf' '--with-gdbm' '--with-gettext' '--with-ncurses' '--with-gmp' '--with-iconv'
    '--with-jpeg-dir=/usr' '--with-mm' '--with-openssl' '--with-png' '--with-pspell' '--with-regex=system' '--with-xml' '--with-expat-dir=/usr' '--with-zlib'
    '--with-layout=GNU' '--enable-bcmath' '--enable-debugger' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets'
    '--enable-sysvsem' '--enable-sysvshm' '--enable-discard-path' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--without-oci8'
    '--with-imap=shared' '--with-imap-ssl' '--with-kerberos=/usr/kerberos' '--with-ldap=shared' '--with-mysql=shared,/usr' '--with-pgsql=shared'
    '--with-snmp=shared,/usr' '--with-snmp=shared' '--enable-ucd-snmp-hack' '--with-unixODBC=shared' '--enable-memory-limit' '--enable-bcmath'
    '--enable-shmop' '--enable-versioning' '--enable-calendar' '--enable-dbx' '--enable-dio' '--enable-mbstring' '--enable-mbstr-enc-trans' '--enable-cgi'
    '--enable-cli' '--disable-force-cgi-redirect' 


    sockets
    Sockets Support  enabled 
    [/code]

    I have tried googling this and didn't get anything at all (no.. really!)
    I also tried searching here a few times, but didn't find anything that I thought was related (but am willing to admit I am wrong!)

    If anyone can help, I'd greatly appreciate it!

    Cheers,
    Sk93
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.