RE: [PHP] Re: Help with directory !

2001-11-30 Thread Jani Mikkonen


> The first one works both ways!O and im working on windows
> This works fine : $loc = "./doos.txt"
> This works fine : $loc = ".\doos.txt"
> 
> The second one does work at all!
> Is it in the correct order/way?

How come you say "this one works fine" to the second row and in the next
deny it? Man ..

Anyway. PHP was first written unix in mind thus it use unix style
directory seperators eg / and not \. Reason is that \ is escape
character. For example \t is tab and \n is new line. But if you still
insist on using \ as directory seperator, you got to escape it using
another \, for example: 

$loc = ".\\some\\dir\textfile.txt"


-- 
 | ,_,Jani Mikkonen, Portal System Administrator, +358456700349
 |(O,O)   [EMAIL PROTECTED]
 |(   )Public pgp key @ http://www.mikkonen.org/jani/keyw.html
 +-"-"---] Save the whales, feed the hungry and free the mallocs  
 |



msg41535/pgp0.pgp
Description: PGP signature


Re: [PHP] Help anyone

2001-11-29 Thread Jani Mikkonen


> 
> 
> 

And if you want to make one of those selected use something like this:



 >
 >
 >




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Global storage of objects.

2001-11-29 Thread Jani Mikkonen

> I would like to know if there is a way to store objects globally from a
> php-page, so that the object can be used from another page.

Keyword is Serialization. If you save object to flatfile or to db, i dont
see any point why the result wouldnt be accessible from other places
(providing that those other places do have access to same datesource)

More info can be found @

http://www.php.net/manual/en/language.oop.serialization.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Sending fax with php, is it possible?

2001-11-29 Thread Jani Mikkonen

> A customer wants a order made by a forminput sent to fax. Is it possible
> with php? Or do I have to do it some other way?

Hey, php is a programming language, it does what ever you want (up to
certain restrictions ofcourse)

But for pointers, try installing hylafax (if you run *nix that is)  and
either, use its commandline tools or write the spooler to interact directly
with hylafax server (it uses protocol that resembles ftp (infact, its ftp
server but its own implementation)).

Btw, it would be interesting to write php classes to access hylafax server.
I promise to help out in desing and writing allthou i dont have modemline to
test anything.




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] database question

2001-11-29 Thread Jani Mikkonen

> select whatever from articles where textlines regexp "^\Sbingo\S$"

Again, that would fail if the word 'bingo' is and the end of the sentence.
Allthou i realized my own example doesnt work either in that case. Best way
would be remove all characters like ,.!? and and split the string into
words.

But another question, do regular expressions really work in string
comparisons ?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Re: database question

2001-11-29 Thread Jani Mikkonen

On Thu, 2001-11-29 at 14:59, Zozulak Peter wrote:
> and what about this ...
> 
> $sql = "SELECT a_column FROM table WHERE text_column LIKE '% $word %';
> 
> matching the word in the text ...
> 
> $sql = "SELECT a_column FROM table WHERE text_column LIKE '$word %';
> 
> matching the word at the begining of the text ...
> 
> $sql = "SELECT a_column FROM table WHERE text_column LIKE '% $word';
> 
> matching the word at the end of the text ...

3 selects against one, well depends what the user wants and how he
values code optimizing (versus executing optimizing) this might be
somewhat better approach:

SELECT stringvar FROM tablename WHERE FIND_IN_SET('BINGO',REPLACE(UCASE(stringvar),' 
',',')) > 0;

So like, first string is converted to uppercase, then all spaces are
made to colons, and then function find_in_set uses word "BINGO" to
locate if the textfield actually containts that word. Should be quite
exact match allthou i dont guarantee it to work (didnt test it, should
work thou)

Example:

"I want to   BinGo, would you want to come ?" -> would translate to
"I WANT TO   BINGO, WOULD YOU WANT TO COME ?" -> would translate to
"I,WANT,TO,,,BINGO,,WOULD,YOU,WANT,TO,COME,?" 

And result for find_in_set for this string would be 6 so it would
match..



-- 
 | ,_,  Jani Mikkonen, bofh and proud of it, +358456700349
 |(O,O)   http://www.mikkonen.org/jani
 |(   )  Pgp public key @ http://www.mikkonen.org/jani/keyh.html
 +-"-"---] And i repeat, I do not make mistakes that count.  
 |



msg41402/pgp0.pgp
Description: PGP signature


Re: [PHP] Re: database question

2001-11-29 Thread Jani Mikkonen


> $word = 'bingo';
> $sql = "SELECT a_column FROM table WHERE text_column LIKE '%$word%';
> $res = mysql_query($sql);
> // etc... for displaying results
> 
>   Resuming:
>   % on the beggining - doesn't matter what comes before
>   % on the end - doesn't matter what comes after

Yes, which means that all these following examples would lead to match:

abingo
bingob
abingob

So, this might lead to unwanted match..

-- 
 | ,_,  Jani Mikkonen, bofh and proud of it, +358456700349
 |(O,O)   http://www.mikkonen.org/jani
 |(   )  Pgp public key @ http://www.mikkonen.org/jani/keyh.html
 +-"-"---] Life is unfair but root passwords makes it bareable  
 |



