Pgsql Socket Timeout
I am encountering a problem with PHP5 and postgresql on a fedora core 3 box. I have a database driven report application written in PHP5 on a remote server. This application allows a user to submit a sql statement created by php based on user input parameters to the postgresql server. The application works great as long as the database server can return the result set within what appears to be 2 minutes. If the query takes longer than two minutes to execute the database server will eventually finish the work *but* no rows of data appear on the web page.
I am thinking that the network socket connection between the php engine and the postgresql database server gets dropped after two minutes and that is way the results never arrive at the php page. If you think this might be a plausible explanation can you provide some assistance as to how I can go about adressing this problem?
View Complete Forum Thread with Replies
Related Forum Messages:
Curl Timeout Vs Socket Timeout
We have two versions of client code, one using curl, and other one using raw sockets via fsockopen(), and we use the following code to set the i/o timeouts: 1) curl: . . curl_setopt( $handle, CURLOPT_TIMEOUT, 1 ); . . $resp = curl_exec($handle) 2) sockets: stream_set_timeout( $sock, 1); Here we use frwrite() and fread() to send the request and read the...
View Replies !
Socket Timeout Being Ignored
Say I have the following script: <? $timeout = 5; $start = time(); $fsock = fsockopen(ì¬.1.119.10',80,$errno,$errstr,$timeou t); // reduce $timeout by the amount of time that it took for fsockopen to connect. $timeout-=(time()-$start); socket_set_timeout($fsock,$timeout); fputs($fsock,"GET http://www.google.com/ HTTP/1.0 "); fputs($fsock,"Host: www.google.com "); while ( !feof($fsock) ) { echo fgets($fsock); } fclose($fsock); ?> As you can tell, the timeout is set to 5 seconds in fsockopen and then is set to how ever many seconds out of that 5 that fsockopen didn't take to connect. All in all, the whole script should run in, at most, 5 seconds. Or atleast it seems like it should. Sometimes, however, it doesn't - it takes several minutes. And unfortunately, this happens enough times to be kinda a nuisance. And I have no idea what the problem is.
View Replies !
Redirect After X Seconds Socket Timeout
I have a weatherpage on my website, but sometimes it seems to take a while to get the weatherinfo from an external site, making my page blank on my website and doing nothing. What I would like is to know how to create a redirect page should the data retrieval take too long. Code:
View Replies !
Make Localhost (file Socket) -> Mysql.host.com (network Socket)
i have an old webserver where users let their script connect to localhost for mysql queries. I have a new mysql server where I want to put all the user databases. So Im looking for a way to make PHP interpretet 'localhost' as a network socket and connect to 'mysql.host.com'. Is there an easy way to do this; this would really help me migrate the user databases.
View Replies !
--with-pgsql=WHERE?
I need an installation with Postgres support, and was happy to find in my phpinfo that there was a --with-pgsql=shared option in the config line. but I still got "call to undefined function: pgsql_connect (4.3.11) So I figured whatev, I'll put a new installation (PHP5, in fact), but I always fail config with: Cannot find libpq-fe.h. Please specify correct Postgresql installation path 'course i looked in my handy old webmin to see where Postgres might be... tried various paths I found in various places --with-pgsql=/var/lib/pgsql/ --with-pgsql=/usr/share/pgsql --with-pgsql=/usr/bin/psql obviously not a lib, but getting desparate...
View Replies !
PHP Installation With Pgsql
I got PostgreSQL installed and now I'm trying to get PHP installed too. I do ./configure --with-pgsql and everything works fine. But when I do make, I get this error: ext/mysql/libmysql/my_lib.o(.text+0x37a): In function `my_dir': /home/marc/extract/php-4.3.1/ext/mysql/libmysql/my_lib.c:169: undefined reference to `errno' ext/mysql/libmysql/my_lib.o(.text+0x546): In function `my_stat': /home/marc/extract/php-4.3.1/ext/mysql/libmysql/my_lib.c:588: undefined reference to `errno' ext/mysql/libmysql/my_tempnam.o(.text+0x79):/home/marc/extract/php-4.3.1/ext/mysql/libmysql/my_tempnam.c:108: more undefined references to `errno' follow collect2: ld returned 1 exit status make: *** [sapi/cgi/php] Error 1 I need php installed soon. I don't know what is causing this error to occur.
View Replies !
Hosting PHP And PGSQL DB
Can anyone recommend somewhere that offers cheap or even free web hosting for PHP scripting with a PGSQL database? I am looking to build a small website with some images and dynamic content, such as a forum/message board and wondered what it would cost me for this? I used to use themooseisloose for hosting (one-off payment of £2.77 GBP), but have been alerted that have gone bust (at some point at the end of last year). I've have googled, but was just wondering if anyone had any positive experiences of hosts that will allow this setup mentioned cheaply.
View Replies !
Error Management : Php-pgsql.
My goal : obtain the error message if the connection fail. ## my code : <?php $cnxString = "host=localhost port=5432 dbname=toto user=atlante password=aiThoo3g"; $pgsql_conn = pg_connect($cnxString, PGSQL_CONNECT_FORCE_NEW); if ($pgsql_conn) { print "Connexion réussie à : " . pg_host($pgsql_conn) . "<br/> "; } else { echo pg_last_notice($pgsql_conn); exit; } ?> ## if «php_value display_errors 1» the screen result is this one : Warning: pg_connect() [function.pg-connect]: Unable to connect to PostgreSQL server: FATAL: la base de données «toto» n'existe pas in /home/willou/public_html/atlanpolis/wwws/tools/checkdb.php on line 5 Warning: pg_last_notice() expects parameter 1 to be resource, boolean given in /home/willou/public_html/atlanpolis/wwws/tools/checkdb.php on line 10 ## If not, i haven't got any result. The message just appears in my logs The return of pg_connect not seems to be an connection resource when the connection fails.
View Replies !
My Dad Wants PHP & MySQL Or PgSQL Hosting
To my surprise last month, my dad wanted to start dabbling in PHP and MySQL or pgSQL. I've been helping him out a bit. He's into athletic medicine and wants to have a website to help athletes and physical therapists improve performance. His current web hosting provider -- Earthlink -- doesn't give him anything but PHP 3.0.x. I want to get him at least on PHP 4.2.x (or better) along with either MySQL or PostgreSQL (pgSQL) support. I've done some googling on this, but I wanted real user opinions on cost, customer support, uptime, etc. At this point he's just looking at something that suits him somewhere between hobbyist and early sole proprietorship strength. Shared web hosting would suit him fine. Cost might be an issue for him initially. He's going to need some sort of simplistic web interface to be able to create databases, tables, and user accounts.
View Replies !
Ubuntu Php4-pgsql
I found some strange kind of mild install bug when installing Ubuntu 5.04 php4-pgsql module (the module that connects PHP4 to PostgreSQL). You may encounter the error: Call to undefined function: pg_connect() No amount of using Synaptic Package Manager would fix this for me. The solution was all at command line under 'root' account: $ apt-get update $ apt-get install php4-pgsql $ /etc/init.d/postgresql restart $ /etc/init.d/apache2 restart
View Replies !
MySQL And PGSQL And Hostname Question
i would like the thoughts of some folks with more experience than i have. i want to learn pgsql. i have some vb and msaccess experience and would like to learn how to use php and pgsql to develop some nice website / application functionality. however, i'm not sure the hurdle of relatively miniscule documentation and tutorials is worth the effort. i'm now thinking i should just use mysql to start and, if the need really arises, move over to pgsql. i'm busy with a lot of stuff right now - regular job, starting a business, developing a web site for the business, learning graphics programs, living life, blah, blah, blah. what is your opinion? go with the better documented db and develop more quickly but have to possibly switch over later when time may be more available and retain my hair or bite the bullet and go with pgsql? differing opinions are appreciated and encouraged so i can evaluate them based on my own set of values. also i am trying to set up localhost as my url so my hardcoded links work on my local win98 machine (actual webserve is linux). host.sam is as follows... 127.0.0.1 localhost www.easyautodeals.com my apache httpd.conf file shows the following for ServerName: ServerName www.easyautodeals.com however, when i type easyautodeals into my web browser, i go straight to my actual web server and not to my "localhost" location.
View Replies !
Irritating Warning On ->PEAR->DB->PGSQL
I am getting following message from pear. I am running RedHat 8.0, PostgreSQL is 7.3.2 PHP Version 4.2.2 and pear:db 1.6.5. Warning: pg_errormessage(): supplied argument is not a valid PostgreSQL link resource in /usr/share/pear/DB/pgsql.php on line 449 Any idea.
View Replies !
PGSQL 7.4.8 PHP 4.3.4 & Apache 2.0.49 Segmentation Fault With Client Certs
Having an issue that is specific to PHP compiled with PGSQL support with versions noted in subject line. I understand that there are many variables to consider here but believe I have narrowed down the Apache Client Cert failures to my PHP/PGSQL build. 1. Apache PHP without PGSQL works as expected using client certificates 2. Apache PHP with PGSQL works fine with standard SSL connections 3 Apache PHP with PGSQL fails with client certificates - no output other than Segmentation faults in the apache error logs as follows: [Wed Nov 30 23:26:57 2005] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec2).... I also performed same tests on another instance of Apache/PHP/PGSQL which was version 2.0.54 of apache and PHP/PGSQL versions same as subject line with same exact results. Any ideas as to the source of this problem and suggestions for tests/fixes are greatly appreciated. There are no errors in any of the logs other than what I have included so it's very difficult to see what is wrong. All I know for sure is that I am able to reproduce the results on more than one machine.
View Replies !
YIM Socket
1:Can I open a YIM socket? If so, how can I read the info? 2:Can I keep the socket opened more than the script runs(or can I keep the script opened more than it`s run by apache?)
View Replies !
Socket
I have two questions regarding sockets that I havent been able to find an answer to on the internet. The first is that when Im transferring a file I get an error when the other side quits. This error makes the script fail. What should I do so that when the other side stops downloading the script closes the connection and keep on looping (listening). (error: socket_write() unable to write to socket 4 [32]: Code:
View Replies !
Php Socket
i want to be able to send a packet to a http server and receive the response, but i'm not quite sure how to do it. i thought of using sockets, and although i have worked out how to send data to the http server, i have no idea how to receive the responses. this is what i've got so far. i know that the server is receiving the data because i have employed this technique before, only previously i did not need to receive the response. <?php function login() { $data = "POST /admin/default.asp HTTP/1.1 "; $data .= etc etc etc $socket = socket_create(AF_INET,SOCK_STREAM,SOL_TCP); $connection = socket_connect($socket,'(*IP ADDRESS*)',ྌ'); socket_write($socket,$data); ..........................
View Replies !
Socket In PHP
i've an intranet, i want do palace a php script that let's open a socket UDP connection to my client and let the user (via a form) to send a message to me. In my client i've created a little program that listen the udp port and print the message been sent. I try to make this simple script and placed in intranet.
View Replies !
Socket + UDP
An external device send some data on a port of my PC with the UDP protocol. I'm trying to create a "port scan" which does something when the data arrive at the port. I read on the manual that the socket_listen is not avalaible for UDP. They suggest to use socket_recv or socket_recvfrom, and I tried them, but I didn't get what I hope to get. Code:
View Replies !
Fwrite() To A Socket ?
<?php $host="127.0.0.1"; $socket=fsockopen($host,80,$errno,$errstr,50); if(!$socket){echo "Cannot connect".$errno.$errstr;} else { fputs ($socket, "GET /testfiles/blank2.txt HTTP/1.0 "); fopen("blank2.txt", "w"); $info2=fwrite($socket,"ABCDefg"); fclose ($socket); } ?> I can read text through this socket but not write to it, I can also write to it 'locally' but not through the socket.
View Replies !
Socket Deadlock
I'm getting started learning php at the moment...with some difficulties: I want to comunicate with a java server via sockets: $socket = socket_create(AF_INET,SOCK_STREAM,SOL_TCP); $connection = socket_connect($socket,'localhost',3141); socket_write($socket,"someUserId"); while($data = socket_read($socket,3141)) { echo $data; } write and read seperatly are fine, but in combination they produce some deadlock causing a timeout! I googeled a good bit, but couldnt get ahead.
View Replies !
Socket Error
i got this error message when i try 2 open mysql: error 2004: cant create tcp/ip socket(10047) where did this came from?how can i fix it? i use a PC with win98 installed and i just installed phpdev423.but it doesnt work.
View Replies !
Socket Problem
I use fsockopen to open a connection on a POP3 server. I use fwrite to send command to the pop3 server. I have a problem when the call between 2 fwrite is too long. The connection is closed. If thought the 2nd fwrite will return false (because the connection is closed), but it does a strange thing. Php displays errors messages again and again and again... Theses error messages are all the same and explain that the connection has been cancelled by host. The only solution to stop the error messages is to kill the apache task! Do you know this bug? It really should return false and not try again and again to write!! Can i know if the connection has been cancelled before i call the fwrite function so i don't have this problem anymore?
View Replies !
Socket Binding
Right, I have a box with multiple IP addresses assigned to it. What I want is to be able to connect to elsewhere, appearing as each of those IPs. I currently have code where no source IP is set as the extra addresses are a new thing to me. It looks like it's possible using socket_bind() but that's a bit too low level for me, and makes use of an experimental extension module. Ideally I would like to be able to bind fsockopen() to a particular IP, then repeat and bind it to another IP - is this possible at all? I already have the code which deals with fgets() and fwrite(), so it would be much easier as I'm not sure how to implement them using the other socket extension. Hope that makes sense :) This is my first post here.
View Replies !
PHP Socket Programming With SSL
Is there any good source that show how to do socket programming with setting up secure sockets in PHP? Most of the source (books, web sites) I found only talks about basic socket functionality.
View Replies !
Socket Programming
Can anyone direct me to good resources for PHP socket programming. I have found some examples, but have been unable to get them to work.
View Replies !
Fopen (the Need For SOCKET)
im having a script that reads a content from a site, the problem is .. when i test it under my machine -localhost- its ruinning smoothly ... but ... when i iploaded the same script to my hosting co. it did not!! it said .. Warning: fopen("http://mydomain/default.htm","r") - A socket must be already connected. in inc/getnews.php on line 13 Warning: Supplied argument is not a valid File-Handle resource in inc/getnews.php on line 13 Code:
View Replies !
Socket Errors
I'm looking through a complex script at the moment. If the OS is FreeBSD, the script defines EINPROGRESS to error 36 (Operation now in progress), EALREADY to error 37 (Operation already in progress), and EISCONN to error 56 (Socket is already connected). If it's Linux, then sets them to 115, 114 and 106 respectively. I want to try and add Windows compatability to this code. I've printed a list of all Windows socket error codes from 0 to 15000, but can't find the similar errors,
View Replies !
Socket Functions In PHP
I suspect I'm having problems with socket functions within my PHP application running on Red Hat 2.4.21-4.EL #1/PHP 4.3.2/Apache 2.0.46. Below is a sample code listing: ================================================== ============== function sendRequest($strRequest) { $parser = NULL; $logman = new LogManager(); $resource = socket_create( AF_INET, SOCK_STREAM, SOL_TCP ); $logman->append("Connecting to OLS Server..."); $socket_conn = socket_connect( $resource, $serverIP, $serverPort ); if( $socket_conn ) { $logman->append("Connected to {$serverIP}:{$serverPort}. Sending XML request..."); socket_write( $resource, $strRequest ); $logman->append("XML request sent. Waiting for XML response..."); $document = ""; $data = socket_read( $resource, 1024 ); while ($data != "") { $document .= $data; $data = socket_read( $resource, 1024 ); } $logman->append("XML response received."); $parser = new OlsResponseParser; // parse the received document using our parser $parser->parse($document); } if ($parser != NULL) { return $parser->getOlsResponse(); } return $parser; } ================================================== ============== The following listing is from the logs I have created... ================================================== ============== |+-------+---------------------+------------------------------------------------------------+ | LogId | LogDate | LogMessage | +-------+---------------------+------------------------------------------------------------+ | 37 | 2006-05-03 15:39:28 | /new_userpage_process.php initialized. Creating buffer... | | 38 | 2006-05-03 15:39:28 | Connecting to OLS Server... | | 39 | 2006-05-03 15:39:28 | Connected to (server):(port). Sending XML request... | | 40 | 2006-05-03 15:39:28 | XML request sent. Waiting for XML response... | | 41 | 2006-05-03 15:40:34 | XML response received. | | 42 | 2006-05-03 15:40:34 | Buffering complete. Redirecting to thanks.php?actiontype=2 | +-------+---------------------+------------------------------------------------------------+ ================================================== =============
View Replies !
Socket Connections With PHP
At the moment I have written a Temperature Server (takes readings from serial ports). Now I have a socket connection open on this server that receives client connections which either INSERT or VIEW. Now, I want to be able to connect to this server and input "view " and capture the output. I was wondering if someone could give me a good example of this in action or a good website about this.
View Replies !
Socket With PHP Under Windows
I am trying to work with socket functions on PHP under windows (PHP which I downloaded from php.et) Does it support socket by default or I must enable a library. Has it been compiled with socket options?
View Replies !
Multiple Socket
I am trying to open multiple sockets and wants to use them simultaneously for fetching webpages over the net. say i m having "n" number of url's, so i am opening n sockets for it and after opening it i am fetching web contents simultaneously for all. problem i am facing is that its not accepting url's other then domain or index page. eg:- Its accepting "www.example.com" but not accepting "www.example.com/abc/xyz" etc etc. Code:
View Replies !
Socket And Session
I'm trying to connect to an application server using sockets. Everything is fine with a small exception. I would like to store socket in session, so that I wouldn't have to reconnect at every request. I open socket using (PHP5): stream_socket_client. Then I try to: $_SESSION["socket"] = $newSocket. With every new request the $_SESSION["socket"] is 0.
View Replies !
Secured Socket
I have some question about SSL and socket functions in PHP. I am new in web development and SSL networking. Actually I was trying to make a PHP MSN client. I am trying to connect with hotmail server to get ticket to login into MSN using socket. I use function like Code: $msnSock = fsockopen("ssl://loginnet.passport.com",443); But this function gives me error “no SSL support in this build even when I am trying to use CURL it gives me error at Call to undefined function: curl_init(). What I feel is may be because I dont have SSL certificate for my server. But I am not sure. Do I need to get SSL certificate?
View Replies !
Socket Script
I found this script and not sure how to use it the way I need to use it. Where in this script would I run the sql to loop a table to get email address to people to send to ? Here is what I am using now but some how need to implement query into this script to get emails... Or do I still use this query and then call the function or modifie what. Code:
View Replies !
SMTP Socket
I have a question regarding communicating with SMTP server trough sockets... Since PHP communicates with SQL throuqh sockets is it possible to communicate the same way with SMTP server?
View Replies !
With A Socket Connection
I need to connect to a server. The server is a phone system. It has a Socket server running that I need to connect to. The very first message to the server must be in this format: <byte_count><Socket_Type><Password><0x00[<AppNAme>0x00] The two most important ate the Byte_Count and the Socket_Type. From the manufacturer info the: Byte Count: Indicates the byte count for the data being passed Socket_Type : Passed as hex 84 (0x84) The Password and Appname are not needed or required. So How do I connect using this format? So far I have this: $socket = socket_create(AF_INET,SOCK_STREAM,SOL_TCP); //make the socket $connection = socket_connect($socket,éP.168.1.230',4000); //connect to the server while($data = socket_read($socket,2046,PHP_NORMAL_READ)) //listen for any data, and echo that data out { echo $data; } Once the connection is made the server will send back call information after some other information. Right now I would be happy to get the records onto the screen to see that I have connected. My goal is to eventually try to get the recieved data into a MySql database.
View Replies !
Socket Works On Mac, But Not On XP Pro
This command works on my home computer: if($locsock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) echo "Socket created"; My home computer is running Mac OS X, and is on a small LAN behind a NAT router with a hardware firewall (no software firewall). I tried to execute the same command on a school computer. It's running XP Pro and is on a large LAN behind a NAT router and a (very overprotective) hardware firewall. It's also running "Microsoft Firewall Client for ISA Server". Code:
View Replies !
CURL Vs Socket
I need to POST values from PHP ie through code to a page on the net. AFAIK there seems to be two methods of doing so, first you can use CURL [ curl_exec() ] and secondly open a socket [ fsockopen() ]. So guys, in terms of performance what method would be best to use? Or what are the pros n cons of using these methods.
View Replies !
Outgoing Socket
I am using fsockopen to create a socket connection out. Is there any way to bind this to a particular IP address? I have found socket_bind after a socket_create but this works on *nix and not on my windows php, whereas fsockopen works on both.
View Replies !
Socket Email Download
I have been developing a socket program that connects to my pop3 server and checks my email. i have done the connecting and working out how many emails i have i just need the code that would make it get the message. i tried to get the message, after sending the rtrv command, by using fgets but that only gets one line. how would i get the whole message, would i have to work out how many lines there were and loop to get the message or is there another way. I could not think of any ways of checking how many lines there were in the message, only the size of the message in octets. i could make it so that it just looped untill it found 20 lines of blank text but im sure that there is a better way of doing it. <? // mail server settings $host="pop.*****.com"; $port = 110; $user = "*******"; $pass = "*******"; // open a client connection $fp = fsockopen ($host, $port, $errno, $errstr); // if a handle is not returned if (!$fp) { die("Error: could not open socket connection "); } // get the welcome message $welcome = fgets ($fp, 150); // check for success code if (substr($welcome, 0, 3) == "+OK") { // send username and read response fputs ($fp, "USER $user "); fgets($fp, 50); // send password and read response fputs ($fp, "PASS $pass "); $ack = fgets($fp, 50); // check for success code if (substr($ack, 0, 3) == "+OK") { // send status request and read response fputs ($fp, "STAT "); $status = fgets($fp, 50); if (substr($status, 0, 3) == "+OK") { } // error getting status else { die ("Server said: $status"); } } // auth failure else { die ("Server said: $ack"); } } // bad welcome message else { die ("Bad connection string "); } // get status string // split by spaces $arr = explode(" ", $status); echo $arr[1] . " messages in mailbox"; ////if there are any messages in the mail box loop through them and get them if ($arr[1]>0) { while ($arr[1]>0) { fputs ($fp, "RETR $arr[1] "); $mesg = fgets($fp, 512); $arr[1]=$arr[1]-1; } } ////////////////////////////////////////////////////////////////////////////////// //this stuff is for another bit of my code // $string = "blah-header stuff-blah // Message-ID: <00089665hk886%j26nd£$G@blah> // blah-header stuff-blah "; //preg_match("|(Message-ID:s*(<([^@]+)@([^>]+)>))|iU", $string, $matches); //echo "<pre>"; //print_r($matches[3]); //echo "</pre>"; //////////////////////////////////////////////////////////////////////////////// // $fr = fopen('msgid',''); // if(!$fr) { // echo "Could not write the file with your email in it."; // exit; // } //now that the file is open you would loop and use msgid of every msg to write the file // fputs($fr, $msg); // fclose($fr); fputs ($fp, "QUIT "); fclose ($fp); ?>
View Replies !
Slow Reading From Socket
I am writing a script that connects to somekind of telnet server, and returns the answers the server gives. Everything works fine until I have to start writing a loop. I want to give a command which will give an answer of more than 1 line, but I do not know how many lines it will be in total. So I wrote something like this: // get the list fputs ($fp, "list all"); $list = "1"; while (!$list=="") { $list = fgets($fp, 50); echo "$list<BR>"; } I tried also a few other loops like "while ($i < 100) or while(!feof) etc. but they take over 40 seconds to show 4 lines of text. But if I would do something like: fputs ($fp, "list all"); $line1 = fgets($fp, 50); $line2 = fgets($fp, 50); $line3 = fgets($fp, 50); etc. It is ready within a second. Anybody knows how I can speed this up? I already tried other functions like fread, fpassthru, all worked, but as evenly slow. Who can help me out?
View Replies !
Php-java Socket Problem
I have a java server running and listening for socket connections. My php script will send data to Java socekt and read acknowledgement from server. The problem is php script seems to timeout when it tries to read data back from the connection. If I send data and never read back, it won't timeout. I am using windows server and client and I use fsockopen,fread,fputs functions for php. I even try using fputs with data length to make sure that it knows how much to send,but no success. According to my java output, it can read data immediately, but it even does not execute system.out which is just before call to socket write function. Is that Java problem or php problem?
View Replies !
Socket Opening Error
I'm opening a socket to a web server on port 80 located on my LAN with fsockopen. The socket creation fails and PHP returns "php_network_getaddresses: getaddrinfo failed: Name or service not known" But, a connection to the same web server through a browser works.
View Replies !
2 MySQL : How Does PHP Can Use The Good Socket ?
I've 2 instances of apache 1.3.27 with php 4.2.3 and mysql 3.23.42 running on the same server. The 1st apache listens the port number 80 and communicates with the 1st mysql with the socket /var/mysql/mysql1.sock (i've also defined the port 3306) The 2nd apache listens the port number 8080 and communicates with the 2nd mysql with the socket /var/mysql/mysql2.sock (i've also defined the port 3366) I've only one "bin" of apache (then of couse one php.ini). So, I start the 2 instances of apache with 2 apachectl (apachectl1 and apachectl2) linked to 2 httpd.conf (httpd1.conf and httpd2.conf) in httpd1.conf, I use : <IfModule mod_php4.c> php_admin_value mysql.default_socket /var/mysql/mysql1.sock php_admin_value mysql.default_host 127.0.0.1 php_admin_value mysql.default_port 3306 </IfModule> in httpd2.conf, I use : <IfModule mod_php4.c> php_admin_value mysql.default_socket /var/mysql/mysql2.sock php_admin_value mysql.default_host 127.0.0.1 php_admin_value mysql.default_port 3366 </IfModule> when I'm connecting, on each apache, a mysql_connect with "IP and user and password (without mysql's port)" : The connexion is succeded and the good mysql is well reached ! when I'm connecting, on each apache, a mysql_connect with "127.0.0.1 and user and password (without mysql's port)" : The connexion is succeded, the good mysql is well reached ! BUT : when I'm connecting, on each apache, a mysql_connect with "localhost and user and password (without mysql's port)" : The connexion is failed ! when I'm connecting, on each apache, a mysql_connect with "user and password (without mysql's host and port)" : The connexion is failed ! I think in the 2 last cases, it's a problen of socket. When I run the "php info" : mysql.default_socket is set with the good value !
View Replies !
Php3 Socket Connection
For some reason, I cannot read until the end of the data on a socket.. the feof() in the following code just hangs forever.. - i want it to return all the text until the socket is empty, but nothing comes back! function ftpcon($Hostname,$Username,$Password,$Directory) { $fp = fsockopen($Hostname, 110); while(!feof($fp)) { echo fgets($fp,128);} fclose($fp); exit;}
View Replies !
|