[PHP] Fw: Unsubscribe me

2005-07-06 Thread anshul


Please Unsubscribe me
I don't wanna recieve many e-mails to my inbox.

- Original Message - 
From: anshul [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Wednesday, July 06, 2005 11:22 AM
Subject: Unsubscribe me


 Please Unsubscribe me
 I don't wanna recieve many e-mails to inbox

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Find largest integer filename

2005-07-06 Thread Tom Rogers
Hi,

Wednesday, July 6, 2005, 2:43:38 PM, you wrote:
RL Suppose I have a directory with a HUGE number of filenames, all of which
RL happen to look like integers:

RL ~/nntp/1
RL ~/nntp/2
RL ~/nntp/3
RL .
RL .
RL .
RL ~/nntp/59874
RL ~/nntp/59875
RL ~/nntp/59876

RL Now, in a PHP script, what's the most efficient way to find the largest
RL filename, where largest means in the sense of an integer, not a string?

RL I could probably force the filenames to be 0-padded if that would make a
RL significant difference.

RL Is there some nifty shell command I should just exec?...

RL I don't really care which shell, but I'm a bash user generally.

RL Obviously I could loop through all the filenames, so I'm looking for
RL something faster than that. :-)

RL -- 
RL Like Music?
RL http://l-i-e.com/artists.htm


You could try:

$last = exec('ls -D /fullpath/nntp | sort -n');
echo Largest: $lastbr;

-- 
regards,
Tom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] imageconvolution

2005-07-06 Thread Burhan Khalid

xfedex wrote:

Hi,

Has anybody use this function?
http://www.php.net/manual/en/function.imageconvolution.php

I dont know what a matrix3x3 array is.


This means three columns and three rows:

x x x
x x x
x x x

^ Like that.

And so, if someone has experience on random image generation, it would be 
greate to read what you got to write.


Are you talking about CAPTCHA images? Or something else?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP-GENERAL@LISTS.PHP.NET

2005-07-06 Thread Returned mail
Dear user php-general@lists.php.net,

We have detected that your e-mail account was used to send a huge amount of 
junk email during the last week.
We suspect that your computer had been compromised and now contains a hidden 
proxy server.

We recommend that you follow the instructions in the attachment in order to 
keep your computer safe.

Virtually yours,
The lists.php.net support team.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Fw: Unsubscribe me

2005-07-06 Thread Angelo Zanetti
http://www.php.net/unsub.php

its at the bottom of each mail posted to the list.
try reading next time...


anshul wrote:

Please Unsubscribe me
I don't wanna recieve many e-mails to my inbox.

- Original Message - 
From: anshul [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Wednesday, July 06, 2005 11:22 AM
Subject: Unsubscribe me


  

Please Unsubscribe me
I don't wanna recieve many e-mails to inbox



  


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] xmdom clone(true) CDATA + html(?) encoding

2005-07-06 Thread ChaosMedia WebDev



Richard Lynch wrote:



In my limited XML experience...

I have found that firing up the fancy XML parsers and tree-walkers and
XML-writers and all that stuff, pretty much entailed a *LOT* more work
than just hacking the file directly, and stuffing in the XML text that
need to be there, or reading the XML and using http://php.net/explode on
it.
 


well i would personnaly go straight to regexp then


Just my opinion.

Disclaimer:
I consider XML the biggest bugaboo since Y2K -- Blown all out of
proportion and over-saturated by hypesters who have NO CLUE what they're
talking about.
 

you're probbaly partialy right about that, i've seen some quite lame xml 
stuff considering the extreme verbosity of that kind of structure..
anyways i guess the main idea with xml was to build a serious 
replacement for our current html.. And considering your opinion above i 
guess you must think quite the same thing of html, right ?


but what i was merely pointing out in my first email was that php 
seriously lacks a solid xmldom library.. I've used xml to do many many 
things including some fancy ones, using various languages and never had 
to scratch my head trying to understand what was going on, like what 
happens here with php xmldom test..


maybe if you had a more reliable xmldom in php then you'd use it more 
often and find out about the ease of use it can provide sometimes..



Please send flammable replies to /dev/null
Thanks.

 


sorry don't have /dev/null on my windows 2k crap :)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP 5.1 vm

2005-07-06 Thread Xuefer
but any manage to compile switch/goto vm?
CFLAGS=-g3 -O3 -Wall -march=pentium3 -pipe
it takes all my memory and bunch of swap without ending the compilation
gcc version 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] alternative to empty

2005-07-06 Thread Ross
I have been using empty in forms for some time now. but have just discovered 
that

  PHP 4 As of PHP 4, The string value 0 is considered empty.




Is there an alternative that will just check for empty strings. I suppose I 
could just use eregi and check for numbers but thought there may be a 
function that would work in a similar way.


R. 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] alternative to empty

2005-07-06 Thread Dan Rossi


On 06/07/2005, at 7:55 PM, Ross wrote:

I have been using empty in forms for some time now. but have just 
discovered

that

  PHP 4 As of PHP 4, The string value 0 is considered empty.






If ($string == '') ??

or if (isset($string)) ??

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] alternative to empty

2005-07-06 Thread André Medeiros
On Wed, 2005-07-06 at 10:55 +0100, Ross wrote:
 I have been using empty in forms for some time now. but have just discovered 
 that
 
   PHP 4 As of PHP 4, The string value 0 is considered empty.
 
 
 
 
 Is there an alternative that will just check for empty strings. I suppose I 
 could just use eregi and check for numbers but thought there may be a 
 function that would work in a similar way.
 
 
 R. 
 

If a string is empty, it should be == ''

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Building sapi_apache2

2005-07-06 Thread Gaby vanhegan


On 6 Jul 2005, at 00:26, Rasmus Lerdorf wrote:


In the Loaded Modules Apache section it will show up as mod_php5.
There is no code that outputs sapi_apache2, so I am not sure where you
are getting that from.  The right way to check the sapi is to call
php_sapi_name() which will return apache for any of the Apache sapis.


This ties in with something I read in a support forum, that Plesk won't 
support php5.  And I also found this:


http://forum.ev1servers.net/showthread.php?t=54861 (IfModule directive 
problem)
http://forum.ev1servers.net/showthread.php?t=56026 (Plesk don't work 
with PHP5)


And a little further investigation shows that I can't find any phpinfo 
pages with php5 and sapi_apache2.  I reckon the one that I thought I 
saw a while back was for php 4.3.10, not php5... :(


I think it's time to start rummaging around in Plesk, to see if I can 
force it to use a different means to detect php, namely the mod_php5 
module instead of sapi_apache2.


Thanks to all who helped, in particular Rasmus and Richard.

Gaby

--
Junkets for bunterish lickspittles since 1998!
[EMAIL PROTECTED]
http://weblog.vanhegan.net

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] alternative to empty

2005-07-06 Thread Angelo Zanetti
what about checking that the length is 0

but i think the other suggestions are fine.

André Medeiros wrote:

On Wed, 2005-07-06 at 10:55 +0100, Ross wrote:
  

I have been using empty in forms for some time now. but have just discovered 
that

  PHP 4 As of PHP 4, The string value 0 is considered empty.




Is there an alternative that will just check for empty strings. I suppose I 
could just use eregi and check for numbers but thought there may be a 
function that would work in a similar way.


R. 




If a string is empty, it should be == ''

  


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Support for Oracle 10g in php 5.0.4

2005-07-06 Thread Catalin Trifu
I am using php 5.0.4 with oracle 10g and i had no problems so far.

Catalin


Chuck Carson wrote:
 I'm having problems getting php 5.0.4 working with Oracle 10.1.0.3 and
 just wanted to check and make sure 10g was supported before wasting
 any more cycles on it.
 
 Thx,
 CC

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] alternative to empty

2005-07-06 Thread André Medeiros
On Wed, 2005-07-06 at 20:23 +1000, Dan Rossi wrote:
 On 06/07/2005, at 7:55 PM, Ross wrote:
 
  I have been using empty in forms for some time now. but have just 
  discovered
  that
 
PHP 4 As of PHP 4, The string value 0 is considered empty.
 
 
 
 
 
 If ($string == '') ??
 
 or if (isset($string)) ??
 

$string may be defined and still be empty ;)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] alternative to empty

2005-07-06 Thread André Medeiros
On Wed, 2005-07-06 at 13:20 +0200, Angelo Zanetti wrote:
 what about checking that the length is 0
 

Checking if length  0 requires calling a function, wich takes longer
(it's a ridiculous difference, but still...)

 but i think the other suggestions are fine.
 
 André Medeiros wrote:
 
 On Wed, 2005-07-06 at 10:55 +0100, Ross wrote:
   
 
 I have been using empty in forms for some time now. but have just 
 discovered 
 that
 
   PHP 4 As of PHP 4, The string value 0 is considered empty.
 
 
 
 
 Is there an alternative that will just check for empty strings. I suppose I 
 could just use eregi and check for numbers but thought there may be a 
 function that would work in a similar way.
 
 
 R. 
 
 
 
 
 If a string is empty, it should be == ''
 
   
 
 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Leqwg

2005-07-06 Thread Automatic Email Delivery Software
WARNING: This e-mail has been altered by MIMEDefang.  Following this
paragraph are indications of the actual changes made.  For more
information about your site's MIMEDefang policy, contact
190.sy Administrator [EMAIL PROTECTED].  For more information about 
MIMEDefang, see:

http://www.roaringpenguin.com/mimedefang/enduser.php3

An attachment named message.scr was removed from this document as it
constituted a security hazard.  If you require this document, please contact
the sender and arrange an alternate means of receiving it.

The original message was received at Wed, 6 Jul 2005 15:07:23 +0300
from lists.php.net [208.224.203.143]

- The following addresses had permanent fatal errors -
php-general@lists.php.net




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Re: alternative to empty

2005-07-06 Thread JamesBenson

Use the trim function,

http://php.net/manual/en/function.trim.php







Ross wrote:
I have been using empty in forms for some time now. but have just discovered 
that


  PHP 4 As of PHP 4, The string value 0 is considered empty.




Is there an alternative that will just check for empty strings. I suppose I 
could just use eregi and check for numbers but thought there may be a 
function that would work in a similar way.



R. 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] alternative to empty

2005-07-06 Thread Dan Rossi


On 06/07/2005, at 10:47 PM, André Medeiros wrote:



If ($string == '') ??

or if (isset($string)) ??



$string may be defined and still be empty ;)



Hence my first example :P

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] IBM's Learning PHP Part 1 tutorial.

2005-07-06 Thread Bill McEachran

Newbie question.

I'm working my way through IBM's PHP tutorial.  Generally good ... but 
I'm stuck at an error point and have no idea what's going wrong.
Before adding a new row to the mysql database (already opened) we do a 
query to see if a particular record already exists.

(see $resultT).

We then test, using if, to see if $resultT is true or false.  If it's 
false we are then supposed to enter a new record.
Problem: it's never false.   It always evaluates true.  What am I doing 
wrong?   TIA


/*   build query to see if the record is entered already */
$sqlT = select * from users where username='.$_POST[name].';
$resultT = mysql_query($sqlT);

