php-general Digest 25 May 2005 11:26:20 -0000 Issue 3474
Topics (messages 215804 through 215818):
mysql connect problem
215804 by: Jim & Sara Feldman
215807 by: Richard Lynch
215817 by: Burhan Khalid
Re: Very long delay posting to php-general (might be OT)
215805 by: Marek Kilimajer
215806 by: Richard Lynch
215818 by: Marek Kilimajer
Re: db aware text editor? (slightly OT?)
215808 by: Richard Lynch
215815 by: Burhan Khalid
further detail on mysql connect problem
215809 by: Jim & Sara Feldman
215813 by: Richard Lynch
Re: __get() not reentrant?
215810 by: Richard Lynch
Re: strtotime('yesterday')
215811 by: Richard Lynch
215814 by: Burhan Khalid
cybercash as a shared object
215812 by: Bill Shupp
215816 by: Bill Shupp
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[email protected]
----------------------------------------------------------------------
--- Begin Message ---
Hi:
I have recently upgraded from a Mac G4 running OS 10.3.9 to a
G5 running OS 10.4. I ported a working PHP app and upgraded from PHP
4.3.4 to 4.3.10 and MySQL 4.0.17 to 4.1.11. I am having a problem
connecting to MySQL from PHP.
I can connect to the database using either phpMyADMIN or
directly from terminal mode using MySQL commands. However, when I try
to enter the database from php, using
$result = mysql_pconnect("localhost", "api_user", "97533");
I get $result = FALSE. This command works on the old system as does
the MySQL command:
mysql -u api_user -p
I am using the identical php.ini on the new and old machines. Any
help in getting over this hurdle would be appreciated.
Jim
--
Jim Feldman
14 Linda Lane
Newton, MA 02461
617-527-0509
--- End Message ---
--- Begin Message ---
On Tue, May 24, 2005 2:14 pm, Jim & Sara Feldman said:
> $result = mysql_pconnect("localhost", "api_user", "97533");
if (!$result) die(mysql_error());
Try it without the 'p' in pconnect, which you probably aren't using in the
other connections in your testing.
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
Jim & Sara Feldman wrote:
Hi:
I have recently upgraded from a Mac G4 running OS 10.3.9 to a G5
running OS 10.4. I ported a working PHP app and upgraded from PHP 4.3.4
to 4.3.10 and MySQL 4.0.17 to 4.1.11. I am having a problem connecting
to MySQL from PHP.
I can connect to the database using either phpMyADMIN or directly
from terminal mode using MySQL commands. However, when I try to enter
the database from php, using
$result = mysql_pconnect("localhost", "api_user", "97533");
I get $result = FALSE. This command works on the old system as does the
MySQL command:
Jim :
The problem here is that with MySQL 4.1.xx -- MySQL changed the way
that passwords should be connect by clients to the server. PHP 4.3.10
is still using the old client libraries of MySQL, which do not
understand the new password schemes.
The command line client (mysql) works because its using the new
libraries that came with MySQL 4.1.11.
You have two options. You can either upgrade to PHP5 and use the
mysqli_* functions -- or you can restart MySQL with the --old-passwords
switch which will allow it to accept connections from older clients.
See http://php.net/mysqli and
http://dev.mysql.com/doc/mysql/en/old-client.html for more information.
Warmly,
Burhan
--- End Message ---
--- Begin Message ---
Andy Pieters wrote:
Hi all
I was wondering if it is normal that when posting to the php-general list
there is always a very long delay before messages are shown.
It's not like with snail mail. Sending mail messages is instant so where is
the delay?
I think John Nichel took over the job of filtering the list of spam :)
--- End Message ---
--- Begin Message ---
On Tue, May 24, 2005 3:32 pm, Marek Kilimajer said:
> Andy Pieters wrote:
>> Hi all
>>
>> I was wondering if it is normal that when posting to the php-general
>> list
>> there is always a very long delay before messages are shown.
>>
>> It's not like with snail mail. Sending mail messages is instant so
>> where is
>> the delay?
>
> I think John Nichel took over the job of filtering the list of spam :)
I don't think that happened (at least not yet...)
But things to consider:
There must be some kind of automated spam-filtering going on. Or we'd be
awash in spam.
PHP's servers are donated, and the load must be enormous.
It's not *THAT* bad a lag -- It's a mailing list, for Pete's sake.
Posts are gatewayed to/from the newsgroup. That might introduce some
inherent lag as duplicates are culled or something...
I don't know WHY posts take hours to get through, but I'm not honestly
seeing it as a "problem" personally.
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
Richard Lynch wrote:
On Tue, May 24, 2005 3:32 pm, Marek Kilimajer said:
Andy Pieters wrote:
Hi all
I was wondering if it is normal that when posting to the php-general
list
there is always a very long delay before messages are shown.
It's not like with snail mail. Sending mail messages is instant so
where is
the delay?
I think John Nichel took over the job of filtering the list of spam :)
I don't know WHY posts take hours to get through, but I'm not honestly
seeing it as a "problem" personally.
I see one problem, some questions get the same answer from several
people. This increases the list traffic without any benefit.
--- End Message ---
--- Begin Message ---
On Tue, May 24, 2005 2:08 pm, Murray @ PlanetThoughtful said:
> I'm wondering if anyone knows of a 'db aware' text editor? By 'db aware',
> I
> mean one that can pull a recordset back from a local MySQL server and edit
> the content of fields much like a standard text editor does with files.
You've probably used phpMyAdmin, which has some of the features you ask
for, though it's web-based and not text based...
You *MIGHT* be able to built a new UI on top of phpMyAdmin easier than,
say, a plug-in for vi or emacs to do what you want...
Maybe not.
Just an idea to ponder.
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
Richard Lynch wrote:
On Tue, May 24, 2005 2:08 pm, Murray @ PlanetThoughtful said:
I'm wondering if anyone knows of a 'db aware' text editor? By 'db aware',
I
mean one that can pull a recordset back from a local MySQL server and edit
the content of fields much like a standard text editor does with files.
Zend Studio 4+ does this.
--- End Message ---
--- Begin Message ---
Hi:
Adding a detail to my previous note on the mysql connect problem:
At the point where I attempted to connect, I added a printout of the
error generated when the instruction ran. The two lines now read:
$result = mysql_pconnect("localhost", "api_user", "x97533");
echo "Tried to connect. Problem: ".mysql_error()." <br>";
What came back was:
Tried to connect. Problem: Client does not support authentication
protocol requested by server; consider upgrading MySQL client
Thanks for your help.
Jim
--
Jim Feldman
14 Linda Lane
Newton, MA 02461
617-527-0509
--- End Message ---
--- Begin Message ---
Google for that error message.
We just discussed it days ago...
I forget what it was, but the answer's in the archives.
On Tue, May 24, 2005 5:15 pm, Jim & Sara Feldman said:
> Hi:
>
> Adding a detail to my previous note on the mysql connect problem:
>
> At the point where I attempted to connect, I added a printout of the
> error generated when the instruction ran. The two lines now read:
>
> $result = mysql_pconnect("localhost", "api_user", "x97533");
> echo "Tried to connect. Problem: ".mysql_error()." <br>";
>
> What came back was:
>
> Tried to connect. Problem: Client does not support authentication
> protocol requested by server; consider upgrading MySQL client
>
> Thanks for your help.
>
> Jim
> --
> Jim Feldman
> 14 Linda Lane
> Newton, MA 02461
>
> 617-527-0509
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
On Tue, May 24, 2005 8:25 am, Christopher J. Bottaro said:
>> I think Richard is a fairly intelligent person, if he had been insulting
>> you I'm quite sure that he would have done a much better job ;-)
Oh yeah. :-)
> Thats great, I'm sure he's the reigning "cut down contest" champ on this
> list. I don't care. Like I said, I don't like being talked down to. I
> found it very unnecessarily presumptuous of him to say stuff like "without
> knowing anything about you, I assume you have made bad design decisions,
> painted yourself in a corner, etc". What the hell does any of that have
> to
> do with the discussion?
That may be what you read. It's certainly not what I typed.
I saw two possibilities:
1. You had written something really elegant where you needed __get() to be
recursive for a really good reason.
2. You, well, didn't...
I don't know you from Adam.
I said that it was MORE LIKELY that #2 applied, not knowing anything about
you.
Now, however, you have declared that you *DO* know what you are doing, so
I will cheerfully retract #2.
Happy?
>> php isn't perfect, neither are you - find a balance, get over it.
>
> Sigh. PHP's motto: "Get over it, we oppose change." (According to you
> and
> Richard).
Another gross mis-representation of our theses...
I believe I shall simply cease responding to Mr. Bottaro.
> You're right, all those "cookbooks" are stupid.
Actually, a lot of those "cookbooks" are kinda stupid...
They show you how to do nifty things, but they don't really explain when
they should be applied, or more importantly, when not to apply them...
And a lot of software developers, NOT INCLUDING Mr. Battaro, who use those
cookbooks never really figure they out -- They apply the latest cool
cookbook technique they have mastered whether it's a better fit to the
problem than something from CS 101 or not.
>>> Speaking of "good design", Python's __getattr__() behaves how I expect.
>>
>> use it then?
>
> I would if I could, but I can't. Besides, PHP is pretty fun/easy to
> program
> with, I'd say its my 2nd favorite language right now. Again, I don't see
> whats wrong with trying to get fixed what I think is wrong.
Nothing wrong with that ; As noted, your post isn't going to the right
list, nor had the right tone/content to achieve that goal.
If you wanna re-write PHP, go to PHP-Dev.
> OK, all the subtle stabs at each other (and yes, they are subtle) aside,
> you
> brought up some good points about __get()'s behavior if it's implicit
> invocation allowed for recursion. Thats all I really wanted, thanks for
> that.
You may be giving us more credit for subtlety than we deserve :-)
"Sometimes a cigar is just a cigar."
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
On Tue, May 24, 2005 7:24 am, Rahul S. Johari said:
> I�m trying to delete all files in a folder based on a string match with
> the
> following code:
>
> <?
> $dir = '/Library/WebServer/Documents/something.com/subfolder/';
> $dp = opendir($dir) or die ('Fatal Error: '.mysql_error());
> while ($file = readdir($dp)) {
> if ((eregi('.png',$file)) && (filemtime($dir.$file)) <
> (strtotime('yesterday'))) {
> unlink($dir.$file);
> }
> }
> closedir($dp);
> $yesterday = mktime( 0, 0, 0, date("m") , date("d")-1, date("Y") );
> $date = date( "m-d-y, D", $yesterday );
> echo "<B>Erase Successful!</B><br>All images up to $date, have been
> permanently erased from the Server.";
> ?>
>
> I need the code to delete all images created till yesterday, and leave
> images created today. Somehow strtotime(�yesterday�) doesn�t work.
> If I put strtotime(�-2 days�) or strtotime(�-7 days�) or even
> strtotime(�8:00am�)... They all work accordingly. How come (�yesterday�)
> isn�t working? It doesn�t delete anything.
Maybe strtotime('-1 day') would work. [shrug]
You could also use http://php.net/mktime
mktime(date('m'), -1); //This should be 24 hours before 'now', I think...
Or maybe mktime(date('m'), date('d) -1);
Whichever it is, PHP's mktime does the right thing even if you use, like:
mktime(6, 0); //This is really May 31st, not June 0. PHP knows.
--
Like Music?
http://l-i-e.com/artists.htm
--- End Message ---
--- Begin Message ---
Richard Lynch wrote:
On Tue, May 24, 2005 7:24 am, Rahul S. Johari said:
I¹m trying to delete all files in a folder based on a string match with
the
following code:
<?
$dir = '/Library/WebServer/Documents/something.com/subfolder/';
$dp = opendir($dir) or die ('Fatal Error: '.mysql_error());
while ($file = readdir($dp)) {
if ((eregi('.png',$file)) && (filemtime($dir.$file)) <
(strtotime('yesterday'))) {
unlink($dir.$file);
}
}
closedir($dp);
$yesterday = mktime( 0, 0, 0, date("m") , date("d")-1, date("Y") );
$date = date( "m-d-y, D", $yesterday );
echo "<B>Erase Successful!</B><br>All images up to $date, have been
permanently erased from the Server.";
?>
I need the code to delete all images created till yesterday, and leave
images created today. Somehow strtotime(Œyesterday¹) doesn¹t work.
If I put strtotime(Œ-2 days¹) or strtotime(Œ-7 days¹) or even
strtotime(Œ8:00am¹)... They all work accordingly. How come (Œyesterday¹)
isn¹t working? It doesn¹t delete anything.
[EMAIL PROTECTED] burhan $ php -r "echo date('r',strtotime('-1 day'));"
Tue, 24 May 2005 09:00:35 +0300
[EMAIL PROTECTED] burhan $ date
Wed May 25 09:02:10 AST 2005
:)
--- End Message ---
--- Begin Message ---
I need to install the cybercash module on a Debian Sarge system. I
really want to keep Debian's PHP packages, and just build this as a
shared module. At least one post in the archives indicates that this is
possible, as does one changelog entry. However, no specifics were offered.
Here's what I've tried:
I can build the module fine statically.
I can build the shared module cybercash.so by modifying the
ext/cybercash/config.m4 and Makefile files, modeling them after the
mcrypt.so entries. While modules/cybercash.so does get built, I get
this error when trying to load it:
PHP Warning: Unknown(): Invalid library (maybe not a PHP library)
'cybercash.so' in Unknown on line 0
I'm building with PHP 4.3.10, and the latest cybercash from PECL. I've
also tried the cybercash module from 4.2.3, as suggested in one of the
online manual comments.
Any guidance would be greatly appreciated!
Regards,
Bill Shupp
--- End Message ---
--- Begin Message ---
Blair Lowe wrote:
Wow can cybercash.so be compiled with the newer glibc libraries?
It compiles, but I can't load it. See my previous post.
Is there source code for the old cybercash stuff?
Per my previous message, the cybercash extension is available in PECL.
I already had access to the MCK libraries, though. There's lots of
stuff about this on Google.
The only thing I ever had was a binary, and when Verisign bought out
cybercash, the stuff went obsolete on me.
Lots of people still run the PHP cybercash module, but use it
statically. I'm trying to get it to run as a shared module.
Regards,
Bill
--- End Message ---