msg41399/pgp0.pgp
Description: PGP signature


Re: [PHP] mysql pconnect voes

2001-11-29 Thread Jani Mikkonen


>  - can have one process more than one persistent connection ?

I dont quite understand this. What do you mean ? 

>  - how many children of apache do u have in one time ?

Depending on load, around 250-350. Heavily changes between nights and
businesshours and weekends.

>  - php.ini means configuration for each instance of php in memory ?

Thats what i was asking too. Is it per process (Apache process) or per
whole server. Eg. Does php work from shared memory as, is there only
once instance of php per apache process tree.

> by my experience every non-closed connection still persists,  so you can VERY
> FAST RUN OUT OF free conns.

I thought limitting all connections in the php.ini would prevent this
but as it seems, it doesnt.


> We have left this concept (persistent connections) for PHP/Apache solutions
> because of this problem.

Same here, we have converted most of the stuff on our site to servlets
because php doesnt just do what we need in same places.


> --
> jani mikkonen wrote:
> 
> > Im managing a really crowded webservers. We have article system implemented
> > in php and backend db is mysql (not my first choise but hey, it does the
> > job)
> >
> > Few version numbers:
> >
> > PHP: 4.0.6 (Self compiled, w/ gcc in solaris8)
> > Mysql: 3.23.24 (Self compiled, w/ gcc in solaris8, ok, not the latest
> > stable but i dont think this is the real problem)
> > Apache: 1.3.22 (Self compiled w/ no other 3rd party modules besides php)
> >
> > Our code uses pconnects throuout the whole site. Website is ran from 6
> > different sparc solaris boxes and one db box is serving them all. This
> > mysql has connection limit in 750 and all apache servers have following
> > three lines in their php.ini:
> >
> > mysql.allow_persistent=On
> > mysql.max_persistent=50
> > mysql.max_links=70
> >
> > Afaik (mysql.max_links - mysql.max_persistent)  is how many nonpersistent
> > connection i can have (in this case, 20 per server). And i have 50
> > persistent. So, i have 6 servers with 50 persistent connections and
> > all pconnects are to same db with same account so there should be
> > available connections in the pool.
> >
> > BUT. After 5 minutes or less (depending on the time/load) all connections
> > hang because php has  used *all* available connections in mysql server
> > (which is 750). I cant image how this is possible. I have 70 connections
> > per server, 6 servers, thats 420 max connectios, that should leave with
> > with 330 spare ones but now. Everything is used up. Even if i would have
> > 50+70 connections (120*6=720) per server, i would still have 30 spare ...
> >
> > So, only solution for me is to set mysql connection timeouts to really
> > low (20 seconds, when default value is 8 hours). And this leads me to
> > *huge* error logs. For example, i just deleted few months old mysql log
> > which was over 2 gigs.
> >
> > I have few ideas. Are these limits in php, per process or per whole
> > process tree ? Sounds to me that they are per process or pconnect still
> > has really nasty bugs in it.
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
-- 
 | ,_,  Jani Mikkonen, bofh and proud of it, +358456700349
 |(O,O)   http://www.mikkonen.org/jani
 |(   )  Pgp public key @ http://www.mikkonen.org/jani/keyh.html
 +-"-"---] Realmendon'tneedspacebars  
 |



msg41391/pgp0.pgp
Description: PGP signature


[PHP] mysql pconnect voes

2001-11-29 Thread jani mikkonen

Im managing a really crowded webservers. We have article system implemented
in php and backend db is mysql (not my first choise but hey, it does the
job)

Few version numbers:

PHP: 4.0.6 (Self compiled, w/ gcc in solaris8)
Mysql: 3.23.24 (Self compiled, w/ gcc in solaris8, ok, not the latest
stable but i dont think this is the real problem)
Apache: 1.3.22 (Self compiled w/ no other 3rd party modules besides php)

Our code uses pconnects throuout the whole site. Website is ran from 6
different sparc solaris boxes and one db box is serving them all. This
mysql has connection limit in 750 and all apache servers have following
three lines in their php.ini:

mysql.allow_persistent=On
mysql.max_persistent=50
mysql.max_links=70

Afaik (mysql.max_links - mysql.max_persistent)  is how many nonpersistent
connection i can have (in this case, 20 per server). And i have 50
persistent. So, i have 6 servers with 50 persistent connections and
all pconnects are to same db with same account so there should be
available connections in the pool.

BUT. After 5 minutes or less (depending on the time/load) all connections
hang because php has  used *all* available connections in mysql server
(which is 750). I cant image how this is possible. I have 70 connections
per server, 6 servers, thats 420 max connectios, that should leave with
with 330 spare ones but now. Everything is used up. Even if i would have
50+70 connections (120*6=720) per server, i would still have 30 spare ...

So, only solution for me is to set mysql connection timeouts to really
low (20 seconds, when default value is 8 hours). And this leads me to
*huge* error logs. For example, i just deleted few months old mysql log
which was over 2 gigs.

I have few ideas. Are these limits in php, per process or per whole
process tree ? Sounds to me that they are per process or pconnect still
has really nasty bugs in it.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]