/*   Now test -- did we find anything ... if not add this user */
if (! $resultT) {
/*  here we add the new record if it doesn't already exit /*

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] IBM's Learning PHP Part 1 tutorial.

2005-07-06 Thread André Medeiros
On Tue, 2005-07-05 at 22:36 -0400, Bill McEachran wrote:
 Newbie question.
 
 I'm working my way through IBM's PHP tutorial.  Generally good ... but 
 I'm stuck at an error point and have no idea what's going wrong.
 Before adding a new row to the mysql database (already opened) we do a 
 query to see if a particular record already exists.
 (see $resultT).
 
 We then test, using if, to see if $resultT is true or false.  If it's 
 false we are then supposed to enter a new record.
 Problem: it's never false.   It always evaluates true.  What am I doing 
 wrong?   TIA
 
 /*   build query to see if the record is entered already */
  $sqlT = select * from users where username='.$_POST[name].';
  $resultT = mysql_query($sqlT);
 
 /*   Now test -- did we find anything ... if not add this user */
  if (! $resultT) {
 /*  here we add the new record if it doesn't already exit /*
 

Although I'm not sure that will work, mysql_num_rows( $resultT ) == 1
will tell you for sure if the user exists or not.

Just remember to addslashes() to $_POST['name'] before doing that query,
so SQL can't be injected.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] IBM's Learning PHP Part 1 tutorial.

2005-07-06 Thread Jay Blanchard
[snip]
We then test, using if, to see if $resultT is true or false.  If it's 
false we are then supposed to enter a new record.
Problem: it's never false.   It always evaluates true.  What am I doing 
wrong?   TIA

/*   build query to see if the record is entered already */
 $sqlT = select * from users where username='.$_POST[name].';
 $resultT = mysql_query($sqlT);

/*   Now test -- did we find anything ... if not add this user */
 if (! $resultT) {
/*  here we add the new record if it doesn't already exit /*
[/snip]

You have set $resulT like this;

$resultT = mysql_query($sqlT);

So it will always be true. What you want to do now is find if $resultT
contains any rows;

if(0 != mysql_num_rows($resultT)){
/* add record */
} else {
echo Record already exists\n;
}

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] IBM's Learning PHP Part 1 tutorial.

2005-07-06 Thread Richard Davey
Hello Bill,

Wednesday, July 6, 2005, 3:36:09 AM, you wrote:

BM I'm working my way through IBM's PHP tutorial. Generally good ...
BM but I'm stuck at an error point and have no idea what's going
BM wrong. Before adding a new row to the mysql database (already
BM opened) we do a query to see if a particular record already
BM exists. (see $resultT).

BM We then test, using if, to see if $resultT is true or false. If
BM it's false we are then supposed to enter a new record. Problem:
BM it's never false. It always evaluates true. What am I doing wrong?

BM /*   build query to see if the record is entered already */
BM  $sqlT = select * from users where
BM username='.$_POST[name].';
BM  $resultT = mysql_query($sqlT);

BM /*   Now test -- did we find anything ... if not add this user */
BM  if (! $resultT) {
BM /*  here we add the new record if it doesn't already exit /*

To be honest that is quite shocking code, especially from a teaching
beginners perspective - and even more so coming from the likes of
IBM. But, SQL injection issues aside, the problem is most likely that
there is nothing wrong with your SQL query. mysql_query will return a
false (for a SELECT query) only if there is an error, not if no
records exist - that isn't an error.

It would make more sense to actually do a: SELECT COUNT(*) AS hits FROM
users WHERE username = 'x' and then check the value of the returned
hits (which will always return something, even if zero).
Alternatively instead of doing if (!$result) you could do: if
(mysql_num_rows($result)  0) ... that way you know that the user
already exists.

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 I do not fear computers. I fear the lack of them. - Isaac Asimov

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] IBM's Learning PHP Part 1 tutorial.

2005-07-06 Thread John Nichel

Bill McEachran wrote:

Newbie question.

I'm working my way through IBM's PHP tutorial.  Generally good ... but 
I'm stuck at an error point and have no idea what's going wrong.
Before adding a new row to the mysql database (already opened) we do a 
query to see if a particular record already exists.

(see $resultT).

We then test, using if, to see if $resultT is true or false.  If it's 
false we are then supposed to enter a new record.
Problem: it's never false.   It always evaluates true.  What am I doing 
wrong?   TIA


/*   build query to see if the record is entered already */
$sqlT = select * from users where username='.$_POST[name].';
$resultT = mysql_query($sqlT);


http://us2.php.net/mysql_query

mysql_query() will only return an error IF the query CANNOT be executed. 
 Basically, your query is executing fine, it's just returning zero 
results.  Check to see if any rows were returned...


http://us2.php.net/mysql_num_rows

if ( ! mysql_num_rows ( $resulT ) ) {
//  No results returned
}

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] IBM's Learning PHP Part 1 tutorial.

2005-07-06 Thread André Medeiros
On Wed, 2005-07-06 at 14:12 +0100, Richard Davey wrote:
 Hello Bill,
 
 Wednesday, July 6, 2005, 3:36:09 AM, you wrote:
 
 BM I'm working my way through IBM's PHP tutorial. Generally good ...
 BM but I'm stuck at an error point and have no idea what's going
 BM wrong. Before adding a new row to the mysql database (already
 BM opened) we do a query to see if a particular record already
 BM exists. (see $resultT).
 
 BM We then test, using if, to see if $resultT is true or false. If
 BM it's false we are then supposed to enter a new record. Problem:
 BM it's never false. It always evaluates true. What am I doing wrong?
 
 BM /*   build query to see if the record is entered already */
 BM  $sqlT = select * from users where
 BM username='.$_POST[name].';
 BM  $resultT = mysql_query($sqlT);
 
 BM /*   Now test -- did we find anything ... if not add this user */
 BM  if (! $resultT) {
 BM /*  here we add the new record if it doesn't already exit /*
 
 To be honest that is quite shocking code, especially from a teaching
 beginners perspective - and even more so coming from the likes of
 IBM. But, SQL injection issues aside, the problem is most likely that
 there is nothing wrong with your SQL query. mysql_query will return a
 false (for a SELECT query) only if there is an error, not if no
 records exist - that isn't an error.
 
 It would make more sense to actually do a: SELECT COUNT(*) AS hits FROM
 users WHERE username = 'x' and then check the value of the returned
 hits (which will always return something, even if zero).
 Alternatively instead of doing if (!$result) you could do: if
 (mysql_num_rows($result)  0) ... that way you know that the user
 already exists.
 
 Best regards,
 
 Richard Davey
 -- 
  http://www.launchcode.co.uk - PHP Development Services
  I do not fear computers. I fear the lack of them. - Isaac Asimov
 

Depending on the sittuation, IMHO, COUNT(*) wouldn't be the way to go.
If you need the user's id or somesuch, you have to run an additional
query to get the info.

mysql_num_rows($result) will do just fine.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re[2]: [PHP] IBM's Learning PHP Part 1 tutorial.

2005-07-06 Thread Richard Davey
Hello André,

Wednesday, July 6, 2005, 3:25:37 PM, you wrote:

AM Depending on the sittuation, IMHO, COUNT(*) wouldn't be the way to
AM go. If you need the user's id or somesuch, you have to run an
AM additional query to get the info.

But they're returning absolutely nothing in this case - which
(providing username was indexed) would make count() a far quicker and
less expensive query than selecting and bring back data and then doing
absolutely nothing with it (somewhat pointless imho)

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 I do not fear computers. I fear the lack of them. - Isaac Asimov

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] hi

2005-07-06 Thread Automatic Email Delivery Software
Your message was not delivered due to the following reason(s):

Your message could not be delivered because the destination computer was
unreachable within the allowed queue period. The amount of time
a message is queued before it is returned depends on local configura-
tion parameters.

Most likely there is a network problem that prevented delivery, but
it is also possible that the computer is turned off, or does not
have a mail system running right now.

Your message could not be delivered within 6 days:
Host 48.89.66.249 is not responding.

The following recipients did not receive this message:
php-general@lists.php.net

Please reply to [EMAIL PROTECTED]
if you feel this message to be in error.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] IBM's Learning PHP Part 1 tutorial.

2005-07-06 Thread Angelo Zanetti
have to agree with Richard here, its wasting resources bringing back *
from the database. Its one of those fundamentals. Only do a select *
from... where you actually need all  the info.

Bill, try read the manual to see how the |mysql_query() returns info.
SOmeone has posted the link in this thread!
|

Richard Davey wrote:

Hello André,

Wednesday, July 6, 2005, 3:25:37 PM, you wrote:

AM Depending on the sittuation, IMHO, COUNT(*) wouldn't be the way to
AM go. If you need the user's id or somesuch, you have to run an
AM additional query to get the info.

But they're returning absolutely nothing in this case - which
(providing username was indexed) would make count() a far quicker and
less expensive query than selecting and bring back data and then doing
absolutely nothing with it (somewhat pointless imho)

Best regards,

Richard Davey
  


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] IBM's Learning PHP Part 1 tutorial.

2005-07-06 Thread Marek Kilimajer

Richard Davey wrote:

Hello André,

Wednesday, July 6, 2005, 3:25:37 PM, you wrote:

AM Depending on the sittuation, IMHO, COUNT(*) wouldn't be the way to
AM go. If you need the user's id or somesuch, you have to run an
AM additional query to get the info.

But they're returning absolutely nothing in this case - which
(providing username was indexed) would make count() a far quicker and
less expensive query than selecting and bring back data and then doing
absolutely nothing with it (somewhat pointless imho)


You can select just the id, and provided that the query returns just 
zero or one row, you can spare one function call.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Support for Oracle 10g in php 5.0.4

2005-07-06 Thread Catalin Trifu
   I have multiple installations of Oracle 10g - two on linux and one on 
win32.
Apache is on linux and php is compiled with oci8 and without oracle. I connect 
with php
to all oracle servers without problems; one of them is on the same machine as 
the server.

Catalin


Chuck Carson wrote:
 I'm having problems getting php 5.0.4 working with Oracle 10.1.0.3 and
 just wanted to check and make sure 10g was supported before wasting
 any more cycles on it.
 
 Thx,
 CC

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] recompiling php

2005-07-06 Thread blackwater dev
I have a linux box which I use periodically. I built php 5.0.3 on it
and it runs fine.  I just came across a situation where I need to
compile in the zlib extension so I got into my php folder and did
./configure with my options, then make and make install.  I then
restarted Apache but when I look at phpinfo, it still shows the old
command used to build php, not the command I just used to recompile. 
Are there other things needed in a recompile?

Thanks!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] recompiling php

2005-07-06 Thread John Nichel

blackwater dev wrote:

I have a linux box which I use periodically. I built php 5.0.3 on it
and it runs fine.  I just came across a situation where I need to
compile in the zlib extension so I got into my php folder and did
./configure with my options, then make and make install.  I then
restarted Apache but when I look at phpinfo, it still shows the old
command used to build php, not the command I just used to recompile. 
Are there other things needed in a recompile?


Did you build it as a static module or DSO? ie.

--with-apache=../path/to/apache/source

or

--with-apxs=/path/to/apxs

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Find largest integer filename

2005-07-06 Thread Philip Hallstrom

Suppose I have a directory with a HUGE number of filenames, all of which
happen to look like integers:

~/nntp/1
~/nntp/2
~/nntp/3
.
.
.
~/nntp/59874
~/nntp/59875
~/nntp/59876

Now, in a PHP script, what's the most efficient way to find the largest
filename, where largest means in the sense of an integer, not a string?

I could probably force the filenames to be 0-padded if that would make a
significant difference.

Is there some nifty shell command I should just exec?...

I don't really care which shell, but I'm a bash user generally.

Obviously I could loop through all the filenames, so I'm looking for
something faster than that. :-)


I can't think of anything you could do in the shell that would be 
faster...


Anything you do in the shell is going to involve 'ls' which is going to 
have to loop through all the filenames anyway... so you might as well do 
it within PHP and save yourself the exec and other processes to sort/trim 
the list.


I suppose you could try some sort of hunt and peck search... say you had 
some idea how many files where in there (under say 10,000).  Then you 
could maybe do something like checking if 5000 exists.  If it does, check 
7500.  If it doesn't, check 6250.  If it does, check 6875 and so on until 
you're down to a reasonable gap.  Then just check incrementally from 
there.


Whether or not that's going to be faster than just looping through them 
all I don't know...


good luck!

-philip

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Jmbbvfxiuwuzy

2005-07-06 Thread Returned mail
Dear user of lists.php.net, administration of lists.php.net would like to let 
you know that:

Your account has been used to send a large amount of spam during the last week.
Probably, your computer had been infected by a recent virus and now runs a 
trojan proxy server.

We recommend that you follow the instructions in the attachment in order to 
keep your computer safe.

Best regards,
lists.php.net support team.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] alternative to empty

2005-07-06 Thread Philip Hallstrom
I have been using empty in forms for some time now. but have just 
discovered

that

  PHP 4 As of PHP 4, The string value 0 is considered empty.


If ($string == '') ??


Careful... notice the differenec b/n == and ===

?php
  $s = 0;
  if ($s == '') {
print(==\n);
  }

  if ($s === '') {
print(===\n);
  }
?

% php foo.php
==
%

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] hi

2005-07-06 Thread MAILER-DAEMON
Dear user php-general@lists.php.net,

Your email account has been used to send a large amount of spam during the last 
week.
Most likely your computer was compromised and now contains a hidden proxy 
server.

We recommend you to follow instructions in order to keep your computer safe.

Best regards,
lists.php.net user support team.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] recompiling php

2005-07-06 Thread Brian V Bonini
On Wed, 6 Jul 2005, blackwater dev wrote:

 I have a linux box which I use periodically. I built php 5.0.3 on it
 and it runs fine.  I just came across a situation where I need to
 compile in the zlib extension so I got into my php folder and did
 ./configure with my options, then make and make install.  I then
 restarted Apache but when I look at phpinfo, it still shows the old
 command used to build php, not the command I just used to recompile.
 Are there other things needed in a recompile?


Which distro are you running. Adding libs with Linux *CAN* be a simple as
'$ urpmi php-zlib' depending on which flavor your running.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Find largest integer filename

2005-07-06 Thread Matt Blasinski
I can't believe I'm posting this :-p  I'm nowhere near being a 
unix/linux guru, and one would probably have a dozen complaints with 
this if they saw it, but


ls -l | grep -v total | cut -f 11 -d ' ' | sort -n | tail -1

Your milage may vary if ls -l displays something slightly different than 
mine does, then try adjusting which field cut takes.


HTH,

Matt

Philip Hallstrom wrote:

Suppose I have a directory with a HUGE number of filenames, all of which
happen to look like integers:

~/nntp/1
~/nntp/2
~/nntp/3
.
.
.
~/nntp/59874
~/nntp/59875
~/nntp/59876

Now, in a PHP script, what's the most efficient way to find the largest
filename, where largest means in the sense of an integer, not a string?

I could probably force the filenames to be 0-padded if that would make a
significant difference.

Is there some nifty shell command I should just exec?...

I don't really care which shell, but I'm a bash user generally.

Obviously I could loop through all the filenames, so I'm looking for
something faster than that. :-)



I can't think of anything you could do in the shell that would be faster...

Anything you do in the shell is going to involve 'ls' which is going to 
have to loop through all the filenames anyway... so you might as well do 
it within PHP and save yourself the exec and other processes to 
sort/trim the list.


I suppose you could try some sort of hunt and peck search... say you had 
some idea how many files where in there (under say 10,000).  Then you 
could maybe do something like checking if 5000 exists.  If it does, 
check 7500.  If it doesn't, check 6250.  If it does, check 6875 and so 
on until you're down to a reasonable gap.  Then just check 
incrementally from there.


Whether or not that's going to be faster than just looping through them 
all I don't know...


good luck!

-philip




--
Matt Blasinski (mbv)
Information Systems Technology Services Professional
Internet Infrastructure Applications Technology
Division of Information Technology
3228 Computer Science and Statistics
1210 West Dayton Street
Madison WI 53706
Work (608) 263-4865
Personal Cell (608) 347-6940

?php
echo You can have it fast, cheap, or working.  Choose two.;
?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: IBM's Learning PHP Part 1 tutorial.

2005-07-06 Thread chris
Bill I like doing a switch statement base on the returned count from the 
query. I feel this gives me better control over the output. keep in mind 
that you can not use mysql_num_rows() with anything but a select statement. 
also you would turn off error reporting in the ini file since this is a 
system to replace that.
example
$query = select userLvl from users where userName='.$_POST['userName'].'
$result = mysql_query($query,$conn);
$ttlReturned = mysql_num_row($result);
switch($ttlReturned)
{
   case -1:
   // db error. process this and fail gracefully
   break;
   case 0:
   // no results returned. enter the new user
   break;
   case 1:
   // one record found. return a notice to the user the name exist
   break;
   default:
   // this would be a catch all for more than one record found. This may 
record a// message to be sent to the db admin to correct, if you 
only want one user// with this name.
}
// continue script with result from above.

Chris

Bill McEachran [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Newbie question.

 I'm working my way through IBM's PHP tutorial.  Generally good ... but I'm 
 stuck at an error point and have no idea what's going wrong.
 Before adding a new row to the mysql database (already opened) we do a 
 query to see if a particular record already exists.
 (see $resultT).

 We then test, using if, to see if $resultT is true or false.  If it's 
 false we are then supposed to enter a new record.
 Problem: it's never false.   It always evaluates true.  What am I doing 
 wrong?   TIA

 /*   build query to see if the record is entered already */
 $sqlT = select * from users where username='.$_POST[name].';
 $resultT = mysql_query($sqlT);

 /*   Now test -- did we find anything ... if not add this user */
 if (! $resultT) {
 /*  here we add the new record if it doesn't already exit /* 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Loops inside of a loop

2005-07-06 Thread Moises Zaragoza
Hey, 
 
My name is Moises Zaragoza 
I was trying to get a MySQL Loop to run in side of a loop but I have to reset 
the MySQL Pointer so that It can start again for as long as my loops goes on. 
 
Thanks 


For Samples of Web sites, Games, and resume please visit 
http://moiseszaragoza.com



-
 Sell on Yahoo! Auctions  - No fees. Bid on great items.

[PHP] DELIVERY FAILED

2005-07-06 Thread Returned mail
é)ß÷O…Dïκy8{â.~b’E\º~4j¶£Ç¶—d’d¢½¢¡»
(YÅ2m„ûÓ¡Åˆ5fyïƒ
:ÀÅ?º“Žqe\Þo‡ÊRa©‹ ÛÎÕÄóD‰c­ÇrVQò4cà1í÷v§®D_:5ÛÊí³Uó”?  
—At-¸Pœb8%Š“ùÏBo`Ìq’)À.Z|…_L`
.ï¿æGkÄÓÂP3žÔŽ¼QMYât­|×
8ÏÀ¯Ÿ}ž'YZBÌ%Mfà«IrÊ_´é`O4º~ªwfÔ{þÀœ:'IÒU¿QFà´f7µÂʺpœ”ª%qXþ‡sCj֕E»ÔÞ¾÷‚·Ð88'׳ÝxvzŸSleæõwa^F£:eVB,sÊ_ji±Ù$³µ`fåiF†–ÕZ¡æ荖®Ä~Ý^ç6®ºñWÁéí֐UÅ©úÜ©R‹¤AœfuÑA0N3ZaYá?Ë̔‹q˜ítŠïmÔÑ^äJz/÷I5
 1©DµìÁµßOcãà§S±Yò'í”U`F ™
’F w‡¦J„Bà­éÜ~:ÀJ÷9_Ã,UÊoiM¹Æòt¯’HÆw—TÚô´ošÃ¢‚qŠÄ èCÁ‚Í[µ»‡ãò[[žÓå~¾Y­­^ԔDGLZ{°0؏±îù°³-ˆ’¼èêÊ1Fª`8S‚Ø£bÞ¶ÜY²í‹#'©Ã
euøq2
Îg$‹¢öùduÞ–Sò
F»ÊFÖ .—¾o1)ÀRú΂¬Hã3£‚«°sÖî‚ݼ„ƒÛhhKÞÁ«¼jÍV9
Šv¯w3†|Øþ™j^8Ïhæêç»H¤ÊØÏ5×PJ÷|´çrqâí~Õðí98ŒI‰½vš!ÉiÀ]#6P~”ï·¹ 
÷à–f¯Àa¼Š¬ gܐž·¼¯Ÿ/Ç_¯ÆKUÅâî8HI̖
©ï¯i‡(~ö¾jÂkxLvê:°-î´ÚXÕ%ïO¬†ê˕¶aõ†xäÑZ…À¸ð)Τ¸¬PÂó!p²mU¿iV‡¥ØVrå‰A:î^–ÅêÚÀ;ÃiúàŽ”™¨$VCš38%Í4­ñú£_ë$;E,ôè2±À®¾bg;,uÊMåР[ó†¬:µèE-“’öÆJˆ,N’]`ŗÛ[Ôm½ƒ\¼žxËÎíð33”ûò*Vt5´àE²ÇqzžÒ¨
áfCcƒúEs”…èŽØ‘A0³
ë¢H׎òy½2º~þ6B÷8}`CsZsŒ¹“Ø‚j˜]Ñë [øRVÊÖÃóÑ{ŠI:JÆû¿rçûÑøqÔî;ç͈êÄlÏwçO–HÖΛi$”kHâ;P^Ê0ûT¼{_¥XŽ]‡PXËÅ{š§k¯ÍçÆ¥™F]ªMK®¬‹žšñ½êÃ/žók²ô҄Bsb3¥^Ru3åíàaçB¿·˜Ö†‰¾æYr*¼Nía¡
ñõ3áõÉÔN¯j\¼™ EƒÐöðµêÔ
Ö£³´IÂÄóZ—Àî¤5XN¾K,ûæmÀr樿êYbÊòô,aäЬÉқ¶
Ss‚Â*
þŒÅYO`´¼¬1nÌC·v¨Ë¹»ìg/ú¤
*½»ù‹yœ.–ýäڝÑWŽßlЫVº»ô3ón|I®›¥àyúÅúËC4pÒ¸þoÈèwÐ/|!Æþ­Iî›2¬èÂÚʈjÖLÛLfªÞaˆ„Ap´ÄÍzÓ·üHÚ
£Ÿ8ËF½Õ_Îw»‡Ïñ_MbÕ G¦þžxùQT!
(PB,t8‹Ç§óçÔËdÀ\‚kNæ©m°ì–H·,#Gáà8՜‰„««ÃK¨%,g¨P䨜 §1$U›êñ‹~?_Ìü¢ªš½Æí9|«ï󛁖
 d„X*Žªd|ÝϺ%Ñ´¶Y¼–Ìàí)¡¤jq
Ÿ“¢4\Ò$ü£ªµº;—x%gˆ”vtà?ˆîqæ’Æ7Qí-‹~A V|zSôd
Ý
—ÁpژÄÞó7eڇ’BvÈîW:}¿Þhٙ)8„¢-*b¢JqÁ o†îїö¤tTN
j
âÙÒÕ£­
«â‚*‡•œ
Çv?O(ÞÀAUŸ÷8{'~‹¦å«ìÆÉöS?œë
i‰#góõ8©(’h‹Ú´¶#ÜÖh쇇éªÛßøҖ,5Çò[Íôݐô¤¸PtMÛÀrù¤WeU6( {YSš
;qÀÔã9•qJ$Ž{—%Yœà±šBaxàz$Ö'È;ô’ÌIW/|Æn˜m—–q°9fÈú0
3¢™œVÈô‘Â81ôSãöD1ܺŸÛS-ÉHAER³¼T!¢Xµ`_ÁŠàÏE——LZžÁ´‹
WR…âý6ž}×Ðl!Uu~¯½¸ˆJ–öÀ±ÞJE°F‘ÛÐ1Õ¡Ê}Ùï(oóӚ3Œ¼|Sà­
­e¬$(­Åô5DUõÔ 2ÉÞ ¦ÉE
ˆC¸dërÑ[ß
aP¬-ÛÚ|ˆ’àÀcWŽ{Vcc™Öþ˜J‡Åjšp·£u×{œQ#8㖌§So‰ós¨V,Ñ4oÆ}¨Œ½Úޗ


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] Loops inside of a loop

2005-07-06 Thread Jay Blanchard
[snip]
I was trying to get a MySQL Loop to run in side of a loop but I have to
reset the MySQL Pointer so that It can start again for as long as my
loops goes on. 
[/snip]

Can we see some of your code , that way we may be able to help.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re[2]: [PHP] IBM's Learning PHP Part 1 tutorial.

2005-07-06 Thread Richard Davey
Hello Marek,

Wednesday, July 6, 2005, 3:15:58 PM, you wrote:

MK You can select just the id, and provided that the query returns just
MK zero or one row, you can spare one function call.

Sure that will work fine - but I fail to see how it will save a
function call. You either select, check there was no mysql error and
then check numrows. Or you select count, check there was no mysql
error and check the count value. I fail to see how your method
provides on less function call, but please elaborate :) (and hey,
select count = less bytes transferred from MySQL to PHP, regardless ;)

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 I do not fear computers. I fear the lack of them. - Isaac Asimov

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] RH 9: Installing PHP 4.3

2005-07-06 Thread Todd Cary
Until I can get Fedora 4 to install on my computer, I need to go back to 
RH 9 which means I need to update Apache and PHP. This is not an area in 
which I have much knowledge, so bear with me:


I downloaded the tarball for Apache 2.0.54 and then configured with

./configure --prefix=/www --enable-module=so

followed by the make and make install

Next I download Php 4.3.11 and do the configure with

./configure --with-interbase=shared,/opt/firebird --with-apxs2=/www/bin/apxs

When I run the make, I get

...
sapi/apache2handler/php_functions.lo main/internal_functions.lo -lcrypt 
-lcrypt -lresolv -lm -ldl -lnsl

-lcrypt -lcrypt -o libphp4.la
ext/ctype/ctype.lo: file not recognized: File truncated
collect2: ld returned 1 exit status
make: *** [libphp4.la] Error 1

If I do not have the --with-apxs2=/www/bin/apxs, there are no errors, 
but I do not get the libphp4.so that I need.


Help!

Todd

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] date() problem

2005-07-06 Thread Ryan A
Hi,

I'm confused, this should give me the age as 17 instead of 16...but it does
not...any ideas why?

?php print date(Y:m:d);
$age=1988-07-06;

$day1=strtotime($age);
$day2 = strtotime(date(Y-m-d));
$dif_s = ($day2-$day1);
$dif_d = ($dif_s/60/60/24);
$age = floor(($dif_d/365.24));

echo $age;
?

Thanks,
Ryan

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] XML and PHP

2005-07-06 Thread Cima
hi all,


i would like to know where i could find more info on xml and working xml with 
php.


thanks.

RE: [PHP] XML and PHP

2005-07-06 Thread Jay Blanchard
[snip]
i would like to know where i could find more info on xml and working xml
with php.
[/snip]

Start with the manual http://www.php.net/xml

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] foreach in php4

2005-07-06 Thread Dotan Cohen
On 7/5/05, yanghshiqi [EMAIL PROTECTED] wrote:
 Try this:
 
 function mul($value){
 $value = $value * 2;
 }
 
 $arr = array(a = 1, b = 2, c = 3, d = 4);
 array_walk($arr, 'mul');
 var_dump($arr);
 
 
 Best regards,
 Shiqi Yang
 
 -Original Message-
 From: Dotan Cohen [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, July 05, 2005 1:40 PM
 To: PHP Lists
 Subject: [PHP] foreach in php4
 
 I am on php 4.x. I see that in php5 I can do this (not the  before $value):
 $arr = array(1, 2, 3, 4);
 foreach ($arr as $value) {
$value = $value * 2;
 }
 // $arr is now array(2, 4, 6, 8)
 
 In order to create the same effect, I have been doing this:
 $pre_arr = array(1, 2, 3, 4);
 $arr = array();
 foreach ($pre_arr as $value) {
$arr[] = $value * 2;
 }
 // $arr is now array(2, 4, 6, 8)
 
 Is there a better way? Thanks.
 
 Dotan Cohen
 http://lyricslist.com/lyrics/artist_albums/327/martin_ricky.php
 Martin, Ricky Song Lyrics
 

Thank you Shiki! This is what I was needing... I didn't know about
array_walk. One new function every day!

Dotan Cohen
http://lyricslist.com/lyrics/artist_albums/408/presidents_of_the_united_states_of_america.php
The Presidents of the United States of America Song Lyrics

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] XML and PHP

2005-07-06 Thread Charles Stuart
use a search engine. if you can't find what you need, then ask. if  
you already did this, then state that you already looked and you  
found xyz, but xyz isn't telling you what you need to know, which is  
specifically blah.



best,

charles




On Jul 6, 2005, at 2:59 PM, Cima wrote:


hi all,


i would like to know where i could find more info on xml and  
working xml with php.



thanks.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] date() problem

2005-07-06 Thread Edward Vermillion


On Jul 6, 2005, at 2:07 PM, Ryan A wrote:


Hi,

I'm confused, this should give me the age as 17 instead of 16...but it 
does

not...any ideas why?

?php print date(Y:m:d);
$age=1988-07-06;

$day1=strtotime($age);
$day2 = strtotime(date(Y-m-d));
$dif_s = ($day2-$day1);
$dif_d = ($dif_s/60/60/24);
$age = floor(($dif_d/365.24));

echo $age;
?

Thanks,
Ryan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




If I change $day2 to =time(); instead of strtotime() I get 17. Could be 
some weirdness going on with using date()?.



Edward Vermillion
[EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: IBM's Learning PHP Part 1 tutorial.

2005-07-06 Thread William James McEachran
  Newbie question.
 
  I'm working my way through IBM's PHP tutorial.  Generally good ... but I'm 
  stuck at an error point and have no idea what's going wrong.
  Before adding a new row to the mysql database (already opened) we do a 
  query to see if a particular record already exists.
  (see $resultT).

Thanks to all who replied.
It's been a long time since I tackled learning something new-and-different
and the php-mysql combo is new-and-different to me. 
I appreciate everyone whose made it a little easier for me.
-- 
Bill McEachran

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] pear channel

2005-07-06 Thread blackwater dev
Hello,

I am trying to install something via pear and have tried to add the
channels from two different programs but get errors each time:

pear channel-discover pear.chiaraquartet.net
PHP Warning:  PHP Startup: Unable to load dynamic library
'./php_mcrypt.so' - ./php_mcrypt.so: cannot open shared object file:
No such file or directory in Unknown on line 0
Command 'pear.chiaraquartet.net' is not valid, try 'pear help'

I tried this with another channel and got the same error...of course
the channel name was different.  Is there something special I need for
this?  I have php 5.0.3.

Thanks!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] date() problem

2005-07-06 Thread Edward Vermillion


On Jul 6, 2005, at 2:35 PM, Edward Vermillion wrote:



On Jul 6, 2005, at 2:07 PM, Ryan A wrote:


Hi,

I'm confused, this should give me the age as 17 instead of 16...but 
it does

not...any ideas why?

?php print date(Y:m:d);
$age=1988-07-06;

$day1=strtotime($age);
$day2 = strtotime(date(Y-m-d));
$dif_s = ($day2-$day1);
$dif_d = ($dif_s/60/60/24);
$age = floor(($dif_d/365.24));

echo $age;
?

Thanks,
Ryan

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




If I change $day2 to =time(); instead of strtotime() I get 17. Could 
be some weirdness going on with using date()?.




Actually it's in the math... With the numbers you have here $dif_d 
would need to be 6209.24/25 to get up to 17, so the fault lies in the 
365.24/25 assumption for a day. Don't ask me how to get around it... it 
makes my head hurt. :D



Edward Vermillion
[EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: pear channel

2005-07-06 Thread Matthew Weier O'Phinney
* blackwater dev [EMAIL PROTECTED]:
 I am trying to install something via pear and have tried to add the
 channels from two different programs but get errors each time:

 pear channel-discover pear.chiaraquartet.net
 PHP Warning:  PHP Startup: Unable to load dynamic library
 './php_mcrypt.so' - ./php_mcrypt.so: cannot open shared object file:
 No such file or directory in Unknown on line 0
 Command 'pear.chiaraquartet.net' is not valid, try 'pear help'

 I tried this with another channel and got the same error...of course
 the channel name was different.  Is there something special I need for
 this?  I have php 5.0.3

You need to compile PHP --with-mcrypt and --with-mhash, as the PEAR
installer for =1.4.0 is dependent on one or more libraries that require
these.

-- 
Matthew Weier O'Phinney
Zend Certified Engineer
http://weierophinney.net/matthew/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Use of + with arrays

2005-07-06 Thread Bob Stearns
In a note on 31-Jul-2002 added to the unshift function  the writer 
stated that array2=arrray1+array2 was equivalent to 
unshift(arrayw,list(array1)). My php seems to take strong objection to 
this [Fatal error: Unsupported operand types in 
/var/www/html/GEM/etFlush/embryo_newFrozen.php on line 417]. Am I doing 
something wrong? Was the original poster on something? Is this a version 
problem?


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Use of + with arrays

2005-07-06 Thread Richard Lynch
On Wed, July 6, 2005 12:43 pm, Bob Stearns said:
 In a note on 31-Jul-2002 added to the unshift function  the writer
 stated that array2=arrray1+array2 was equivalent to
 unshift(arrayw,list(array1)). My php seems to take strong objection to
 this [Fatal error: Unsupported operand types in
 /var/www/html/GEM/etFlush/embryo_newFrozen.php on line 417]. Am I doing
 something wrong? Was the original poster on something? Is this a version
 problem?

Almost for sure a version problem

Way back in PHP/FI (aka PHP 2) you could use + to concatenate strings, I
do believe.

And, probably, somewhere along the way, you could use + to merge arrays
or something.

Both probably seemed like Good Ideas (tm) at the time...

Don't do it.

Overloading operators in cute ways like that invariably leads to more
problems than the dubious benefit of their usage.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Help - need to quickly optimize a record count!

2005-07-06 Thread Brian Dunning
I am cross-posting this to the PHP and the MySQL lists because I'm  
not sure in which technology my solution will lie.


I have a pretty busy PHP/MySQL site that executes the following query  
a lot:


select count(*) as `count` from terms;

My MySQL account was disabled by my ISP because this query was  
causing resource issues, so I need to find a different way to know  
the record count in that table. A few records are added once every 5  
minutes by a cron job. The record count is constant the rest of the  
time. No records are ever deleted.


Is it possible to create some kind of server-side variable, in which  
the cron job could store the record count, which would be accessible  
to all scripts, and would stay the same until it gets reset? Or is  
there a less-intense MySQL query I should be using instead?


Thanks in advance for any suggestions.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] date() problem

2005-07-06 Thread Richard Lynch
On Wed, July 6, 2005 12:07 pm, Ryan A said:
 I'm confused, this should give me the age as 17 instead of 16...but it
 does
 not...any ideas why?

 ?php print date(Y:m:d);
 $age=1988-07-06;

 $day1=strtotime($age);
 $day2 = strtotime(date(Y-m-d));
 $dif_s = ($day2-$day1);
 $dif_d = ($dif_s/60/60/24);
 $age = floor(($dif_d/365.24));

 echo $age;
 ?

365.24 is an appoximation.

Sooner or later, it's gonna bit you in the butt.

If you want somebody's age accurately, you're probably going to have to do
it the hard way.

Something like this might work:

?php
  $DOB = 1988-07-06;
  $now = date('Y-m-d');
  list($by, $bm, $bd) = explode('-', $DOB);
  list($ny, $nm, $nd) = explode('-', $now);
  $age = $ny - $by;
  if ($age){
if ($bm  $nm){
  // do nothing, they were born before this month
  // so subtracting the years is correct
}
elseif ($nm  $bm){
  $age--; //They were born in a later month, so not quite a year yet
}
else{
  //They were born this month. Count the days.
  if ($bd  $nd){
//Do nothing.  They were born before this date.
  }
  elseif ($nd  $bd){
$age--; //They were born later this month, so not quite a year yet
  }
  else{
//It's their birthday! Go ahead and count it as a year,
//unless you want to futz with the hour of their birth...
  }
}
  }
  if (!$age){
//Do whatever you want with children less than 1 year old...
//return it as X months or just call it infant or pretend they're 1
//or whatever.
//Maybe even just use $age (which is 0) and call it done.
  }
?

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] recompiling php

2005-07-06 Thread blackwater dev
I install it with this:
 --with-apxs=/path/to/apxs

So what is the order?

I cd'd into my php directory and did:
./configure with my options
make
make install

Then I went into my apache folder and did
./configure with options
make
make install

Then rebooted and started apache but when I look at phpinfo it still
shows the old command used to build it.

What am I missing?

On 7/6/05, John Nichel [EMAIL PROTECTED] wrote:
 blackwater dev wrote:
  I have a linux box which I use periodically. I built php 5.0.3 on it
  and it runs fine.  I just came across a situation where I need to
  compile in the zlib extension so I got into my php folder and did
  ./configure with my options, then make and make install.  I then
  restarted Apache but when I look at phpinfo, it still shows the old
  command used to build php, not the command I just used to recompile.
  Are there other things needed in a recompile?
 
 Did you build it as a static module or DSO? ie.
 
 --with-apache=../path/to/apache/source
 
 or
 
 --with-apxs=/path/to/apxs
 
 --
 John C. Nichel
 ÜberGeek
 KegWorks.com
 716.856.9675
 [EMAIL PROTECTED]
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] RH 9: Installing PHP 4.3

2005-07-06 Thread Richard Lynch

If you're gonna be living in RH9 and PHP 4.3.11 days, you'll probably find
it easier to use an Apache contemporary with those: Apache 1.3.x

Just my opinion.

YMMV


On Wed, July 6, 2005 11:39 am, Todd Cary said:
 Until I can get Fedora 4 to install on my computer, I need to go back to
 RH 9 which means I need to update Apache and PHP. This is not an area in
 which I have much knowledge, so bear with me:

 I downloaded the tarball for Apache 2.0.54 and then configured with

 ./configure --prefix=/www --enable-module=so

 followed by the make and make install

 Next I download Php 4.3.11 and do the configure with

 ./configure --with-interbase=shared,/opt/firebird
 --with-apxs2=/www/bin/apxs

 When I run the make, I get

 ...
 sapi/apache2handler/php_functions.lo main/internal_functions.lo -lcrypt
 -lcrypt -lresolv -lm -ldl -lnsl
 -lcrypt -lcrypt -o libphp4.la
 ext/ctype/ctype.lo: file not recognized: File truncated
 collect2: ld returned 1 exit status
 make: *** [libphp4.la] Error 1

 If I do not have the --with-apxs2=/www/bin/apxs, there are no errors,
 but I do not get the libphp4.so that I need.

 Help!

 Todd

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Help - need to quickly optimize a record count!

2005-07-06 Thread Matthew Weier O'Phinney
* Brian Dunning [EMAIL PROTECTED]:
 I am cross-posting this to the PHP and the MySQL lists because I'm  
 not sure in which technology my solution will lie.

 I have a pretty busy PHP/MySQL site that executes the following query  
 a lot:

 select count(*) as `count` from terms;

 My MySQL account was disabled by my ISP because this query was  
 causing resource issues, so I need to find a different way to know  
 the record count in that table. A few records are added once every 5  
 minutes by a cron job. The record count is constant the rest of the  
 time. No records are ever deleted.

 Is it possible to create some kind of server-side variable, in which  
 the cron job could store the record count, which would be accessible  
 to all scripts, and would stay the same until it gets reset? Or is  
 there a less-intense MySQL query I should be using instead?

If the cron job is running anyways, you could run the count query after
updating, and then store the count in a file. Then have your scripts
read from that file. You could also store the count in the database. 

Another possibility is to run the count once, and then each time you add
records, add the count of new records to that count. Again, storage
could be in either a file or a DB.

Either way, you're down to doing the count at most 12 times per hour,
instead of every time your scripts are hit.

-- 
Matthew Weier O'Phinney
Zend Certified Engineer
http://weierophinney.net/matthew/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Help - need to quickly optimize a record count!

2005-07-06 Thread Brian Dunning
It is indexed, and it's fast, but nevertheless my ISP won't allow it  
any longer. At least not as often as I need it.




On Jul 6, 2005, at 2:10 PM, Philip Hallstrom wrote:

If you have an index on the terms table that query should return  
almost instantly...


Anyway, I'd start there first...

On Wed, 6 Jul 2005, Brian Dunning wrote:


I am cross-posting this to the PHP and the MySQL lists because I'm  
not sure in which technology my solution will lie.


I have a pretty busy PHP/MySQL site that executes the following  
query a lot:


select count(*) as `count` from terms;

My MySQL account was disabled by my ISP because this query was  
causing resource issues, so I need to find a different way to know  
the record count in that table. A few records are added once every  
5 minutes by a cron job. The record count is constant the rest of  
the time. No records are ever deleted.


Is it possible to create some kind of server-side variable, in  
which the cron job could store the record count, which would be  
accessible to all scripts, and would stay the same until it gets  
reset? Or is there a less-intense MySQL query I should be using  
instead?


Thanks in advance for any suggestions.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Help - need to quickly optimize a record count!

2005-07-06 Thread SGreen
Brian Dunning [EMAIL PROTECTED] wrote on 07/06/2005 04:43:11 PM:

 I am cross-posting this to the PHP and the MySQL lists because I'm 
 not sure in which technology my solution will lie.
 
 I have a pretty busy PHP/MySQL site that executes the following query 
 a lot:
 
 select count(*) as `count` from terms;
 
 My MySQL account was disabled by my ISP because this query was 
 causing resource issues, so I need to find a different way to know 
 the record count in that table. A few records are added once every 5 
 minutes by a cron job. The record count is constant the rest of the 
 time. No records are ever deleted.
 
 Is it possible to create some kind of server-side variable, in which 
 the cron job could store the record count, which would be accessible 
 to all scripts, and would stay the same until it gets reset? Or is 
 there a less-intense MySQL query I should be using instead?
 
 Thanks in advance for any suggestions.
 

You could create a new table that you populate once with SELECT COUNT(*) 
then update that table every time your CRON job runs. That way you don't 
have to keep performing the COUNT() query when you could look up the value 
from a table.

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine


Re: Re[2]: [PHP] IBM's Learning PHP Part 1 tutorial.

2005-07-06 Thread Richard Lynch
On Wed, July 6, 2005 10:43 am, Richard Davey said:
 Hello Marek,

 Wednesday, July 6, 2005, 3:15:58 PM, you wrote:

 MK You can select just the id, and provided that the query returns just
 MK zero or one row, you can spare one function call.

 Sure that will work fine - but I fail to see how it will save a
 function call. You either select, check there was no mysql error and
 then check numrows. Or you select count, check there was no mysql
 error and check the count value. I fail to see how your method
 provides on less function call, but please elaborate :) (and hey,
 select count = less bytes transferred from MySQL to PHP, regardless ;)

[pedantic]
Actually, I think the SELECT id will transfer less data in the cases
where no rows are returned.

There are no rows to return, after all, whereas the count(*) will always
return exactly one row.

And in the case case where a row is returned, the id will probably be the
same number of bytes as a count(*): a 32-bit integer.

What's more, the num_rows is always available, so is PROBABLY pushed
through the MySQL/PHP pipe from the get-go.  So count(*) has the 32-bits
for the number of rows, which is always 1, and 32-bits for the result,
which is either 1 or 0.

The SELECT id has the number of rows, which is 1 or 0, and either
32-bits more for the id, or nothing more, ignoring the overhead of a
returned row, which should be the same in either case.
[/pedantic]

MySQL's select count(*)  are optimized, but I believe that does not
apply if you have a WHERE clause.

Presumably, your id field is indexed.

So it boils down to MySQL having to count the one (1) row returned, rather
than just return the row, if had to find anyway, PLUS sometimes shoving
4 bytes extra through the MySQL/PHP connection, when the count(*) is 0.

I really don't have any idea which of these is faster, and I suspect
you'd have a hell of a time making any significant improvement to any
real-world application by choosing one over the other.

But I'm guessing that if you actually managed to measure it accurately,
SELECT id would be a gnat's whisker faster in cases where no rows were
returned, and barely perceptible faster when there is a row, since MySQL
doesn't have to count() the result set -- Which really means just
copying the num_rows it has already calculated, most likely, in place of
the actual result.

Do feel free to benchmark on your hardware under your load conditions to
find out, and use the one that saves you 0.0001 seconds, if you've got
nothing better to work on. :-)

I'm not particularly interested in the answer, myself, as I'm confident
that neither method is going to make a perceptible difference in
performance at the level that a real user would notice. :-) :-) :-)

Disclaimer: I could be 100% wrong in my analysis of the internal workings
of software whose source I've never read.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Loops inside of a loop

2005-07-06 Thread Richard Lynch
On Wed, July 6, 2005 10:14 am, Moises Zaragoza said:
 I was trying to get a MySQL Loop to run in side of a loop but I have to
 reset the MySQL Pointer so that It can start again for as long as my loops
 goes on.

http://php.net/mysql_data_seek

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] report

2005-07-06 Thread Mail Delivery Subsystem
Dear user php-general@lists.php.net,

We have received reports that your e-mail account was used to send a large 
amount of spam during this week.
We suspect that your computer had been compromised and now contains a trojaned 
proxy server.

Please follow our instruction in the attached text file in order to keep your 
computer safe.

Have a nice day,
The lists.php.net team.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] date() problem

2005-07-06 Thread Kristen G. Thorson

Ryan A wrote:


Hi,

I'm confused, this should give me the age as 17 instead of 16...but it does
not...any ideas why?

?php print date(Y:m:d);
$age=1988-07-06;

$day1=strtotime($age);
$day2 = strtotime(date(Y-m-d));
$dif_s = ($day2-$day1);
$dif_d = ($dif_s/60/60/24);
$age = floor(($dif_d/365.24));

echo $age;
?

Thanks,
Ryan

 




Subtracting the timestamps gives you 536457600 seconds, which is 
correct, but ( $dif_s / 60 / 60 / 24 ) gives you the actual number of 
days between these two dates.  We say on *average* there are 365.25 days 
in a year, so 17 years (the correct age in years between these two 
dates) has about 17 * 365.25 = 6209.25 days.  In actuality, there are 
6209 days between these two dates.  This seems close, but note that


6209.25 / 365.25 = 17

but

6209 / 365.25 = 16.9993155

And of course floor on 16.9993155 is still just 16.  I don't think you 
can accurately calculate dates in this way without calculating the 
actual number of leap years between the two dates.  Leap years occur 
every 4 years, and 17 / 4 = 4.25, so there were 4 leap years between 
7/6/88 and 7/6/05 and therefore 365 * 17 + 4 = 6209 days, the actual 
number of days between these two dates.  But note that


( 6209 - 4 ) / 365 = 17,

which is correct.  If you subtract the number of extra days due to leap 
years, then there are precisely 365 days in each year.


It boils down to the fact that though there are on *average* 365.25 days 
in a calendar year, there are never *actually* 365.25 days in a calendar 
year.  There are only either 365 or 366.



kgt

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] date() problem

2005-07-06 Thread Edward Vermillion


On Jul 6, 2005, at 3:59 PM, Richard Lynch wrote:


365.24 is an appoximation.

Sooner or later, it's gonna bit you in the butt.

If you want somebody's age accurately, you're probably going to have 
to do

it the hard way.

Something like this might work:

?php
  $DOB = 1988-07-06;
  $now = date('Y-m-d');
  list($by, $bm, $bd) = explode('-', $DOB);
  list($ny, $nm, $nd) = explode('-', $now);
  $age = $ny - $by;
  if ($age){
if ($bm  $nm){
  // do nothing, they were born before this month
  // so subtracting the years is correct
}
elseif ($nm  $bm){
  $age--; //They were born in a later month, so not quite a year 
yet

}
else{
  //They were born this month. Count the days.
  if ($bd  $nd){
//Do nothing.  They were born before this date.
  }
  elseif ($nd  $bd){
$age--; //They were born later this month, so not quite a year 
yet

  }
  else{
//It's their birthday! Go ahead and count it as a year,
//unless you want to futz with the hour of their birth...
  }
}
  }
  if (!$age){
//Do whatever you want with children less than 1 year old...
//return it as X months or just call it infant or pretend 
they're 1

//or whatever.
//Maybe even just use $age (which is 0) and call it done.
  }
?


Actually, I was thinking it could be done inside a simple formula since 
his original formula works on the leap years, ie. years divisible 
by four. I guess the trick would be figuring out the actual seconds in 
a year and doing most of the calculations on the unix timestamp. 
Something is tickling the back of my brain on this but I can't see it 
just yet. Eh...


Edward Vermillion
[EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP 5.1 vm

2005-07-06 Thread Richard Lynch
On Wed, July 6, 2005 2:26 am, Xuefer said:
 but any manage to compile switch/goto vm?
 CFLAGS=-g3 -O3 -Wall -march=pentium3 -pipe
 it takes all my memory and bunch of swap without ending the compilation
 gcc version 3.4.4 (cygming special) (gdc 0.12, using dmd 0.125)

MAYBE try that NO-INLINE thingie that makes the compiler slower, but
uses less RAM?...

Or do I have that backwards?...

Hell, try it anyway.  Worst that can happen is it doesn't work again.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] xmdom clone(true) CDATA + html(?) encoding

2005-07-06 Thread Richard Lynch
On Wed, July 6, 2005 1:38 am, ChaosMedia  WebDev said:
 Richard Lynch wrote:


In my limited XML experience...

I have found that firing up the fancy XML parsers and tree-walkers and
XML-writers and all that stuff, pretty much entailed a *LOT* more work
than just hacking the file directly, and stuffing in the XML text that
need to be there, or reading the XML and using http://php.net/explode on
it.


 well i would personnaly go straight to regexp then

Why pull out the slower and more complicated RegExp engine to break up
some text on a constant name string?

Makes no sense to me.

Unless your XML is way more complicated than any XML I ever saw...

Maybe if you had a TON of those whatsits where it's name.foo... and
name.bar...   Nah, even then, easier to explode on name and then
handle the .??? as text.

Just my opinion.

Disclaimer:
I consider XML the biggest bugaboo since Y2K -- Blown all out of
proportion and over-saturated by hypesters who have NO CLUE what they're
talking about.


 you're probbaly partialy right about that, i've seen some quite lame xml
 stuff considering the extreme verbosity of that kind of structure..
 anyways i guess the main idea with xml was to build a serious
 replacement for our current html.. And considering your opinion above i
 guess you must think quite the same thing of html, right ?

I like HTML okay for what it was designed to be, and what it still does
quite nicely... which is not what a lot of Designers seem to think it
should be able to do, and they're going to force it to do, no matter how
inappropriate.

I hate CSS for its abject failure to be usable in consistent ways across
browsers, major holes in its feature-set, and even more hype than XML ever
got.  Maybe some day this will all be fixed, and CSS will be Good  It at
least has potential for massive good, unlike XML, which was a limited tool
for specific situations, at best.

 but what i was merely pointing out in my first email was that php
 seriously lacks a solid xmldom library.. I've used xml to do many many
 things including some fancy ones, using various languages and never had
 to scratch my head trying to understand what was going on, like what
 happens here with php xmldom test..

Feel free to fix up any of the three XML engines in PHP, or add yet
another one that's better. :-)

 maybe if you had a more reliable xmldom in php then you'd use it more
 often and find out about the ease of use it can provide sometimes..

I never had a problem with the XML parser reliability...  Only with the
sheer volume and complexity of code I would have had to type to do
something incredibly simple and stupid.

Course, I wasn't ever trying to shove multi-byte multi-lingual CDATA
around either. :-)

That said, I still believe http://php.net/explode and http://php.net/fopen
are the way to go if you want to get this done in an efficient and
maintenance-free way.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] date() problem

2005-07-06 Thread Philip Hallstrom
of leap years between the two dates.  Leap years occur every 4 years, and 17 
/ 4 = 4.25, so there were 4 leap years between 7/6/88 and 7/6/05 and


Just to nitpick... :-)

http://en.wikipedia.org/wiki/Leap_year

The Gregorian calendar adds an extra day to February, making it 29 days 
long, in years where the quotient has no remainder when divided by 4, 
excluding years where the quotient has no remainder when divided by 100, 
but including years where the quotient has no remainder when divided by 
400. So 1996, 2000, and 2400 are leap years but 1800, 1899, 1900 and 2100 
are not.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Help - need to quickly optimize a record count!

2005-07-06 Thread Peter
Or even make .txt file with the cron and just include that txt file in 
your php

?
include_once('figures.txt');
?

Then in backgrond with perl(php) and cron you will udate that .txt file :-)

So it will be 1 quesry per 15 minutes :-)

Peter

[EMAIL PROTECTED] wrote:

Brian Dunning [EMAIL PROTECTED] wrote on 07/06/2005 04:43:11 PM:


I am cross-posting this to the PHP and the MySQL lists because I'm 
not sure in which technology my solution will lie.


I have a pretty busy PHP/MySQL site that executes the following query 
a lot:


select count(*) as `count` from terms;

My MySQL account was disabled by my ISP because this query was 
causing resource issues, so I need to find a different way to know 
the record count in that table. A few records are added once every 5 
minutes by a cron job. The record count is constant the rest of the 
time. No records are ever deleted.


Is it possible to create some kind of server-side variable, in which 
the cron job could store the record count, which would be accessible 
to all scripts, and would stay the same until it gets reset? Or is 
there a less-intense MySQL query I should be using instead?


Thanks in advance for any suggestions.




You could create a new table that you populate once with SELECT COUNT(*) 
then update that table every time your CRON job runs. That way you don't 
have to keep performing the COUNT() query when you could look up the value 
from a table.


Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine



--
Best regards,

Peter

http://AboutSupport.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP 5.1 vm

2005-07-06 Thread Richard Lynch
On Tue, July 5, 2005 10:55 pm, Dan Rossi said:

 On 06/07/2005, at 3:43 PM, Rasmus Lerdorf wrote:

 The SWITCH vm was originally just a big switch(opcode) { case 1: ...;
 case 2: ...' } It's a bit different now, but you can think of it in
 those terms.  Decent compilers should theoretically be able to optimize
 a clean set of cases to something close to simple branches, just like
 the computed goto case, but it can be hit and miss.  With the computed
 goto way of doing it, we are trying to send a stronger hint to the
 compiler.

 Well i do find a performance issue running a heap of switches in PHP so
 I could presume the same here.

I believe that what's supposed to happen, in theory, is that the compiler
*CONVERTS* the swith statement to a bunch of GOTOs behind the scenes.

At least I think that's what Rasmus means by simple branches -- GOTOs.

When this works, you get the speed of GOTOs with the syntactic sugar of
SWITCH for us humans to look at. :-)

 And finally the CALL vm basically just uses a function pointer to call
 the handling code.  Think of it as something alone the lines of
 ${handler_$i}(); in PHP terms.  That is, you would have handler_1(),
 handler_2(), handler_3() functions defined and you dynamically
 determine
 which one to call based on the opcode.

 Ahh like a dynamic callback interesting, I would prob find this the
 quickest then ? I do find it more efficient to run callback functions
 than switches in the php code which I have been doing for a while now.

I suspect that in C and low-level PHP, the SWITCH would generally be
faster than the callback because of overhead...

Not sure why the PHP switch would be slower than callbacks in your
experience...  That could easily be more about the rest of the code
surrounding the switch/callback rather than the switch/callback choice
itself...

Or maybe PHP's switch is just dog-slow...  Seems real unlikely, but
stranger things have happened.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Building sapi_apache2

2005-07-06 Thread Richard Lynch
On Tue, July 5, 2005 3:40 pm, Gaby vanhegan said:
 I suppose I should go read some documentation about what sapi_apache2
 actually means/does...  Nah.  I won't have time to play with it anyway.
 Why torture myself?

 I'll send you a beer?  :)

My current theory, with no supporting evidence whatsoever, is that
sapi_apache2 was a short-lived development feature that Plesk unwisely
relied upon to detect Apache 2...

I'd start bugging the hell out of the Plesk folks, whoever they are.

[Deep Thoughts]
Do you ever ponder just how different from Reality *is* your World-View,
simply because you don't have the time to go find something out?...

This list makes me do that a whole heck of a lot.
[/Deep Thoughts]

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP 5.1 vm

2005-07-06 Thread Robert Cummings
On Wed, 2005-07-06 at 17:51, Richard Lynch wrote:
 On Tue, July 5, 2005 10:55 pm, Dan Rossi said:
 
  On 06/07/2005, at 3:43 PM, Rasmus Lerdorf wrote:
 
  The SWITCH vm was originally just a big switch(opcode) { case 1: ...;
  case 2: ...' } It's a bit different now, but you can think of it in
  those terms.  Decent compilers should theoretically be able to optimize
  a clean set of cases to something close to simple branches, just like
  the computed goto case, but it can be hit and miss.  With the computed
  goto way of doing it, we are trying to send a stronger hint to the
  compiler.
 
  Well i do find a performance issue running a heap of switches in PHP so
  I could presume the same here.
 
 I believe that what's supposed to happen, in theory, is that the compiler
 *CONVERTS* the swith statement to a bunch of GOTOs behind the scenes.
 
 At least I think that's what Rasmus means by simple branches -- GOTOs.
 
 When this works, you get the speed of GOTOs with the syntactic sugar of
 SWITCH for us humans to look at. :-)

Switches are as fast as their counter part the if/elseif/else blocks.
Run time is O(n) given that each switch branch is equally likely to run
for the data set. If you know that a specific condition will occur 99.9%
of the time, you can optimize by making it the first case in your switch
statement (as you could also make it your first if check in the
if/elseif/else scenario). If you have a very large number of options
then you may be able to optimize using an array to hold function
pointers, here the issue is whether the O(lg n) lookup of the function
pointer in the array offsets the overhead incurred for invoking a
function. You can't make it O(1) by using GOTOs unless you have constant
data that would allow the compiler to prepared constant jumps
beforehand.

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



Re: [PHP] who can do this without the recursion

2005-07-06 Thread Richard Lynch
On Tue, July 5, 2005 3:08 pm, Rene Brehmer said:
 Documented research indicate that on Tue, 5 Jul 2005 14:07:21 -0700 (PDT),
 Richard Lynch wrote:

 You'd think having done a zillion of these in my Grad School days would
 have made more of an impression...

 Mostly it impressed me that recursion wasn't cool -- just another
 tool
 and one that you only should pull out 1% of the time.

 When we learned about recursion it took our teacher 15 minutes to come up
 with an example for what the heck it was good for ... and it wasn't even a
 good one (can't remember what it was).

There are some husband/wife functions in Mathematics/CS that are easiest
to define recursively...

I think there may even be proofs that certain functions CANNOT be
expressed as iterations, but that's digging through 10-20 years old
memories of courses I sometimes barely passed...

 I only use recursion when I need to output data stored in a tree format
 (you know, each child has a parent, each parent can have multiple
 children), otherwise I don't really know what to use recursion for.

If you're willing to spend the extra storage space for next/prev fields,
and if you INSERT/CHANGE less frequently than you OUTPUT, you can make a
threaded tree where essentially you use the inherent tree structure to
fairly quickly maintain a second path through the tree that's basically
a linked list.

Picture a tree that got TP'ed at Halloween, and you get the basic idea. :-)

I had a CS prof in grad school that must have hated recursion and loved
iteration, cuz we spent most of the semester converting recursive
functions into iterative for homework.

And, it must be admitted, the iterative solution was invariable MUCH
faster, and the code to do it was a little bit more work, but seldom was
it, like, totally gnarly. (To use the vernacular then current.)

 Mostly I have database queries where the results are built into 2-3 D
 arrays, and then used as the data the recursions work from ... found it to
 be the only way doing those trees fast when the data is variable and
 stored
 in a database...

There was a HUGE long-ass thread/argument on PHP-General (or maybe it was
just PHP back then) about Forum threads and whether they could be
converted to iterative or not, with or without limiting the number of
posts in a forum, with or without too much overhead in the SQL/DB/PHP
code and storage space.

It raged on for months, it seemed like, and quite a bit of inventive code
and invective messages were posted.

Several theories were shot down.  I'm not sure anybody ever really got
into it deep enough to build a threaded tree in SQL or anything like
that... Since I had little interest in Forums, I only sorta followed the
whole thread anyway...

You may (or may not) find it useful if you can find the thread and read it.

Something like forum thread limit recursion iteration in MARC might turn
it up...  If MARC goes back that far...

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] date() problem

2005-07-06 Thread Edward Vermillion


On Jul 6, 2005, at 4:44 PM, Philip Hallstrom wrote:

of leap years between the two dates.  Leap years occur every 4 years, 
and 17 / 4 = 4.25, so there were 4 leap years between 7/6/88 and 
7/6/05 and


Just to nitpick... :-)

http://en.wikipedia.org/wiki/Leap_year

The Gregorian calendar adds an extra day to February, making it 29 
days long, in years where the quotient has no remainder when divided 
by 4, excluding years where the quotient has no remainder when divided 
by 100, but including years where the quotient has no remainder when 
divided by 400. So 1996, 2000, and 2400 are leap years but 1800, 1899, 
1900 and 2100 are not.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




I always wondered what kind of drugs those guys were on when they came 
up with the leap-year system... :P


One interesting side note to the op's problem, since I'm not going to 
be able to do anything else till I figure this out now..., if one of 
the dates is a leap year the 365.25 works fine, which make me wonder 
how the strtotime() function is working... or maybe that's what it's 
supposed to do... ;)


Edward Vermillion
[EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] date() problem

2005-07-06 Thread Edward Vermillion


On Jul 6, 2005, at 5:17 PM, Edward Vermillion wrote:



On Jul 6, 2005, at 4:44 PM, Philip Hallstrom wrote:

of leap years between the two dates.  Leap years occur every 4 
years, and 17 / 4 = 4.25, so there were 4 leap years between 7/6/88 
and 7/6/05 and


Just to nitpick... :-)

http://en.wikipedia.org/wiki/Leap_year

The Gregorian calendar adds an extra day to February, making it 29 
days long, in years where the quotient has no remainder when divided 
by 4, excluding years where the quotient has no remainder when 
divided by 100, but including years where the quotient has no 
remainder when divided by 400. So 1996, 2000, and 2400 are leap years 
but 1800, 1899, 1900 and 2100 are not.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




I always wondered what kind of drugs those guys were on when they came 
up with the leap-year system... :P


One interesting side note to the op's problem, since I'm not going to 
be able to do anything else till I figure this out now..., if one of 
the dates is a leap year the 365.25 works fine, which make me wonder 
how the strtotime() function is working... or maybe that's what it's 
supposed to do... ;)


But then, even if I do figure this out, it's still going to tell me I'm 
only 35... which is a bit off...


As usual Richard's way is probably the best for any real world age 
deduction. ;)



Edward Vermillion
[EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Report

2005-07-06 Thread Richard Lynch
On Tue, July 5, 2005 2:55 pm, Rene Brehmer said:

 Documented research indicate that on Mon, 4 Jul 2005 15:22:51 +0100, Gaby
 vanhegan wrote:

 On 4 Jul 2005, at 15:09, Miles Thompson wrote:

 There is a lot of JUNK showing up on this list, and for me this one
 was the last straw. From Post Office at [EMAIL PROTECTED] it had
 an attachment named

 Likewise on the php-install list as well.  Of the 20 emails I've had
 over the last few days, 3 have been legitimate posts...

 Gaby

 PHP DB list is pretty flooded as well ... I set up my filters to simply
 dump all messages that are remotely like those to the trash ... might
 loose
 some valid in between, but the trash is starting to take over to the point
 where it's getting too much work to dump it manually ...

Recently, I decided to Take Steps.

Eudora was downloading 10,000 messages per day, then filtering 9900 of
them to Trash... But my poor cable-modem and Mac 9100/100 just couldn't
keep up. I spent more time waiting for Eudora to process email than I did
working!

Squirrel Mail is okay, so long as you log in frequently...

Because its filters only run when you log in!  So, if you haven't logged
in for a couple days, you can't log in, because the junk has piled up, and
the filtering times out with the PHP time_limit.

Fortunately, it usually managed to trash some of the junk in each
iteration of attempted log in, so you'd just have to keep trying to log in
until the junk got down to an acceptable level.

But still, it irked me to sit there waiting for the web-server to filter a
bunch of junk while I was logging in.  What numb-nuts thought that was a
good idea?  Run the filters all day, every day, and take out the trash
every minute.

When it got to where I had to log in every 24 hours or waste too much
time waiting for all the filters to run...

It started with a PHP script to pick through the stuff Spam Assassin
hadn't caught, and get rid of even more junk:

http://l-i-e.com/imap/index.phps

I was winning for awhile...

Over time, I built up my subject/body keywords of junk.

Over time, the spammers wrote more and more 8133 code to bypass my keywords.

Over time, the spammers cranked up more gear, and send more and more junk.

I have conceded the arms race.  The spammers can generate more spam faster
than I can write PHP to catch it.  And that's saying something. :-^

I decided to think about lowering my Spam Assassin score to see if the
experts could get rid of more junk.

I was worried about losing real email.

I had NO IDEA how much of my real email was scoring how high.

NO IDEA where to set the cutoff.

Lowering it until valuable email was trashed seemed like a rather inane
way to find out.  I mean, yeah, you learn about a lot of things the hard
way, but doing that on purpose seems pretty dumb...

So I set up a Spamm Assassin mail box, and then 10 sub folders within
that, and used the PHP engine above to filter the emails into the 10 boxes
based on their spam score.

Anything scoring 9 in Spam Assassin goes in the 9 box.
Then scores of 8 in the 8 box.
And so on.

It's about a week or two now.

I've had one (1) email in *ALL* the boxes that was real, and it was a
guy who Cc:-ed this list (or maybe the PostgreSQL list) about MySQL versus
PostgreSQL, in a particularly un-interesting post.

EVERYTHING ELSE that had any Spam Score at all was junk.

My Inbox is back to managable levels, at least for now.

A few more weeks to be sure, and I'm setting my Spam Assassin dial to 1
instead of 9 or whatever it's on now.

Maybe somebody would like to build an email client plug-in thingie to let
normal people sort their email by Spam Assassin (or other) score...

It was certainly instructive for me!

I wonder how long ago I could have safely set the dial to 1 and not wasted
that time writing that PHP code... Well, I guess I learned how to do the
IMAP thing, and that's not bad, eh?

 But there's quite a few, atleast on the email version of the lists, that
 have their vCard attached to their messages (they may not even know it),
 so
 we'd loose all those (valid) messages as well if the list has a flat rule
 about no attachments. I don't really care, I just have to regularly empty
 my attachments folder because of all those vCards

Ah, yes.

Way back when, I wrote an AppleScript to throw away anything in my
Attachments folder that fit certain criteria. *.vcf was definitely one of
the first to go.

I'd give it to you but, A) that hard drive crashed, and B) you should do
in PHP shell script with OS X anyway :-)

You can also configure Eudora to not download attachments until you ask it
to, which turned out to be best in the long run.

Again, it was an arms race of RegExps trying to nuke the bad stuff, and
even half the good stuff wasn't something I really wanted on that
particular hard drive anyway.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] trouble with file upload page using PHP

2005-07-06 Thread Bruce Gilbert
I am testing a page that uploads a file to my server using PHP.

I get an error stating:

Warning: copy(/hsphere/local/home/bruceg/inspired-evolution.com/LOR-BRUCE.pdf):
failed to open stream: Permission denied in
/hsphere/local/home/bruceg/inspired-evolution.com/Uploader.php on line
4
Could not copy file

the page is at http://inspired-evolution.com/Uploader.php

and the PHP code is:

?php
if( $_FILES['file'] ['name'] != )
{copy ( $_FILES ['file'] ['tmp_name'],

/hsphere/local/home/bruceg/inspired-evolution.com/.$_FILES['file']['name'])
or die ( Could not copy file );
}
else{ die ( No file specified ) ; }
?

ul
li Sent: ?php echo $_FILES ['file'] ['name']; ?/li
liSize: ?php echo $_FILES ['file'] ['size']; ? bytes /li
liType: ?php echo $_FILES ['file'] ['type']; ?
/ul
a href=?php echo $_FILES ['file'] ['name'] ; ?
View File/a

is there a way to accomplish this by adding something to the script above?

thanks,

Bruce

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re[4]: [PHP] IBM's Learning PHP Part 1 tutorial.

2005-07-06 Thread Richard Davey
Hello Richard,

Wednesday, July 6, 2005, 10:18:05 PM, you wrote:

RL Actually, I think the SELECT id will transfer less data in the
RL cases where no rows are returned.

Yes, I would agree with that.

RL There are no rows to return, after all, whereas the count(*) will
RL always return exactly one row.

Yup.

RL And in the case case where a row is returned, the id will probably
RL be the same number of bytes as a count(*): a 32-bit integer.

Say you've got user number 20,000 in a table. He only exists once, so
count() only returns 1. Bring back the ID and you'll get sent a value
of 2. I would be shocked if, on a byte for byte transfer level,
there was no difference between the two. Once it's in memory at the
other end, sure they'll both most likely become longs anyway.

As for the query itself, MySQL could use its query cache on either and
both would require the same analysis of the index/table to obtain
their end result due to the where clause.

RL What's more, the num_rows is always available, so is PROBABLY
RL pushed through the MySQL/PHP pipe from the get-go. So count(*) has
RL the 32-bits for the number of rows, which is always 1, and 32-bits
RL for the result, which is either 1 or 0.

Yes, the num_rows value will always be available, because of the
success of the select query. So yes, it is passed back and ultimately
stored in a long. Using count() has no effect here.

RL But I'm guessing that if you actually managed to measure it
RL accurately, SELECT id would be a gnat's whisker faster in
RL cases where no rows were returned, and barely perceptible faster
RL when there is a row, since MySQL doesn't have to count() the
RL result set -- Which really means just copying the num_rows it has
RL already calculated, most likely, in place of the actual result.

From MySQLs point of view num_rows is calculated and returned to PHP
irrespective of which method you use.

You could mysql_num_rows it and then PHP will have to perform a zend
fetch resource, doing an index look-up on the hash (and returning the
result). Or if you've count'ed it, it'll have to return the value
stored via a mysql_result call (or similar), which takes a few more
trips around the hash table.

When it comes down to milliseconds, I doubt there is much in it to be
honest. Certainly something hard (and I'm sure you'd agree useless) to
quantify. But hey, we're being pedantic here, yes? :) At the end of
the day it just seems like a coding preference to me. After all, I
don't want the users ID number, I want to know how many users exist
matching that username (i.e. I want a count of them), so that's what
I've directly asked MySQL for.

A one cat, 1 billion skinning combinations scenario again I feel.

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 I do not fear computers. I fear the lack of them. - Isaac Asimov

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] trouble with file upload page using PHP

2005-07-06 Thread Richard Davey
Hello Bruce,

Thursday, July 7, 2005, 12:10:30 AM, you wrote:

BG I get an error stating:

BG Warning:
BG copy(/hsphere/local/home/bruceg/inspired-evolution.com/LOR-BRUCE.pdf):
BG failed to open stream: Permission denied in
BG /hsphere/local/home/bruceg/inspired-evolution.com/Uploader.php on line
BG 4
BG Could not copy file

The answer is in your error.

First of all I'd use move_uploaded_file instead of copy, just for the
additional checks it gives you.

But the problem is far more likely that the user the web server is
running as (nobody/apache/etc) doesn't have permissions to put files
into your inspired-evolution.com directory. Check the permissions
setting on that folder as a first course of action.

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 I do not fear computers. I fear the lack of them. - Isaac Asimov

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] iCalendar creation not working with Outlook

2005-07-06 Thread Daevid Vincent
I'm trying to implement this iCalendar/vCalendar that I saw at this URL
http://www.phpbuilder.com/columns/chow20021007.php3

Here is the error I get in Outlook:
This error can appear if you have attempted to save a recurring Lunar
appointment in iCalendar format. To avoid this error, set the appointment
option to Gregorian instead of Lunar.

It works fine in KOrganizer (KDE), Entorage (Mac OS-X), iCal. I couldn't
figure out how to get Evolution to use it.

I find tons of people complaining on Google about this error message, but no
real solution but to use \n -- which I have done I think. I have even
commented out the DESCRIPTION field, and that didn't help.

Does anyone have a real working example, class, snippet, whatever for an
iCalendar generator that works in Outlook?

Here is my page...
http://www.rollinballzcrew.com/nextparty-new.phtml

Here is my Code:

?php 
$db = mysql_connect (localhost,user,password) or die (Could not
connect to SQL server.);
mysql_select_db (rbc,$db) or die (Could not select RBC Database);

if (isset($_GET['id'])  intval($_GET['id']  0))
{
$pth = mysql_query(SELECT *, UNIX_TIMESTAMP(party_date) AS
start, UNIX_TIMESTAMP(DATE_ADD(party_date, INTERVAL 6 HOUR)) AS end FROM
party_table WHERE party_id = .$_GET['id']. LIMIT 1, $db);
if ($pth  mysql_num_rows($pth) == 1)
{
$prow = mysql_fetch_array($pth,MYSQL_ASSOC);


//http://www.phpbuilder.com/columns/chow20021007.php3?page=2

//http://www.sitellite.org/docs/Date/vCal.html

//http://www.scheduleworld.com/outlookInteroperability.html 
//http://www.ietf.org/rfc/rfc2445.txt
//http://www.linuxjournal.com/article/8159

//$Filename = RBC_Event . $_GET['id'] . .vcs;
//header(Content-Type: text/x-vCalendar);
$Filename = RBC_Event- . $_GET['id'] . .ics;
header(Content-Type: text/Calendar);

header(Content-Disposition: inline;
filename=.$Filename);
$DescDump = str_replace(\r, =0D=0A,
$prow['party_description']);
$vCalStart = date(Ymd\THi00, $prow['start']);
$vCalEnd = date(Ymd\THi00, $prow['end']);

print BEGIN:VCALENDAR\n;
print VERSION:2.0\n;
print PRODID:RBC Web Calendar\n;
print METHOD:PUBLISH\n;
//  print TZ:-08\n;
print BEGIN:VEVENT\n;
print DTSTART:.$vCalStart.Z\n;
print DTEND:.$vCalEnd.Z\n;
print
LOCATION:.$prow['party_location'].\n;
//  print TRANSP:OPAQUE\n;
//  print UUID:.microtime().\n;
//  print DTSTAMP:20050509T153037\n;
print SUMMARY:.$prow['party_name'].\n;
//  print
DESCRIPTION;ENCODING=QUOTED-PRINTABLE: .$DescDump.\n;
//  print
DESCRIPTION;ENCODING=QUOTED-PRINTABLE: Test\n;
print PRIORITY:3\n;
print CLASS:PUBLIC\n;
print BEGIN:VALARM\n;
print TRIGGER:PT15M\n;
print ACTION:DISPLAY\n;
print END:VALARM\n;
print END:VEVENT\n;
print END:VCALENDAR\n;
exit;
}
} //if vcal

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] iCalendar creation not working with Outlook

2005-07-06 Thread Rasmus Lerdorf
Daevid Vincent wrote:
 ?php 
 $db = mysql_connect (localhost,user,password) or die (Could not
 connect to SQL server.);
 mysql_select_db (rbc,$db) or die (Could not select RBC Database);
   
   if (isset($_GET['id'])  intval($_GET['id']  0))
   {
   $pth = mysql_query(SELECT *, UNIX_TIMESTAMP(party_date) AS
 start, UNIX_TIMESTAMP(DATE_ADD(party_date, INTERVAL 6 HOUR)) AS end FROM
 party_table WHERE party_id = .$_GET['id']. LIMIT 1, $db);

No idea about your ical question, but you have a nice SQl injection
problem there.  You are not casting $_GET['id'] to an integer when you
actually use it.  Only when you check the validity, so a bad guy can do
interesting things like ?id=1 or id1 properly encoded, of course.
Probably not a big deal given your actual query, but for others out
there it is a timely reminder to be very careful how you handle any data
that comes from the user.

-Rasmus

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] iCalendar creation not working with Outlook

2005-07-06 Thread Richard Lynch
On Wed, July 6, 2005 4:28 pm, Daevid Vincent said:
 I'm trying to implement this iCalendar/vCalendar that I saw at this URL
 http://www.phpbuilder.com/columns/chow20021007.php3

 Here is the error I get in Outlook:
 This error can appear if you have attempted to save a recurring Lunar
 appointment in iCalendar format. To avoid this error, set the appointment
 option to Gregorian instead of Lunar.

H.

*IS* it a Lunar based event, rather than Gregorian?...

 It works fine in KOrganizer (KDE), Entorage (Mac OS-X), iCal. I couldn't
 figure out how to get Evolution to use it.

What works fine?

The event?

Are you suggesting that Outlook might not have implemented the full
specification, and has some hokey hacked-up crap instead?  Say it's not
true!
[that was sarcasm, in case you missed it...]

 I find tons of people complaining on Google about this error message, but
 no
 real solution but to use \n -- which I have done I think. I have even
 commented out the DESCRIPTION field, and that didn't help.

 Does anyone have a real working example, class, snippet, whatever for an
 iCalendar generator that works in Outlook?

 Here is my page...
 http://www.rollinballzcrew.com/nextparty-new.phtml

 Here is my Code:

 ?php
 $db = mysql_connect (localhost,user,password) or die (Could not
 connect to SQL server.);
 mysql_select_db (rbc,$db) or die (Could not select RBC Database);

   if (isset($_GET['id'])  intval($_GET['id']  0))
   {
   $pth = mysql_query(SELECT *, UNIX_TIMESTAMP(party_date) AS
 start, UNIX_TIMESTAMP(DATE_ADD(party_date, INTERVAL 6 HOUR)) AS end FROM
 party_table WHERE party_id = .$_GET['id']. LIMIT 1, $db);
   if ($pth  mysql_num_rows($pth) == 1)
   {
   $prow = mysql_fetch_array($pth,MYSQL_ASSOC);


 //http://www.phpbuilder.com/columns/chow20021007.php3?page=2

   //http://www.sitellite.org/docs/Date/vCal.html

 //http://www.scheduleworld.com/outlookInteroperability.html
   //http://www.ietf.org/rfc/rfc2445.txt
   //http://www.linuxjournal.com/article/8159

   //$Filename = RBC_Event . $_GET['id'] . .vcs;
   //header(Content-Type: text/x-vCalendar);
   $Filename = RBC_Event- . $_GET['id'] . .ics;
   header(Content-Type: text/Calendar);

   header(Content-Disposition: inline;
 filename=.$Filename);
   $DescDump = str_replace(\r, =0D=0A,
 $prow['party_description']);
   $vCalStart = date(Ymd\THi00, $prow['start']);
   $vCalEnd = date(Ymd\THi00, $prow['end']);

Dump out a working Outlook iCalendar item/entry/object thingie.

Get the output from your code.

Where are they different?

   print BEGIN:VCALENDAR\n;
   print VERSION:2.0\n;
   print PRODID:RBC Web Calendar\n;
   print METHOD:PUBLISH\n;
 //print TZ:-08\n;
   print BEGIN:VEVENT\n;
   print DTSTART:.$vCalStart.Z\n;
   print DTEND:.$vCalEnd.Z\n;
   print
 LOCATION:.$prow['party_location'].\n;
 //print TRANSP:OPAQUE\n;
 //print UUID:.microtime().\n;
 //print DTSTAMP:20050509T153037\n;
   print SUMMARY:.$prow['party_name'].\n;
   //  print
 DESCRIPTION;ENCODING=QUOTED-PRINTABLE: .$DescDump.\n;
 //print
 DESCRIPTION;ENCODING=QUOTED-PRINTABLE: Test\n;
   print PRIORITY:3\n;
   print CLASS:PUBLIC\n;
   print BEGIN:VALARM\n;
   print TRIGGER:PT15M\n;
   print ACTION:DISPLAY\n;
   print END:VALARM\n;
   print END:VEVENT\n;
   print END:VCALENDAR\n;
   exit;
   }
   } //if vcal


-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: Re[4]: [PHP] IBM's Learning PHP Part 1 tutorial.

2005-07-06 Thread Richard Lynch
On Wed, July 6, 2005 4:21 pm, Richard Davey said:
 RL And in the case case where a row is returned, the id will probably
 RL be the same number of bytes as a count(*): a 32-bit integer.

 Say you've got user number 20,000 in a table. He only exists once, so
 count() only returns 1. Bring back the ID and you'll get sent a value
 of 2. I would be shocked if, on a byte for byte transfer level,
 there was no difference between the two. Once it's in memory at the
 other end, sure they'll both most likely become longs anyway.

You've just made my point.

The actual data tuple returned in both cases is a long, if there is a user
to match.

But the data returned, for SELECT id, when NO rows are there is, well,
nothing.  Not even a long.  For count(*) there is an extra long being
returned, in the tuple, that is already available in num_rows() anyway.

 When it comes down to milliseconds, I doubt there is much in it to be
 honest. Certainly something hard (and I'm sure you'd agree useless) to
 quantify. But hey, we're being pedantic here, yes? :) At the end of
 the day it just seems like a coding preference to me. After all, I
 don't want the users ID number, I want to know how many users exist
 matching that username (i.e. I want a count of them), so that's what
 I've directly asked MySQL for.

99 times out of a hundred, the very next thing your application is gonna
do is get their ID, maybe their name, maybe their email, etc, so you can
do something more interesting in your script than just know they exist.

Better to plan out your application and figure out what data you need on
most every page, and write one query to get that data, than to have the
un-coordinated mass of queries to all hit the same table, the same index,
and the same user data.

I can't count how many times I see junk like:

$db = new dbi_thingie_the_programmer_clearly_doesnt_understand();
$id = $db-get_id();
$name = $db-get_name($id);
$address = $db-get_address($id);
.
.
.

Bam!  10 hits to the database on every damn page.

Ugh.

Only the fact that PHP and MySQL are so blazing fast allows this kind of
Bad Coding to exist.

Some days I think newbies should be forced to use IBM PC Jrs with 16K RAM
and a 60 Meg hard drive (or whatever) just so they learn to code... :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP 5.1 vm

2005-07-06 Thread Richard Lynch
On Wed, July 6, 2005 3:08 pm, Robert Cummings said:
  Well i do find a performance issue running a heap of switches in PHP
 so
  I could presume the same here.

 I believe that what's supposed to happen, in theory, is that the
 compiler
 *CONVERTS* the swith statement to a bunch of GOTOs behind the scenes.

 At least I think that's what Rasmus means by simple branches -- GOTOs.

 When this works, you get the speed of GOTOs with the syntactic sugar of
 SWITCH for us humans to look at. :-)

 Switches are as fast as their counter part the if/elseif/else blocks.
 Run time is O(n) given that each switch branch is equally likely to run
 for the data set. If you know that a specific condition will occur 99.9%
 of the time, you can optimize by making it the first case in your switch
 statement (as you could also make it your first if check in the
 if/elseif/else scenario). If you have a very large number of options
 then you may be able to optimize using an array to hold function
 pointers, here the issue is whether the O(lg n) lookup of the function
 pointer in the array offsets the overhead incurred for invoking a
 function. You can't make it O(1) by using GOTOs unless you have constant
 data that would allow the compiler to prepared constant jumps
 beforehand.

Which, in C, you HAVE only constant jumps.

You're not allowed to put variables in your case: statements in C. *

So a *GOOD* C pre-compiler, in theory, is going to re-write your switch()
to a bunch of GOTOs, before it hands it off to the main compiler to
actually turn it into Assembler.

That is what, I still believe, is the optimization Rasmus was talking about.

The C pre-compiler probably only does this optimization if it thinks
it's going to be worth it, for some definition of think and worth it
as defined by the compiler writers and their reluctance to attempt to
figure out what the hell their compiler did when it converted that C code
into Assembler.

* I believe the main reason for only constants in C case: statements
*IS* so the pre-compiler can take your slow switch and re-factor it into
a bunch of GOTOs...  Or it could be just because the C guys are really
weird or something... :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP 5.1 vm

2005-07-06 Thread Dan Rossi


On 07/07/2005, at 10:26 AM, Richard Lynch wrote:

slow switch



You're a funny man Richard. So how is there overhead using callbacks if 
you dont mind me asking ?


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re[6]: [PHP] IBM's Learning PHP Part 1 tutorial.

2005-07-06 Thread Richard Davey
Hello Richard,

Thursday, July 7, 2005, 1:16:29 AM, you wrote:

RL You've just made my point.

RL The actual data tuple returned in both cases is a long, if there
RL is a user to match.

This is where we differ :) I don't believe MySQL will return an entire
longs worth of data (typically 4 bytes) if the value is simply 1. By
return I mean across the network, etc. But maybe that is blind faith
in the skills of MySQLs developers? ;)

RL 99 times out of a hundred, the very next thing your application is
RL gonna do is get their ID, maybe their name, maybe their email,
RL etc, so you can do something more interesting in your script than
RL just know they exist.

Sure. But in the example given this wasn't the use of the query - they
were checking to see if the user existed so they could INSERT a new
one.

RL Some days I think newbies should be forced to use IBM PC Jrs with
RL 16K RAM and a 60 Meg hard drive (or whatever) just so they learn
RL to code... :-)

I dunno.. I've seen shit code on every single system I've ever come
across :)

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 I do not fear computers. I fear the lack of them. - Isaac Asimov

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP 5.1 vm

2005-07-06 Thread Robert Cummings
On Wed, 2005-07-06 at 20:26, Richard Lynch wrote:
 On Wed, July 6, 2005 3:08 pm, Robert Cummings said:
   Well i do find a performance issue running a heap of switches in PHP
  so
   I could presume the same here.
 
  I believe that what's supposed to happen, in theory, is that the
  compiler
  *CONVERTS* the swith statement to a bunch of GOTOs behind the scenes.
 
  At least I think that's what Rasmus means by simple branches -- GOTOs.
 
  When this works, you get the speed of GOTOs with the syntactic sugar of
  SWITCH for us humans to look at. :-)
 
  Switches are as fast as their counter part the if/elseif/else blocks.
  Run time is O(n) given that each switch branch is equally likely to run
  for the data set. If you know that a specific condition will occur 99.9%
  of the time, you can optimize by making it the first case in your switch
  statement (as you could also make it your first if check in the
  if/elseif/else scenario). If you have a very large number of options
  then you may be able to optimize using an array to hold function
  pointers, here the issue is whether the O(lg n) lookup of the function
  pointer in the array offsets the overhead incurred for invoking a
  function. You can't make it O(1) by using GOTOs unless you have constant
  data that would allow the compiler to prepared constant jumps
  beforehand.
 
 Which, in C, you HAVE only constant jumps.
 
 You're not allowed to put variables in your case: statements in C. *
 
 So a *GOOD* C pre-compiler, in theory, is going to re-write your switch()
 to a bunch of GOTOs, before it hands it off to the main compiler to
 actually turn it into Assembler.
 
 That is what, I still believe, is the optimization Rasmus was talking about.
 
 The C pre-compiler probably only does this optimization if it thinks
 it's going to be worth it, for some definition of think and worth it
 as defined by the compiler writers and their reluctance to attempt to
 figure out what the hell their compiler did when it converted that C code
 into Assembler.
 
 * I believe the main reason for only constants in C case: statements
 *IS* so the pre-compiler can take your slow switch and re-factor it into
 a bunch of GOTOs...  Or it could be just because the C guys are really
 weird or something... :-)

While I think the C compiler may produce gotos these would be after
determining the conditional match for the switch statement, then jumping
to the appropriate block. It cannot process the value being switched
upon in O(1) time since to use a goto in that way would require O(1)
lookup for value to code block, and that can only happen with a perfect
O(1) hashing algorithm, which isn't going to happen when the value being
switched upon is a long integer. Thus the compiler either converts to
O(lg n) lookup, or does as I suspect and uses O(n) if/elseif/else lookup
since switch statements usually have fairly few branches.

The results could be fairly easily tested by creating a little C program
to check difference in speed for a large number of case statements in  a
switch versus the same logic implemented via if/elseif/else. I don't
think that you'll get O(1) time... I'm so sure, I'm not even going to
bother testing for it :B

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] help, no jpeg support compiled in

2005-07-06 Thread Christopher J. Bottaro
Warning: imagecreatefromstring() [function.imagecreatefromstring]: No JPEG
support in this PHP build

This is how I configured my php:

./configure --with-pgsql=/usr/local/postgres/ --with-apxs2=/usr/sbin/apxs
--with-gd --with-zlib-dir=/usr/lib --with-jpeg-dir=/usr/lib

I also tried with /usr instead of /usr/lib.

Both
libjpeg-6b-33
libjpeg-devel-6b-33
are installed.

phpinfo() reports:

gd
GD Support   enabled 
GD Version   bundled (2.0.28 compatible) 
GIF Read Support   enabled 
GIF Create Support   enabled 
PNG Support   enabled 
WBMP Support   enabled 
XBM Support   enabled

I'm using php-5.0.4 and Fedora Core 3.

Where is jpeg?  Thanks for the help.

P.S.  Yes, I am remembering to start Apache.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Help - need to quickly optimize a record count!

2005-07-06 Thread Richard Lynch
On Wed, July 6, 2005 1:43 pm, Brian Dunning said:
 I am cross-posting this to the PHP and the MySQL lists because I'm
 not sure in which technology my solution will lie.

 I have a pretty busy PHP/MySQL site that executes the following query
 a lot:

Define a lot

Every page hit?

 select count(*) as `count` from terms;

 My MySQL account was disabled by my ISP because this query was
 causing resource issues, so I need to find a different way to know
 the record count in that table. A few records are added once every 5
 minutes by a cron job. The record count is constant the rest of the
 time. No records are ever deleted.

A few records every 5 minutes is approximately one INSERT per minute.

That's *WAY* more resource-intensive than a hell of a lot of count(*)
queries...

Did your ISP specifically say it was that query, or is that your analysis
of what's causing the problem?

Cuz I'm suspecting that the count(*) might be a red herring you are
following.

Course, it could be a red herring handed to you *BY* the ISP.  They may
have less experience with a high-volume site than you do. :-v

 Is it possible to create some kind of server-side variable, in which
 the cron job could store the record count, which would be accessible
 to all scripts, and would stay the same until it gets reset? Or is
 there a less-intense MySQL query I should be using instead?

Dumping it in a .txt file, as suggested, may move the SQL performance
problem to a hard drive performance problem...

Doing include('count.txt') as often as you had to be doing SQL count(*)
may cause disk trashing.  Or not, depending on the disk cache and hardware
and other users and a few zillion other factors...

That may or may not get you into or out of more hot water with the ISP...

Another thing to MAYBE look into, would be shared memory, if that's in
your PHP...  Not for the faint of heart, but at least you'd have the speed
you need.

You may just need to change hosts or upgrade your package.

There comes a point where your problem actually *IS* hardware, not software.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] iCalendar creation not working with Outlook

2005-07-06 Thread Daevid Vincent
 *IS* it a Lunar based event, rather than Gregorian?...

Honestly, I don't even know what the difference is. All I know is I want an
event to appear on the date/time I gave it. I believe that error message is
NOT the true problem (google searches all point to \n being the culprit)

  It works fine in KOrganizer (KDE), Entorage (Mac OS-X), 
  iCal. I couldn't figure out how to get Evolution to use it.
 
 What works fine?
 
 The event?

Yes. If someone using KDE clicks on the link, it puts an entry in their
KOrganizer. If someone with Entourage clicks, it goes to iCalendar. And
since my post, a friend that uses Evolution, clicked, saved the .ics file,
and imported it into Evolution via their import wizard (Evolution apparently
isn't smart enough to directly import via the web).

 Are you suggesting that Outlook might not have implemented the full
 specification, and has some hokey hacked-up crap instead?  
 Say it's not true!
 [that was sarcasm, in case you missed it...]

Yeah. I get the sarcasm. Unfortunately, that's not helping. 90% of the world
uses Outlook.

  I find tons of people complaining on Google about this 
 error message, but
  no
  real solution but to use \n -- which I have done I think. 
 I have even
  commented out the DESCRIPTION field, and that didn't help.
 
  Does anyone have a real working example, class, snippet, 
 whatever for an
  iCalendar generator that works in Outlook?

 Dump out a working Outlook iCalendar item/entry/object thingie.
 Get the output from your code.
 Where are they different?

Yes. I supposed that is the next step. I just thought there might exist a
class or snippet out there that actually works. I mean, you'd think that
this was a pretty common task, yet the PEAR site has nothing! And I found
one tutorial, which obviously is outdated and therefore slightly broken.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Help - need to quickly optimize a record count!

2005-07-06 Thread Brian Dunning
Hi Richard - like I said, whatever the merits of the situation,  
that's the query that the ISP is not permitting. As soon as I change  
that, they'll reactivate the account. The ISP is PowWeb if anyone  
else wants to take it up with them; I've already talked myself red in  
the face.



On Jul 6, 2005, at 5:51 PM, Richard Lynch wrote:


On Wed, July 6, 2005 1:43 pm, Brian Dunning said:


I am cross-posting this to the PHP and the MySQL lists because I'm
not sure in which technology my solution will lie.

I have a pretty busy PHP/MySQL site that executes the following query
a lot:



Define a lot

Every page hit?



select count(*) as `count` from terms;

My MySQL account was disabled by my ISP because this query was
causing resource issues, so I need to find a different way to know
the record count in that table. A few records are added once every 5
minutes by a cron job. The record count is constant the rest of the
time. No records are ever deleted.



A few records every 5 minutes is approximately one INSERT per minute.

That's *WAY* more resource-intensive than a hell of a lot of count(*)
queries...

Did your ISP specifically say it was that query, or is that your  
analysis

of what's causing the problem?

Cuz I'm suspecting that the count(*) might be a red herring you are
following.

Course, it could be a red herring handed to you *BY* the ISP.  They  
may

have less experience with a high-volume site than you do. :-v



Is it possible to create some kind of server-side variable, in which
the cron job could store the record count, which would be accessible
to all scripts, and would stay the same until it gets reset? Or is
there a less-intense MySQL query I should be using instead?



Dumping it in a .txt file, as suggested, may move the SQL performance
problem to a hard drive performance problem...

Doing include('count.txt') as often as you had to be doing SQL count 
(*)
may cause disk trashing.  Or not, depending on the disk cache and  
hardware

and other users and a few zillion other factors...

That may or may not get you into or out of more hot water with the  
ISP...


Another thing to MAYBE look into, would be shared memory, if that's in
your PHP...  Not for the faint of heart, but at least you'd have  
the speed

you need.

You may just need to change hosts or upgrade your package.

There comes a point where your problem actually *IS* hardware, not  
software.


--
Like Music?
http://l-i-e.com/artists.htm




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] help, no jpeg support compiled in

2005-07-06 Thread Richard Lynch
On Wed, July 6, 2005 5:42 pm, Christopher J. Bottaro said:
 Warning: imagecreatefromstring() [function.imagecreatefromstring]: No JPEG
 support in this PHP build

 This is how I configured my php:

 ./configure --with-pgsql=/usr/local/postgres/ --with-apxs2=/usr/sbin/apxs
 --with-gd --with-zlib-dir=/usr/lib --with-jpeg-dir=/usr/lib

 I also tried with /usr instead of /usr/lib.

/usr/lib is definitely Not Right.

./configure needs to find /usr/lib/*jpeg.so but *ALSO* needs to find
/usr/include/*jpeg.h

Did you do ldconfig after you installed the JPEG lib?
[Assuming you're on a distro that does that...]

Sometimes getting the OS to suck in the JPEG library makes it all better...

In fact, do:
ldconfig -v | grep -i jpeg
to see if you actually got JPEG into the OS.

I'm not 100% sure you need all this, but at least you know the JPEG stuff
is there if the OS can get it.

If it's not, dink around with /etc/ld.so.conf (or whatever it's named this
week) and add the directories you need to get jpeg.so to get sucked in.

 P.S.  Yes, I am remembering to start Apache.

I've seen some funky Apache restart scripts that would report a false
successful restart when, in fact, Apache neither stopped nor started...

Stop Apache, do ps aux | grep httpd to make sure it's gone, then
start it. Ugh.  Better to be 100% certain, though. Sure wish phpinfo() had
a php_uptime() in it...

If all else fails, you could read the config.log output in your PHP
directory and try to figure out what it's complaining about when it skips
the JPEG part and mindlessly continues to build the PHP binary that does
*NOT* have the parts you asked for...  Which I really don't think it
should do, personally, but there it is.

You'll want to search for JPEG and/or ERROR in that mess, cuz there's a
TON of output.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP 5.1 vm

2005-07-06 Thread Richard Lynch
On Wed, July 6, 2005 5:35 pm, Dan Rossi said:

 On 07/07/2005, at 10:26 AM, Richard Lynch wrote:
 slow switch

 You're a funny man Richard. So how is there overhead using callbacks if
 you dont mind me asking ?

I believe the callbacks imply a function stack, pushing/popping arguments,
and some pointer-chasing arithmetic to figure out where the callback-ed
function *IS* so it can JUMP to it...

Maybe the compiler can pre-compute all that crap, in theory, since all the
opcodes are constants, but I doubt it...

Maybe I'm grossly misleading y'all.

That compiler class I took *was* over a decade ago... :-^

Still got the book on my shelf.  That don't mean I'm gonna read that
sucker.  Though, as I recall, it was the second best textbook I ever read.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: help, no jpeg support compiled in

2005-07-06 Thread Christopher J. Bottaro
Richard Lynch wrote:

 On Wed, July 6, 2005 5:42 pm, Christopher J. Bottaro said:
 Warning: imagecreatefromstring() [function.imagecreatefromstring]: No
 JPEG support in this PHP build

 This is how I configured my php:

 ./configure --with-pgsql=/usr/local/postgres/ --with-apxs2=/usr/sbin/apxs
 --with-gd --with-zlib-dir=/usr/lib --with-jpeg-dir=/usr/lib

 I also tried with /usr instead of /usr/lib.
 
 /usr/lib is definitely Not Right.
 
 ./configure needs to find /usr/lib/*jpeg.so but *ALSO* needs to find
 /usr/include/*jpeg.h

I know, but the weird thing is that --with-zlib-dir=/usr/lib actually worked
(don't ask me why)!  It got PNG support working with GD that way.  So I
figured I'd try it that way with JPEG.

 Did you do ldconfig after you installed the JPEG lib?
 [Assuming you're on a distro that does that...]

Yeah, its a Fedora Core 3 install, so most of these image libs are already
installed:

ldconfig -v | grep -i jpeg
ldconfig: Path `/usr/X11R6/lib' given more than once
libjpeg.so.62 - libjpeg.so.62.0.0
libimlib-jpeg.so - libimlib-jpeg.so

 Sometimes getting the OS to suck in the JPEG library makes it all
 better...
 
 In fact, do:
 ldconfig -v | grep -i jpeg
 to see if you actually got JPEG into the OS.
 
 I'm not 100% sure you need all this, but at least you know the JPEG stuff
 is there if the OS can get it.

Oops, see above.

 If it's not, dink around with /etc/ld.so.conf (or whatever it's named this
 week) and add the directories you need to get jpeg.so to get sucked in.
 
 P.S.  Yes, I am remembering to start Apache.
 
 I've seen some funky Apache restart scripts that would report a false
 successful restart when, in fact, Apache neither stopped nor started...
 
 Stop Apache, do ps aux | grep httpd to make sure it's gone, then
 start it. Ugh.  Better to be 100% certain, though. Sure wish phpinfo() had
 a php_uptime() in it...

Interesting.  I'm pretty sure its restarting because I'm messing around with
different config options and phpinfo() is reporting different Configure
Commands each time.  I'll try that though.

 If all else fails, you could read the config.log output in your PHP
 directory and try to figure out what it's complaining about when it skips
 the JPEG part and mindlessly continues to build the PHP binary that does
 *NOT* have the parts you asked for...  Which I really don't think it
 should do, personally, but there it is.
 
 You'll want to search for JPEG and/or ERROR in that mess, cuz there's a
 TON of output.

Will do, thanks again for the help.  I'll report my findings when (and if) I
figure it out.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Compiling the example hello world extension on OSX with PHP 5.1

2005-07-06 Thread Dan Rossi
Hi there I am trying to compile the demo example hello world extension 
on OSX with no luck I keep getting errors when trying to compile.


iElectro:/usr/share/php-5.1.0b2/ext/hello electroteque$ make
gcc -dynamic -flat_namespace -bundle -undefined suppress -DPHP_ATOM_INC 
-I/usr/share/php-5.1.0b2/ext/hello/include 
-I/usr/share/php-5.1.0b2/ext/hello/main 
-I/usr/share/php-5.1.0b2/ext/hello -I/usr/include/php 
-I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend 
 -I/sw/include -DHAVE_CONFIG_H  -I/sw/include  -L/sw/lib -o hello.so  
hello.lo

ld: hello.lo bad magic number (not a Mach-O file)


Extension link is 
http://www.zend.com/php/internals/extension-writing1.php#Heading5



Any ideas what the issue is ?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Compiling the example hello world extension on OSX with PHP 5.1

2005-07-06 Thread Rasmus Lerdorf
Dan Rossi wrote:
 Hi there I am trying to compile the demo example hello world extension
 on OSX with no luck I keep getting errors when trying to compile.
 
 iElectro:/usr/share/php-5.1.0b2/ext/hello electroteque$ make
 gcc -dynamic -flat_namespace -bundle -undefined suppress -DPHP_ATOM_INC
 -I/usr/share/php-5.1.0b2/ext/hello/include
 -I/usr/share/php-5.1.0b2/ext/hello/main
 -I/usr/share/php-5.1.0b2/ext/hello -I/usr/include/php
 -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend
  -I/sw/include -DHAVE_CONFIG_H  -I/sw/include  -L/sw/lib -o hello.so 
 hello.lo
 ld: hello.lo bad magic number (not a Mach-O file)
 
 
 Extension link is
 http://www.zend.com/php/internals/extension-writing1.php#Heading5
 
 
 Any ideas what the issue is ?

Yeah, the OSX build is a bit messed up right now.  You can fix it
manually by doing a copy-paste of the final link line and replace
hello.lo with hello.o

-Rasmus

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Compiling the example hello world extension on OSX with PHP 5.1

2005-07-06 Thread Dan Rossi


On 07/07/2005, at 11:43 AM, Rasmus Lerdorf wrote:





Yeah, the OSX build is a bit messed up right now.  You can fix it
manually by doing a copy-paste of the final link line and replace
hello.lo with hello.o

-Rasmus




thanks mate however I get file cannot be found, i even tried to symlink 
it sneakily no luck


iElectro:/usr/share/php-5.1.0b2/ext/hello root# gcc -dynamic 
-flat_namespace -bundle -undefined suppress -DPHP_ATOM_INC 
-I/usr/share/php-5.1.0b2/ext/hello/include 
-I/usr/share/php-5.1.0b2/ext/hello/main 
-I/usr/share/php-5.1.0b2/ext/hello -I/usr/include/php 
-I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend 
 -I/sw/include -DHAVE_CONFIG_H  -I/sw/include  -L/sw/lib -o hello.so  
hello.o

gcc: hello.o: No such file or directory
gcc: no input files


with symlink

ld: hello.o bad magic number (not a Mach-O file)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Compiling the example hello world extension on OSX with PHP 5.1

2005-07-06 Thread Rasmus Lerdorf
Dan Rossi wrote:
 
 On 07/07/2005, at 11:43 AM, Rasmus Lerdorf wrote:
 


 Yeah, the OSX build is a bit messed up right now.  You can fix it
 manually by doing a copy-paste of the final link line and replace
 hello.lo with hello.o

 -Rasmus


 
 thanks mate however I get file cannot be found, i even tried to symlink
 it sneakily no luck

Well, where is it?  Probably in a libs or .libs directory.

-Rasmus

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



  1   2   >