Re: [PHP] PHP/MySQL not playing nicely. Server drops connection.
On Sep 3, 2007, at 11:12 AM, Michael Williams wrote: Are you sure that Apache is running and accepting connections to / ~michwill? Does a regular HTML page show up ok? Yeah, static pages, and regular php pages load fine. It's only when I bring MySQL into the mix that things go awry. Have you checked the server error log? If by "server" you mean Apache or PHP specifically, then yes. There is nothing telling there. What does your script look like where it connects? Does it simply die() without a message? Try creating a test script with header ('Content-type: text/plain') at the top. Then print out messages after each step. (beginning of script, opening a DB connection, etc.) It literally dies with what I posted: Safari can’t open the page “http://localhost/~michwill/mysqltest.php” because the server unexpectedly dropped the connection, which sometimes occurs when the server is busy. You might be able to open the page later. Oddly enough, when I use MAMP, instead of the source install, this doesn't occur. How are you accessing the database? I've stripped the PHP script to simply read as follows: $connection_error = "We apologize for the inconvenience, but it appears that our database server is down."; $connection_error .= "Please try again later."; $host = "localhost"; $user = "michael"; $db_pass = "michael"; $connect = mysql_connect($host,$user,$db_pass) or die ($connection_error . mysql_error()); ?> . . .the error is no different, and it doesn't output anything that is "echo"ed. I've ensured that all permissions are in place with the MySQL database as well. I can manually log in just fine. I'm at a loss. Regards, Michael
[PHP] Re: php-general Digest 31 Aug 2007 16:34:36 -0000 Issue 4992
Are you sure that Apache is running and accepting connections to / ~michwill? Does a regular HTML page show up ok? Yeah, static pages, and regular php pages load fine. It's only when I bring MySQL into the mix that things go awry. Have you checked the server error log? If by "server" you mean Apache or PHP specifically, then yes. There is nothing telling there. What does your script look like where it connects? Does it simply die() without a message? Try creating a test script with header ('Content-type: text/plain') at the top. Then print out messages after each step. (beginning of script, opening a DB connection, etc.) It literally dies with what I posted: Safari can’t open the page “http://localhost/~michwill/mysqltest.php” because the server unexpectedly dropped the connection, which sometimes occurs when the server is busy. You might be able to open the page later. Oddly enough, when I use MAMP, instead of the source install, this doesn't occur. How are you accessing the database? I've stripped the PHP script to simply read as follows: $connection_error = "We apologize for the inconvenience, but it appears that our database server is down."; $connection_error .= "Please try again later."; $host = "localhost"; $user = "michael"; $db_pass = "michael"; $connect = mysql_connect($host,$user,$db_pass) or die ($connection_error . mysql_error()); ?> . . .the error is no different, and it doesn't output anything that is "echo"ed. I've ensured that all permissions are in place with the MySQL database as well. I can manually log in just fine. I'm at a loss. Regards, Michael
[PHP] PHP/MySQL not playing nicely. Server drops connection. . .
Hi All, I recently installed PHP, APACHE, MYSQL per the method at the following site: http://switch.richard5.net/isp-in-a-box-v2/installing-mysql-on-mac-os-x/ . . .I then attempted to connect to a database (but without executing any commands on it), and I keep receiving the following error: Safari can’t open the page “http://localhost/~michwill/folder/ validate_event.php” because the server unexpectedly dropped the connection, which sometimes occurs when the server is busy. You might be able to open the page later. I'm really not sure what the problem is or what to do about it. Can anyone help? I've ensured that all passwords and ports are correct. I've also tried using MAMP, but it keeps telling me that I can't access the database with the "connect" commands I'm using (although I've adjusted them. Anyway, any help would be much appreciated. Regards, Michael
[PHP] Session generating same "Captchas"
Hi All, I'm having a problem using Captchas. Basically I'm using Joshua Houle's script to generate Captchas. However, I get different behaviors on different systems. On one system I can simply refresh the page and a different Captcha is generated each time. However, on another system, a refresh simply makes it generate the exact same Capthca with a different visible length. For instance, it will always generate length-wise variants "UPGR5MB". . ."UPGR". . ."UPGR5M". . ."UPG". . ."UPGR5". The only way it will change is if I quit my browser and open another. Also, despite the code directive, it always generates a string length of about 20 characters despite the code explicitly stating a random length between 4 and 7. One interesting note, however, is that it does change the color and position of the letters upon refresh. I would assume that part of the problem would be with $_SESSION, as when I "unset" it, new Captchas are generated. This, however, is unacceptable as I need certain $_SESSION variables later. Currently I'm using the following to solve the 20 character length issue: $_SESSION['captchastr'] = substr($captchastr,0,$strlength); // $strlength being the $strlength used to generate the length of $captchastr at the beginning of the script instead of the default code. Any ideas regarding what the differences between servers could be would certainly be appreciated. Regards, Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] libcurl (cookies across cURL session). . .?
Tom, I tried writing to a local file(./cache/cookiejar), but to no avail. I'll give /tmp a try to see if that location makes any difference. Permissions aside, I should be able to write where I wish, correct? Thanks, Mike On Sep 23, 2006, at 7:43 AM, [EMAIL PROTECTED] wrote: From: Tom Atkinson <[EMAIL PROTECTED]> Date: September 23, 2006 7:42:32 AM EDT To: php-general@lists.php.net Subject: Re: [PHP] libcurl (cookies across cURL session). . .? Use cURL's own cookie handling features. curl_setopt($ch, CURLOPT_COOKIEJAR, '/tmp/cookies.txt'); curl_setopt($ch, CURLOPT_COOKIEFILE, '/tmp/cookies.txt'); That will store the cookies in the file and read them from there next time. /tmp may or may not be a suitable location.
Re: [PHP] libcurl (cookies across cURL session). . .?
Robert, Thanks. The thing is that lots of cookies are set regularly. Are you suggesting that every time I receive a "Set-Cookie:" to 1)parse that line out 2)append it to a file 3) retrieve it when necessary? I'm not terribly familiar with the proper format for a cookie, but I'll look into it. I'd appreciate *any* insights you have. Regards, Mike On Sep 23, 2006, at 2:28 AM, Robert Cummings wrote: On Sat, 2006-09-23 at 02:10 -0400, Michael Williams wrote: Hi all, Is there any way at all by which to persist cookies across cURL sessions? Basically I have a login page that sets cookies and looks for them for "logged in" status so that the user may use the site to their heart's content. The problem with cURL, however, appears that after the initial login, any further attempts are foiled by the fact that the cookies don't remain. How exactly should I go about doing this? You should be able to retrieve the cookies from the response headers. Then you just need to resend them. There may be an option for cURL to do this automatically. Search for cookie at the following link (check the user comments also): http://ca.php.net/manual/en/ref.curl.php Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] libcurl (cookies across cURL session). . .?
Hi all, Is there any way at all by which to persist cookies across cURL sessions? Basically I have a login page that sets cookies and looks for them for "logged in" status so that the user may use the site to their heart's content. The problem with cURL, however, appears that after the initial login, any further attempts are foiled by the fact that the cookies don't remain. How exactly should I go about doing this? Thanks, Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] DOM Question. No pun intended.
Hi All, I'm having HTML DOM troubles. Is there any way to output the *EXACT* code contained in a node (child nodes and all)? For instance, I perform a $doc->loadHTML($file) and all is well. I then search through the document for specific NODEs with getElementsByTagName(). However, when I go to output the data from that node (say a specific DIV) I simply get the text without formatting and the like. Basically, I want the retrieved NODE to echo exactly what is contained. If the div looks like the following: stuff . . .I want it to give me exactly that when I do a NODE->textContent or NODE->nodeValue. I don't want just the text, I want all tags contained, etc. It would be nice to have DOMNode->saveHTML() similar to the DOMDocument->saveHTML(). FYI, I'm using the technique to "screen scrape" portions of other pages from my site and compile items for a quick fix. Fortunately all my DIVs have IDs and I can loop through and find them by that attribute's value. I just can't output their EXACT data once I have them. :-\ Thanks!