Re: [PHP] Sending SMS via PHP

2008-02-21 Thread Per Jessen
Paul Scott wrote:

 What you need to do is ask yourself whether you are going to do high
 volume SMS or not, and look at when do the commercial providers become
 more economical? What a lot of people do, is sign up for an account
 and end up sending only 50 or so SMS a month, which is silly, when for
 the same price as a month or two's subscription, you could buy your
 own GSM modem and a prepaid SIM card and do it for half the price
 yourself.

Or use sms_client and only pay per individual SMS.  No subscription
needed.


/Per Jessen, Zürich

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



Re: [PHP] www. not working

2008-02-21 Thread Richard Heyes
A form of the web existing long before that depending on your 
definition of the web. To me it's a way for people to share 
information. That would cover the BBS world which pre-dates LANs by 
some distance.


Spider webs have existed for many a year...


Yeah, but when was the last time you saw porn on one of them?!!


Now that would be telling. :-)

--
Richard Heyes
http://www.websupportsolutions.co.uk

Knowledge Base and Helpdesk software hosted for you - no
installation, no maintenance, new features automatic and free

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



Re: [PHP] www. not working

2008-02-21 Thread Richard Heyes

Spider webs have existed for many a year...


Not long before the eggs hatched.



Debatable.

--
Richard Heyes
http://www.websupportsolutions.co.uk

Knowledge Base and Helpdesk software hosted for you - no
installation, no maintenance, new features automatic and free

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



Re: [PHP] Session destruction problem

2008-02-21 Thread Nathan Rixham

Adil Drissi wrote:

thank you tedd,

I understood what you explained to me last time. I was
wondering if there is another method to prevent that.

Thanks

--- tedd [EMAIL PROTECTED] wrote:


At 2:45 PM -0800 2/19/08, Adil Drissi wrote:

Hi,

Below you'll find my code. I think now that the
problem is in my algorithm, because the is created
anytime the page is refreshed. But i don't know how

to

check if the client was logged out or it is a real

new

connexion to the page. As you will see one can

click

on logout, then press the back button of the

browser,

and then refresh the page, but he is still

connected.

I would like to help me fixe that. Here is the

code:

You received an answer, but fail to understand.

Unless you use javascript to manipulate the
browser's history you are 
going to continue to have problems with the user
browser's back 
button.


But, explain why the user using the back button is a
problem. If he 
logs in, he's in. If he logs out, he's out. If he
hits the back 
button after logging out and cancels his log out --
so what? What 
problems does that present?


Cheers,

tedd


--
---
http://sperling.com  http://ancientstones.com 
http://earthstones.com


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






  

Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs


apologies, I completely forgot that your using session_destroy ammend to..

?php
session_start();
session_destroy();
unset($_SESSION);
session_write_close();
sleep(1);
header(location: /index.php);
?

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



Re: [PHP] Session destruction problem

2008-02-21 Thread Nathan Rixham

Adil Drissi wrote:

thank you tedd,

I understood what you explained to me last time. I was
wondering if there is another method to prevent that.

Thanks

--- tedd [EMAIL PROTECTED] wrote:


At 2:45 PM -0800 2/19/08, Adil Drissi wrote:

Hi,

Below you'll find my code. I think now that the
problem is in my algorithm, because the is created
anytime the page is refreshed. But i don't know how

to

check if the client was logged out or it is a real

new

connexion to the page. As you will see one can

click

on logout, then press the back button of the

browser,

and then refresh the page, but he is still

connected.

I would like to help me fixe that. Here is the

code:

You received an answer, but fail to understand.

Unless you use javascript to manipulate the
browser's history you are 
going to continue to have problems with the user
browser's back 
button.


But, explain why the user using the back button is a
problem. If he 
logs in, he's in. If he logs out, he's out. If he
hits the back 
button after logging out and cancels his log out --
so what? What 
problems does that present?


Cheers,

tedd


--
---
http://sperling.com  http://ancientstones.com 
http://earthstones.com


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






  

Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs


Looks like your on an old 4.x version of php; try the following.

?php
session_start();
unset($_SESSION[sessioname]);
session_destroy();
session_write_close();
sleep(1);
header(location: index.php);
?

Regards

Nathan

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



Re: [PHP] www. not working

2008-02-21 Thread HostWare Kft.


A form of the web existing long before that depending on your 
definition of the web. To me it's a way for people to share 
information. That would cover the BBS world which pre-dates LANs by 
some distance.


Spider webs have existed for many a year...


Yeah, but when was the last time you saw porn on one of them?!!


Do you know Black Widow? :-)

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



Re: [PHP] fail on preg_match_all

2008-02-21 Thread Nathan Rixham

Hamilton Turner wrote:
Just a follow-up on this, the problem was 'Fatal error: Allowed memory 
size of 8388608 bytes exhausted'


After some nice help, I found that this is actually a common problem 
with intense regexes in php. Quick fix is using ini_set() to increase 
your memory_limit to something massive, like '400M'. This gives your 
script access to that much memory for its life-time. If you have this 
problem, then you probably also have to do this


set_time_limit(0);  //remove any max execution time

Hamilton


PS - for anyone confused, here was the script . . . i didnt think it was 
that confusing, sorry guys!


function parse_access($file_name)
{
   // read file data into variable
   $fh = fopen($file_name, 'r') or die(cant open file for reading);
   $theData = fread($fh, filesize($file_name));
   fclose($fh);

   // perform regex
   $regex = '!(\d{0,3}\.\d{0,3}\.\d{0,3}\.\d{0,3}) - - 
\[(\d{2})/(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Aug|Oct|Nov|Dec)/(\d{4}):(\d{2}):(\d{2}):(\d{2}) 
-\d+] {1,4}GET ([._0-9\-%a-zA-Z/,?=]+) ([.0-9a-zA-Z%/\-,_?]+) (\d{3}) 
(\d+) \[(.+?)] \[(.+?)] \[(.+?)] (\d+) (\d+) (\d+) (\d+) (\d+) (\d+)!';

   //echo $regex . 'brbrhrbr';
   $num = preg_match_all($regex, $theData, $match, PREG_SET_ORDER);
   //echo after regex - we are still alive!;

   //go on to do some boring stuff, like write this to an array, perform 
stuff, graph stuff, blah blah

}






Can you also post a few lines from your access log so we've got 
something to test against.


The regex looks incorrect to me in a few places:
-\d+] {1,4}
for example.

How to debug your script:

make a copy of the log file and trim it down to say 20 lines; run the 
script on it to verify it's doing what you want it to.


check the size of the real log file, then multiply it by 2.5 and see 
if the total is greater than your php max memory setting. (exp: $theData 
will hold the full file, matches will also hold another copy of most of 
the file, then a bit extra for php to use)


Regards

Nathan

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



Re: [PHP] fail on preg_match_all

2008-02-21 Thread Stut

Hamilton Turner wrote:
Just a follow-up on this, the problem was 'Fatal error: Allowed memory 
size of 8388608 bytes exhausted'


After some nice help, I found that this is actually a common problem 
with intense regexes in php. Quick fix is using ini_set() to increase 
your memory_limit to something massive, like '400M'. This gives your 
script access to that much memory for its life-time. If you have this 
problem, then you probably also have to do this


set_time_limit(0);  //remove any max execution time

Hamilton

PS - for anyone confused, here was the script . . . i didnt think it was 
that confusing, sorry guys!


function parse_access($file_name)
{
   // read file data into variable
   $fh = fopen($file_name, 'r') or die(cant open file for reading);
   $theData = fread($fh, filesize($file_name));
   fclose($fh);

   // perform regex
   $regex = '!(\d{0,3}\.\d{0,3}\.\d{0,3}\.\d{0,3}) - - 
\[(\d{2})/(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Aug|Oct|Nov|Dec)/(\d{4}):(\d{2}):(\d{2}):(\d{2}) 
-\d+] {1,4}GET ([._0-9\-%a-zA-Z/,?=]+) ([.0-9a-zA-Z%/\-,_?]+) (\d{3}) 
(\d+) \[(.+?)] \[(.+?)] \[(.+?)] (\d+) (\d+) (\d+) (\d+) (\d+) (\d+)!';

   //echo $regex . 'brbrhrbr';
   $num = preg_match_all($regex, $theData, $match, PREG_SET_ORDER);
   //echo after regex - we are still alive!;

   //go on to do some boring stuff, like write this to an array, perform 
stuff, graph stuff, blah blah

}


Increasing the memory limit is the worst possible solution to this 
problem.


It's a giant file, and your regex is basically pulling out each line. 
For the love of $DEITY learn about fgets and process each line one by 
one rather than loading in the whole file. It'll be a lot faster and 
won't suck your memory dry while it runs.


-Stut

--
http://stut.net/

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



[PHP] All Survey leading to PHP

2008-02-21 Thread Allan Fernandes
Hi,

I have been doing a survey on which development environment will be the best
to move on to. PHP is most highly recommended. I have following doubts
though.
1) Is there any method to protect source code of my applications even when
deployed at the clients Server.
2) Can I call Delphi Dll's

Regards
Allan

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



Re: [PHP] www. not working

2008-02-21 Thread Jason Pruim


On Feb 21, 2008, at 5:13 AM, Richard Heyes wrote:


Spider webs have existed for many a year...

   Not long before the eggs hatched.



Debatable.


Are we about to go into another chicken/egg then? Or in this case,  
spider porn/egg


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]

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



RES: [PHP] All Survey leading to PHP

2008-02-21 Thread Thiago Pojda
Point 1 I can answer, not sure about 2.

1) Yes there is, there are many tools for that on the Web. First one that
comes to my mind is Zend Guard, it generates .class-like files. But this one
requires some extra stuff on the web server which some others don't.

-Mensagem original-
De: Allan Fernandes [mailto:[EMAIL PROTECTED] 
Enviada em: quinta-feira, 21 de fevereiro de 2008 09:29
Para: php-general@lists.php.net
Assunto: [PHP] All Survey leading to PHP

Hi,

I have been doing a survey on which development environment will be the best
to move on to. PHP is most highly recommended. I have following doubts
though.
1) Is there any method to protect source code of my applications even when
deployed at the clients Server.
2) Can I call Delphi Dll's

Regards
Allan

--
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] fail on preg_match_all

2008-02-21 Thread Robin Vickery
On 21/02/2008, Nathan Rixham [EMAIL PROTECTED] wrote:
  The regex looks incorrect to me in a few places:
  -\d+] {1,4}
  for example.

That's ok, albeit confusing:

* The ']' is a literal ']' not the closing bracket of a character class.
* The {1,4} applies to the space character.

-robin

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



Re: [PHP] Session destruction problem

2008-02-21 Thread tedd

At 10:47 AM + 2/21/08, Nathan Rixham wrote:

apologies, I completely forgot that your using session_destroy ammend to..

?php
session_start();
session_destroy();
unset($_SESSION);
session_write_close();
sleep(1);
header(location: /index.php);
?


Nathan:

I don't think it's that simple.

For example, go here:

http://www.webbytedd.com//destroy-sessions/index.php

Login using anything.

Log out.

Click the browser back button.

I think this is what the OP was talking about.

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] www. not working

2008-02-21 Thread Børge Holen
On Thursday 21 February 2008 13:41:20 Jason Pruim wrote:
 On Feb 21, 2008, at 5:13 AM, Richard Heyes wrote:
  Spider webs have existed for many a year...
 
 Not long before the eggs hatched.
 
  Debatable.

 Are we about to go into another chicken/egg then? Or in this case,
 spider porn/egg

this bestiality shouldn't even exist as a topic


 --

 Jason Pruim
 Raoset Inc.
 Technology Manager
 MQC Specialist
 3251 132nd ave
 Holland, MI, 49424
 www.raoset.com
 [EMAIL PROTECTED]



-- 
---
Børge Holen
http://www.arivene.net

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



[PHP] temporary error

2008-02-21 Thread Mirco Soderi
Consider the following code:

$sqlQueryInserimentoDatiAllenamentoCalciPiazzati = INSERT INTO ... etc etc 

$queryInserimentoDatiAllenamentoCalciPiazzati = 
mysql_query($sqlQueryInserimentoDatiAllenamentoCalciPiazzati);
if($queryInserimentoDatiAllenamentoCalciPiazzati) { // do something }
if($queryInserimentoDatiAllenamentoCalciPiazzati) {
$logQueryInserimentoDatiAllenamentoCalciPiazzati = mysql_query(insert 
into log ... etc etc ...);
if($logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do something }
}
if($queryInserimentoDatiAllenamentoCalciPiazzati  
$logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do something }

1st execution: $queryInserimentoDatiAllenamentoCalciPiazzati  
$logQueryInserimentoDatiAllenamentoCalciPiazzati, where clause of last 
conditional statement, evaluates to false even if both queries are correctly 
executed.

I modify as follows:

$sqlQueryInserimentoDatiAllenamentoCalciPiazzati = INSERT INTO ... etc etc 

$queryInserimentoDatiAllenamentoCalciPiazzati = 
mysql_query($sqlQueryInserimentoDatiAllenamentoCalciPiazzati);
if($queryInserimentoDatiAllenamentoCalciPiazzati) { // do something } else 
echo(error message 1);
if($queryInserimentoDatiAllenamentoCalciPiazzati) {
$logQueryInserimentoDatiAllenamentoCalciPiazzati = mysql_query(insert 
into log ... etc etc ...);
if($logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do something } 
else echo(error message 2);
}
if($queryInserimentoDatiAllenamentoCalciPiazzati  
$logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do something }

2nd execution: $queryInserimentoDatiAllenamentoCalciPiazzati  
$logQueryInserimentoDatiAllenamentoCalciPiazzati, where clause of last 
conditional statement, evaluates to true.

Now, I modify again, back to the original version:

$sqlQueryInserimentoDatiAllenamentoCalciPiazzati = INSERT INTO ... etc etc 

$queryInserimentoDatiAllenamentoCalciPiazzati = 
mysql_query($sqlQueryInserimentoDatiAllenamentoCalciPiazzati);
if($queryInserimentoDatiAllenamentoCalciPiazzati) { // do something }
if($queryInserimentoDatiAllenamentoCalciPiazzati) {
$logQueryInserimentoDatiAllenamentoCalciPiazzati = mysql_query(insert 
into log ... etc etc ...);
if($logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do something }
}
if($queryInserimentoDatiAllenamentoCalciPiazzati  
$logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do something }

3rd execution: $queryInserimentoDatiAllenamentoCalciPiazzati  
$logQueryInserimentoDatiAllenamentoCalciPiazzati, where clause of last 
conditional statement, evaluates to true.

Do you know any reason for that? 

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



Re: [PHP] temporary error

2008-02-21 Thread Paul Scott

On Thu, 2008-02-21 at 14:54 +0100, Mirco Soderi wrote:
 Consider the following code:
 
 $sqlQueryInserimentoDatiAllenamentoCalciPiazzati = INSERT INTO ... etc etc 

How long does it take you to write a single line of code with variable
names like that?

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] temporary error

2008-02-21 Thread Daniel Brown
On Thu, Feb 21, 2008 at 8:54 AM, Mirco Soderi [EMAIL PROTECTED] wrote:
 Consider the following code:

  $sqlQueryInserimentoDatiAllenamentoCalciPiazzati = INSERT INTO ... etc etc
  
  $queryInserimentoDatiAllenamentoCalciPiazzati =
  mysql_query($sqlQueryInserimentoDatiAllenamentoCalciPiazzati);
  if($queryInserimentoDatiAllenamentoCalciPiazzati) { // do something }
[snip!]

Holy crap, so much for compact and clean code.  It must take you
days to write a script!  ;-P

In any case, there are a ton of syntax errors in your second block
of code.  Missing closing brackets, semicolons, et cetera.  It
shouldn't even compile (fatal errors).

Also, after rewriting all three blocks of code so that I could
read them without having a seizure, it looks like it's a problem with
your database.  Unless you're actually trying to see if
$sqlQueryInserimentoDatiAllenamentoCalciPiazzati is true (in block
#2), which you just defined as an SQL statement, whereas you're trying
to see if $queryInserimentoDatiAllenamentoCalciPiazzati is true (in
block #3), which you just defined as a resource identifier.

-- 
/Dan

Daniel P. Brown
Senior Unix Geek
? while(1) { $me = $mind--; sleep(86400); } ?

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



[PHP] Re: temporary error

2008-02-21 Thread Mirco Soderi
In my opinion, variable names are a personal choice, I think the time you 
loose when writing the name (about a second is long less than the time you 
gain when, months later, you go and modify the code and you have clear the 
content and meaning of each variable.

In the original code there were no sintax errors, I added some errors when 
pasting here. Sorry.

I have found that in the first execution, it was the 
$logQueryInserimentoDatiAllenamentoCalciPiazzati that evaluated to false. 
After having removed the two-field key that I had originally defined for 
that table and having added an autoincrement key, the problem seems to be 
solved.

Do you find any reason for that?


Mirco Soderi [EMAIL PROTECTED] ha scritto nel messaggio 
news:[EMAIL PROTECTED]
 Consider the following code:

 $sqlQueryInserimentoDatiAllenamentoCalciPiazzati = INSERT INTO ... etc 
 etc 
 $queryInserimentoDatiAllenamentoCalciPiazzati = 
 mysql_query($sqlQueryInserimentoDatiAllenamentoCalciPiazzati);
 if($queryInserimentoDatiAllenamentoCalciPiazzati) { // do something }
 if($queryInserimentoDatiAllenamentoCalciPiazzati) {
$logQueryInserimentoDatiAllenamentoCalciPiazzati = mysql_query(insert 
 into log ... etc etc ...);
if($logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do 
 something }
 }
 if($queryInserimentoDatiAllenamentoCalciPiazzati  
 $logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do something }

 1st execution: $queryInserimentoDatiAllenamentoCalciPiazzati  
 $logQueryInserimentoDatiAllenamentoCalciPiazzati, where clause of last 
 conditional statement, evaluates to false even if both queries are 
 correctly executed.

 I modify as follows:

 $sqlQueryInserimentoDatiAllenamentoCalciPiazzati = INSERT INTO ... etc 
 etc 
 $queryInserimentoDatiAllenamentoCalciPiazzati = 
 mysql_query($sqlQueryInserimentoDatiAllenamentoCalciPiazzati);
 if($queryInserimentoDatiAllenamentoCalciPiazzati) { // do something } else 
 echo(error message 1);
 if($queryInserimentoDatiAllenamentoCalciPiazzati) {
$logQueryInserimentoDatiAllenamentoCalciPiazzati = mysql_query(insert 
 into log ... etc etc ...);
if($logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do 
 something } else echo(error message 2);
 }
 if($queryInserimentoDatiAllenamentoCalciPiazzati  
 $logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do something }

 2nd execution: $queryInserimentoDatiAllenamentoCalciPiazzati  
 $logQueryInserimentoDatiAllenamentoCalciPiazzati, where clause of last 
 conditional statement, evaluates to true.

 Now, I modify again, back to the original version:

 $sqlQueryInserimentoDatiAllenamentoCalciPiazzati = INSERT INTO ... etc 
 etc 
 $queryInserimentoDatiAllenamentoCalciPiazzati = 
 mysql_query($sqlQueryInserimentoDatiAllenamentoCalciPiazzati);
 if($queryInserimentoDatiAllenamentoCalciPiazzati) { // do something }
 if($queryInserimentoDatiAllenamentoCalciPiazzati) {
$logQueryInserimentoDatiAllenamentoCalciPiazzati = mysql_query(insert 
 into log ... etc etc ...);
if($logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do 
 something }
 }
 if($queryInserimentoDatiAllenamentoCalciPiazzati  
 $logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do something }

 3rd execution: $queryInserimentoDatiAllenamentoCalciPiazzati  
 $logQueryInserimentoDatiAllenamentoCalciPiazzati, where clause of last 
 conditional statement, evaluates to true.

 Do you know any reason for that? 

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



[PHP] APC __autoload webclusters

2008-02-21 Thread Jochem Maas

hi people,

1. __autoload  APC

I have been STW to try and find a definitive answer as to whether using 
__autoload with APC
is a bad idea ... and if so why? ... I can't find that definitive answer, can 
anyone here
state whether this it's an absolutely bad idea to use __autoload with APC? (I 
need to
speed up an app that currently loads in pretty much everything on every request 
... and it's
impossible to untangle the class interdependencies, in the time I have, and 
thereby load only
what is absolutely needed, when it's needed ... so I want to give __autoload() 
a shot in order
to minimize what classes are loaded.

2. webclusters  APC

I'm building a load-balanced cluster for the same app ... a certain times new 
data is imported
from a thirdparty system after which some APC cached data needs to be cleared, 
in the same vein
I occasionally roll out a new version and then the APC opcode cache needs to be 
cleared (each webserver
in the cluster has it's own APC cache obviously).

now I'm stuck with the problem of how to trigger the cache clearance on all 
servers ... Greg Donald
already mentioned the ruby based capistrano for executing commands on multiple 
remote servers and I'll
be using that to manage things like cache clearance, webserver restarting, etc 
on all the webservers

... BUT I have found that it is not possible to control the APC cache of 
php_mod from the CLI version of
php, they apparently use different APC caches. it seems that the only way to 
control the APC cache of
mod_php is via a web interface. APC ships with the very handy apc.php script 
but this is hardly a decent
way of controlling/clearing the APC cache of multiple machine programmatically.

Am I stuck with one of:

1. doing a graceful restart of all servers (which causes APCs cache to 
disappear)?
2. writing a cmdline script that performs a URL request to a copy of apc.php 
that is reachable via each
webserver in order to clear/manage the APC cache?

or is there another way that I can control the webserver's APC cache from the 
cmdline?

rgds,
Jochem

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



[PHP] Re: temporary error

2008-02-21 Thread Shawn McKenzie
Mirco Soderi wrote:
 In my opinion, variable names are a personal choice, I think the time
 you loose when writing the name (about a second is long less than the
 time you gain when, months later, you go and modify the code and you
 have clear the content and meaning of each variable.
 
 In the original code there were no sintax errors, I added some errors
 when pasting here. Sorry.
 
 I have found that in the first execution, it was the 
 $logQueryInserimentoDatiAllenamentoCalciPiazzati that evaluated to
 false. After having removed the two-field key that I had originally
 defined for that table and having added an autoincrement key, the
 problem seems to be solved.
 
 Do you find any reason for that?
 
 
 Mirco Soderi [EMAIL PROTECTED] ha scritto nel messaggio 
 news:[EMAIL PROTECTED]
 Consider the following code:
 
 $sqlQueryInserimentoDatiAllenamentoCalciPiazzati = INSERT INTO ...
 etc etc  $queryInserimentoDatiAllenamentoCalciPiazzati = 
 mysql_query($sqlQueryInserimentoDatiAllenamentoCalciPiazzati); 
 if($queryInserimentoDatiAllenamentoCalciPiazzati) { // do something
 } if($queryInserimentoDatiAllenamentoCalciPiazzati) { 
 $logQueryInserimentoDatiAllenamentoCalciPiazzati =
 mysql_query(insert into log ... etc etc ...); 
 if($logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do 
 something } } if($queryInserimentoDatiAllenamentoCalciPiazzati  
 $logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do something
 }
 
 1st execution: $queryInserimentoDatiAllenamentoCalciPiazzati  
 $logQueryInserimentoDatiAllenamentoCalciPiazzati, where clause of
 last conditional statement, evaluates to false even if both queries
 are correctly executed.
 
 I modify as follows:
 
 $sqlQueryInserimentoDatiAllenamentoCalciPiazzati = INSERT INTO ...
 etc etc  $queryInserimentoDatiAllenamentoCalciPiazzati = 
 mysql_query($sqlQueryInserimentoDatiAllenamentoCalciPiazzati); 
 if($queryInserimentoDatiAllenamentoCalciPiazzati) { // do something
 } else echo(error message 1); 
 if($queryInserimentoDatiAllenamentoCalciPiazzati) { 
 $logQueryInserimentoDatiAllenamentoCalciPiazzati =
 mysql_query(insert into log ... etc etc ...); 
 if($logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do 
 something } else echo(error message 2); } 
 if($queryInserimentoDatiAllenamentoCalciPiazzati  
 $logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do something
 }
 
 2nd execution: $queryInserimentoDatiAllenamentoCalciPiazzati  
 $logQueryInserimentoDatiAllenamentoCalciPiazzati, where clause of
 last conditional statement, evaluates to true.
 
 Now, I modify again, back to the original version:
 
 $sqlQueryInserimentoDatiAllenamentoCalciPiazzati = INSERT INTO ...
 etc etc  $queryInserimentoDatiAllenamentoCalciPiazzati = 
 mysql_query($sqlQueryInserimentoDatiAllenamentoCalciPiazzati); 
 if($queryInserimentoDatiAllenamentoCalciPiazzati) { // do something
 } if($queryInserimentoDatiAllenamentoCalciPiazzati) { 
 $logQueryInserimentoDatiAllenamentoCalciPiazzati =
 mysql_query(insert into log ... etc etc ...); 
 if($logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do 
 something } } if($queryInserimentoDatiAllenamentoCalciPiazzati  
 $logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do something
 }
 
 3rd execution: $queryInserimentoDatiAllenamentoCalciPiazzati  
 $logQueryInserimentoDatiAllenamentoCalciPiazzati, where clause of
 last conditional statement, evaluates to true.
 
 Do you know any reason for that?

Glad to see that you found your problem. Variables may be easier to read
with some underscores.

Personally, here is what I use as a counter in most all of my code,
instead of $i++; which isn't always clear.

$Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter =
$Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter +
($Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter /
$Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter);

If you wan to shorten a bit you can use a constant as the counter
increment like so:

define('Increment_Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter', 1);

$Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter =
$Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter +
Increment_Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter;

-Shawn

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



RE: [PHP] Re: temporary error

2008-02-21 Thread Andrés Robinet
 -Original Message-
 From: Shawn McKenzie [mailto:[EMAIL PROTECTED]
 Sent: Thursday, February 21, 2008 10:36 AM
 To: php-general@lists.php.net
 Subject: [PHP] Re: temporary error
 
 Mirco Soderi wrote:
  In my opinion, variable names are a personal choice, I think the time
  you loose when writing the name (about a second is long less than the
  time you gain when, months later, you go and modify the code and you
  have clear the content and meaning of each variable.
 
  In the original code there were no sintax errors, I added some errors
  when pasting here. Sorry.
 
  I have found that in the first execution, it was the
  $logQueryInserimentoDatiAllenamentoCalciPiazzati that evaluated to
  false. After having removed the two-field key that I had originally
  defined for that table and having added an autoincrement key, the
  problem seems to be solved.
 
  Do you find any reason for that?
 
 
  Mirco Soderi [EMAIL PROTECTED] ha scritto nel messaggio
  news:[EMAIL PROTECTED]
  Consider the following code:
 
  $sqlQueryInserimentoDatiAllenamentoCalciPiazzati = INSERT INTO ...
  etc etc  $queryInserimentoDatiAllenamentoCalciPiazzati =
  mysql_query($sqlQueryInserimentoDatiAllenamentoCalciPiazzati);
  if($queryInserimentoDatiAllenamentoCalciPiazzati) { // do something
  } if($queryInserimentoDatiAllenamentoCalciPiazzati) {
  $logQueryInserimentoDatiAllenamentoCalciPiazzati =
  mysql_query(insert into log ... etc etc ...);
  if($logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do
  something } } if($queryInserimentoDatiAllenamentoCalciPiazzati 
  $logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do something
  }
 
  1st execution: $queryInserimentoDatiAllenamentoCalciPiazzati 
  $logQueryInserimentoDatiAllenamentoCalciPiazzati, where clause of
  last conditional statement, evaluates to false even if both queries
  are correctly executed.
 
  I modify as follows:
 
  $sqlQueryInserimentoDatiAllenamentoCalciPiazzati = INSERT INTO ...
  etc etc  $queryInserimentoDatiAllenamentoCalciPiazzati =
  mysql_query($sqlQueryInserimentoDatiAllenamentoCalciPiazzati);
  if($queryInserimentoDatiAllenamentoCalciPiazzati) { // do something
  } else echo(error message 1);
  if($queryInserimentoDatiAllenamentoCalciPiazzati) {
  $logQueryInserimentoDatiAllenamentoCalciPiazzati =
  mysql_query(insert into log ... etc etc ...);
  if($logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do
  something } else echo(error message 2); }
  if($queryInserimentoDatiAllenamentoCalciPiazzati 
  $logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do something
  }
 
  2nd execution: $queryInserimentoDatiAllenamentoCalciPiazzati 
  $logQueryInserimentoDatiAllenamentoCalciPiazzati, where clause of
  last conditional statement, evaluates to true.
 
  Now, I modify again, back to the original version:
 
  $sqlQueryInserimentoDatiAllenamentoCalciPiazzati = INSERT INTO ...
  etc etc  $queryInserimentoDatiAllenamentoCalciPiazzati =
  mysql_query($sqlQueryInserimentoDatiAllenamentoCalciPiazzati);
  if($queryInserimentoDatiAllenamentoCalciPiazzati) { // do something
  } if($queryInserimentoDatiAllenamentoCalciPiazzati) {
  $logQueryInserimentoDatiAllenamentoCalciPiazzati =
  mysql_query(insert into log ... etc etc ...);
  if($logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do
  something } } if($queryInserimentoDatiAllenamentoCalciPiazzati 
  $logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do something
  }
 
  3rd execution: $queryInserimentoDatiAllenamentoCalciPiazzati 
  $logQueryInserimentoDatiAllenamentoCalciPiazzati, where clause of
  last conditional statement, evaluates to true.
 
  Do you know any reason for that?
 
 Glad to see that you found your problem. Variables may be easier to read
 with some underscores.
 
 Personally, here is what I use as a counter in most all of my code,
 instead of $i++; which isn't always clear.
 
 $Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter =
 $Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter +
 ($Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter /
 $Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter);
 
 If you wan to shorten a bit you can use a constant as the counter
 increment like so:
 
 define('Increment_Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter', 1);
 
 $Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter =
 $Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter +
 Increment_Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter;
 
 -Shawn
 

You forgot to add the project name you are working on to the counter, this way
you'll never confuse yourself at all.

define('Increment_Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter_For_Project
_Spaghetti', 1);

$Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter_For_Project_Spaghetti =
$Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter_For_Project_Spaghetti +
Increment_Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter_For_Project_Spaghet
ti;

LOL

-- 
PHP General Mailing List (http://www.php.net/)
To 

Re: [PHP] Re: temporary error

2008-02-21 Thread Robert Cummings
On Thu, 2008-02-21 at 09:35 -0600, Shawn McKenzie wrote:
 Mirco Soderi wrote:
  In my opinion, variable names are a personal choice, I think the time
  you loose when writing the name (about a second is long less than the
  time you gain when, months later, you go and modify the code and you
  have clear the content and meaning of each variable.
  
  In the original code there were no sintax errors, I added some errors
  when pasting here. Sorry.
  
  I have found that in the first execution, it was the 
  $logQueryInserimentoDatiAllenamentoCalciPiazzati that evaluated to
  false. After having removed the two-field key that I had originally
  defined for that table and having added an autoincrement key, the
  problem seems to be solved.
  
  Do you find any reason for that?
  
  
  Mirco Soderi [EMAIL PROTECTED] ha scritto nel messaggio 
  news:[EMAIL PROTECTED]
  Consider the following code:
  
  $sqlQueryInserimentoDatiAllenamentoCalciPiazzati = INSERT INTO ...
  etc etc  $queryInserimentoDatiAllenamentoCalciPiazzati = 
  mysql_query($sqlQueryInserimentoDatiAllenamentoCalciPiazzati); 
  if($queryInserimentoDatiAllenamentoCalciPiazzati) { // do something
  } if($queryInserimentoDatiAllenamentoCalciPiazzati) { 
  $logQueryInserimentoDatiAllenamentoCalciPiazzati =
  mysql_query(insert into log ... etc etc ...); 
  if($logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do 
  something } } if($queryInserimentoDatiAllenamentoCalciPiazzati  
  $logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do something
  }
  
  1st execution: $queryInserimentoDatiAllenamentoCalciPiazzati  
  $logQueryInserimentoDatiAllenamentoCalciPiazzati, where clause of
  last conditional statement, evaluates to false even if both queries
  are correctly executed.
  
  I modify as follows:
  
  $sqlQueryInserimentoDatiAllenamentoCalciPiazzati = INSERT INTO ...
  etc etc  $queryInserimentoDatiAllenamentoCalciPiazzati = 
  mysql_query($sqlQueryInserimentoDatiAllenamentoCalciPiazzati); 
  if($queryInserimentoDatiAllenamentoCalciPiazzati) { // do something
  } else echo(error message 1); 
  if($queryInserimentoDatiAllenamentoCalciPiazzati) { 
  $logQueryInserimentoDatiAllenamentoCalciPiazzati =
  mysql_query(insert into log ... etc etc ...); 
  if($logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do 
  something } else echo(error message 2); } 
  if($queryInserimentoDatiAllenamentoCalciPiazzati  
  $logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do something
  }
  
  2nd execution: $queryInserimentoDatiAllenamentoCalciPiazzati  
  $logQueryInserimentoDatiAllenamentoCalciPiazzati, where clause of
  last conditional statement, evaluates to true.
  
  Now, I modify again, back to the original version:
  
  $sqlQueryInserimentoDatiAllenamentoCalciPiazzati = INSERT INTO ...
  etc etc  $queryInserimentoDatiAllenamentoCalciPiazzati = 
  mysql_query($sqlQueryInserimentoDatiAllenamentoCalciPiazzati); 
  if($queryInserimentoDatiAllenamentoCalciPiazzati) { // do something
  } if($queryInserimentoDatiAllenamentoCalciPiazzati) { 
  $logQueryInserimentoDatiAllenamentoCalciPiazzati =
  mysql_query(insert into log ... etc etc ...); 
  if($logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do 
  something } } if($queryInserimentoDatiAllenamentoCalciPiazzati  
  $logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do something
  }
  
  3rd execution: $queryInserimentoDatiAllenamentoCalciPiazzati  
  $logQueryInserimentoDatiAllenamentoCalciPiazzati, where clause of
  last conditional statement, evaluates to true.
  
  Do you know any reason for that?
 
 Glad to see that you found your problem. Variables may be easier to read
 with some underscores.
 
 Personally, here is what I use as a counter in most all of my code,
 instead of $i++; which isn't always clear.
 
 $Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter =
 $Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter +
 ($Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter /
 $Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter);
 
 If you wan to shorten a bit you can use a constant as the counter
 increment like so:
 
 define('Increment_Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter', 1);
 
 $Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter =
 $Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter +
 Increment_Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter;

When keeping track of patients at the local hospital we like to indicate
whether they have certain afflications.

$patient-pneumonoultramicroscopicsilicovolcanoconiosis = false;

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 

Re: RES: [PHP] All Survey leading to PHP

2008-02-21 Thread Jim Lucas

Thiago Pojda wrote:

Point 1 I can answer, not sure about 2.

1) Yes there is, there are many tools for that on the Web. First one that
comes to my mind is Zend Guard, it generates .class-like files. But this one
requires some extra stuff on the web server which some others don't.


But, unfortunately, where there is a will, there is a way.

Anything you do, someone can undo.



-Mensagem original-
De: Allan Fernandes [mailto:[EMAIL PROTECTED] 
Enviada em: quinta-feira, 21 de fevereiro de 2008 09:29

Para: php-general@lists.php.net
Assunto: [PHP] All Survey leading to PHP

Hi,

I have been doing a survey on which development environment will be the best
to move on to. PHP is most highly recommended. I have following doubts
though.
1) Is there any method to protect source code of my applications even when
deployed at the clients Server.
2) Can I call Delphi Dll's

Regards
Allan

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




--
Jim Lucas

   Some men are born to greatness, some achieve greatness,
   and some have greatness thrust upon them.

Twelfth Night, Act II, Scene V
by William Shakespeare

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



Re: [PHP] All Survey leading to PHP

2008-02-21 Thread Richard Lynch
On Thu, February 21, 2008 6:29 am, Allan Fernandes wrote:
 1) Is there any method to protect source code of my applications even
 when
 deployed at the clients Server.

Have a good, clear contract and relationship with the client.

You can also attempt to encode them with any number of PHP encoders,
all of which have been and can be cracked by a determined user.

 2) Can I call Delphi Dll's

You may be able to use COM objects.
http://php.net/com

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] fail on preg_match_all

2008-02-21 Thread Richard Lynch
On Wed, February 20, 2008 11:34 pm, Hamilton Turner wrote:
 Does anyone know why a server would simply fail on this line?

 $num = preg_match_all($regex, $theData, $match, PREG_SET_ORDER);

 if i know the file handle is valid (i grabbed it using 'or die'), and
 the regex is valid

Define fail...

There are any number of things that could be going wrong.

Check your logs, dump out the data, etc

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] APC __autoload webclusters

2008-02-21 Thread Jochem Maas

Richard Lynch schreef:

On Thu, February 21, 2008 9:27 am, Jochem Maas wrote:

1. __autoload  APC

I have been STW to try and find a definitive answer as to whether
using __autoload with APC
is a bad idea ... and if so why? ... I can't find that definitive
answer, can anyone here
state whether this it's an absolutely bad idea to use __autoload with
APC? (I need to
speed up an app that currently loads in pretty much everything on
every request ... and it's
impossible to untangle the class interdependencies, in the time I
have, and thereby load only
what is absolutely needed, when it's needed ... so I want to give
__autoload() a shot in order
to minimize what classes are loaded.


If it's that inter-tangled, then I would hazard a WILD GUESS that the
__autoload will still end up loading everything...


but not on every request ;-) ... I do use output caching, and I know
not everything is actually used in every request.

I'm being optimistic and hoping it has a marginally positive effective on
average request processing time.




2. webclusters  APC

I'm building a load-balanced cluster for the same app ... a certain
times new data is imported
from a thirdparty system after which some APC cached data needs to be
cleared, in the same vein
I occasionally roll out a new version and then the APC opcode cache
needs to be cleared (each webserver
in the cluster has it's own APC cache obviously).

now I'm stuck with the problem of how to trigger the cache clearance
on all servers ... Greg Donald
already mentioned the ruby based capistrano for executing commands on
multiple remote servers and I'll
be using that to manage things like cache clearance, webserver
restarting, etc on all the webservers

... BUT I have found that it is not possible to control the APC cache
of php_mod from the CLI version of
php, they apparently use different APC caches. it seems that the only
way to control the APC cache of
mod_php is via a web interface. APC ships with the very handy apc.php
script but this is hardly a decent
way of controlling/clearing the APC cache of multiple machine
programmatically.

Am I stuck with one of:

1. doing a graceful restart of all servers (which causes APCs cache to
disappear)?


Yes, that should work.


I know - but it's a rubbish solution because it offer no control as to what
is cleared from the APC cache, sometimes I want to clear opcodes, sometimes 
user-data,
sometimes both ... graceful means being forced to clear everything.




2. writing a cmdline script that performs a URL request to a copy of
apc.php that is reachable via each
webserver in order to clear/manage the APC cache?


Yes, but obviously password-protect it to avoid DOS.


yeah - think this is the route I have to take somehow .. I'm going to look into
running a seperate vhost only available via 127.0.0.1, with a pwd on it and then
write a little script that can control the apc cache via said vhost from the
cmdline ... the cmdline script would then be controlled remotely via ssh using
the coolness that is capistrano (http://www.capify.org/)




or is there another way that I can control the webserver's APC cache
from the cmdline?


One would think there would be some kind of USR_* signal that can be
sent through Apache to APC to clear cache...


One would think that there was something like this indeed - I cannot find it,
but then there must be something ... I assume, for instance, that Yahoo!** 
occassionally
see fit to clear APC caches on more than one machine and I doubt Rasmus sits 
there and
opens a browser to run apc.php on each one ;-)

** is it too early to say 'MicroHoo!' ?





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



Re: [PHP] System errno in PHP

2008-02-21 Thread Richard Lynch
On Wed, February 20, 2008 2:56 am, Michal Maras wrote:
 I have read http://php.net/fopen from top to bottom, but I could not
 find
 how to get  system error number.
 With set_error_handler I can get string for example

 fopen(hmc_configuration.cfg)
 [function.fopenhttp://ds63450.mspr.detemobil.de/%7Emmaras/HMC/function.fopen]:
 failed to open stream: Permission denied

 but I need integer number not string, because string error messages
 depends
 on locale setting.
  Of course, I can test some conditions before fopen, but it is not
 enough
 for me.

Put in a Feature Request to expose the error number from the OS, I
guess...

http://bugs.php.net/

It *seems* like it ought to be reasonable enough to this naive user.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] unable to unset reference

2008-02-21 Thread Richard Lynch
On Wed, February 20, 2008 9:23 am, Sylvain R. wrote:

 I would like to implement it in order to delete automaticly from
 memory
 useless objects.
 It can be really useful for example to make schedulers in PHP in order
 to
 avoid max memory usage exceeded errors.

If you really don't need it any more, unset all the variables pointing
to it.

PHP Garbage Collects it.

Problem solved.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



[PHP] cxml

2008-02-21 Thread JR
Does anyone have examples or know of documentation in order to receive and
respond to cxml punchout requests.  I'm attempting to integrate my cart with
a catalog however have not done much coding with cxml or xml.  Thanks in
advance.



Re: [PHP] APC __autoload webclusters

2008-02-21 Thread Richard Lynch
On Thu, February 21, 2008 9:27 am, Jochem Maas wrote:
 1. __autoload  APC

 I have been STW to try and find a definitive answer as to whether
 using __autoload with APC
 is a bad idea ... and if so why? ... I can't find that definitive
 answer, can anyone here
 state whether this it's an absolutely bad idea to use __autoload with
 APC? (I need to
 speed up an app that currently loads in pretty much everything on
 every request ... and it's
 impossible to untangle the class interdependencies, in the time I
 have, and thereby load only
 what is absolutely needed, when it's needed ... so I want to give
 __autoload() a shot in order
 to minimize what classes are loaded.

If it's that inter-tangled, then I would hazard a WILD GUESS that the
__autoload will still end up loading everything...

 2. webclusters  APC

 I'm building a load-balanced cluster for the same app ... a certain
 times new data is imported
 from a thirdparty system after which some APC cached data needs to be
 cleared, in the same vein
 I occasionally roll out a new version and then the APC opcode cache
 needs to be cleared (each webserver
 in the cluster has it's own APC cache obviously).

 now I'm stuck with the problem of how to trigger the cache clearance
 on all servers ... Greg Donald
 already mentioned the ruby based capistrano for executing commands on
 multiple remote servers and I'll
 be using that to manage things like cache clearance, webserver
 restarting, etc on all the webservers

 ... BUT I have found that it is not possible to control the APC cache
 of php_mod from the CLI version of
 php, they apparently use different APC caches. it seems that the only
 way to control the APC cache of
 mod_php is via a web interface. APC ships with the very handy apc.php
 script but this is hardly a decent
 way of controlling/clearing the APC cache of multiple machine
 programmatically.

 Am I stuck with one of:

 1. doing a graceful restart of all servers (which causes APCs cache to
 disappear)?

Yes, that should work.

 2. writing a cmdline script that performs a URL request to a copy of
 apc.php that is reachable via each
 webserver in order to clear/manage the APC cache?

Yes, but obviously password-protect it to avoid DOS.

 or is there another way that I can control the webserver's APC cache
 from the cmdline?

One would think there would be some kind of USR_* signal that can be
sent through Apache to APC to clear cache...

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Php warning message

2008-02-21 Thread Richard Lynch
On Wed, February 20, 2008 3:29 pm, Yuval Schwartz wrote:
 Hello and thank you,

 Another question, I get a message:

 *Warning*: feof(): supplied argument is not a valid stream resource in
 *
 /home/content/t/h/e/theyuv/html/MessageBoard.php* on line *52*
 **
 And I've tried troubleshooting for a while; I'm pretty sure I'm
 opening the
 file handle correctly and everything but I can't get feof or similar
 functions like fgets to work.

 Here is my code if you're interested (it's so that I color every 2nd
 line in
 the text):

 *$boardFile = MessageBoard.txt;
 $boardFileHandle = fopen($boardFile,r);

if (!$boardFileHandle){
  die(Unable to open $boardFile\n);
}

The fact that you are seeing zero error messages indicates that you
almost for sure aren't checking the right places to find error
messages...

Figure out what's in your php.ini and get it to use E_ALL and send the
errors to a log or something.

-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

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



RE: [PHP] All Survey leading to PHP

2008-02-21 Thread Andrés Robinet
 -Original Message-
 From: Richard Lynch [mailto:[EMAIL PROTECTED]
 Sent: Thursday, February 21, 2008 11:36 AM
 To: Allan Fernandes
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] All Survey leading to PHP
 
 On Thu, February 21, 2008 6:29 am, Allan Fernandes wrote:
  1) Is there any method to protect source code of my applications even
  when
  deployed at the clients Server.
 
 Have a good, clear contract and relationship with the client.
 
 You can also attempt to encode them with any number of PHP encoders,
 all of which have been and can be cracked by a determined user.
 
  2) Can I call Delphi Dll's
 
 You may be able to use COM objects.
 http://php.net/com
 
 --
 Some people have a gift link here.
 Know what I want?
 I want you to buy a CD from some indie artist.
 http://cdbaby.com/from/lynch
 Yeah, I get a buck. So?
 
 --

I assume you will be deploying your applications on a windows server, right?
Otherwise, COM is NOT an option (probably .Net is ???).

Just curious, why would you want to call a Delphi DLL (which is no different
than any DLL)?
Just curious (x2) has anybody tried Delphi 4 PHP
(http://www.codegear.com/products/delphi/php)?

As a Delphi fan... if you are moving to PHP development, I'd say you forget all
you know about Delphi (or .Net for that matter) except the very generic
programming and OOP concepts.

If you plan to target Linux... forget about DLLs. However, if you will always
use your own server for deployment, you could try *migrating* your existing
codebase as a set of modules and cgi programs (I don't know, it depends on what
you are trying to do). Check out Freepascal (http://www.freepascal.org/).

Anyway, if you are deploying PHP web applications for *all* OSs, you'd better
off forgetting about Delphi and get good tutorials/courses/books on PHP. And if
you want a Delphi-like IDE... be prepared for deception, only Delphi4PHP gets
somewhere close to that (and I don't know how high are the runtime requirements
to run PHP-VCL applications). There are very good PHP IDEs, such as Zend Studio,
PHPDesigner, and NuSphere, etc... but forget about clicking and dragging
components on a form if that's your choice.

Regards,

Rob

Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 |
TEL 954-607-4207 | FAX 954-337-2695 | 
Email: [EMAIL PROTECTED]  | MSN Chat: [EMAIL PROTECTED]  |  SKYPE: bestplace |
 Web: bestplace.biz  | Web: seo-diy.com


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



RES: [PHP] Thread Safety [partially solved]

2008-02-21 Thread Thiago Pojda

I found out that my problem was using apache2 apxs2 to build php.

I tried: './configure
--with-oci8-instant-client=/oracle/instantclient/;make;make install', it's
not thread safe anymore.

But now I ran into another problem: it did not build (of course) a apache2
module, only a CGI. I don't want that, what can I do?

System  Linux debian 2.6.18-4-486 #1 Wed May 9 22:23:40 UTC 2007 i686
Build Date  Feb 21 2008 10:16:45
Configure Command   './configure'
'--with-oci8-instant-client=/oracle/instantclient/'
Server API  CGI
Virtual Directory Support   disabled
Configuration File (php.ini) Path   /usr/local/lib/php.ini
PHP API 20020918
PHP Extension   20020429
Zend Extension  20050606
Debug Build no
Zend Memory Manager enabled
Thread Safety   disabled
Registered PHP Streams  php, http, ftp

-Mensagem original-
De: Thiago Pojda [mailto:[EMAIL PROTECTED] 
Enviada em: quarta-feira, 20 de fevereiro de 2008 09:32
Para: 'Tom Rogers'
Cc: php-general@lists.php.net; 'PHP Install'
Assunto: RES: [PHP] Thread Safety

Tom,

That did not do it either. I'm sure I'm missing something stupid, just can't
find out what.

PHPInfo:

System  Linux debian 2.6.18-4-486 #1 Mon Mar 26 16:39:10 UTC 2007 i686
Build Date  Feb 20 2008 05:43:08
Configure Command   './configure'
'--with-oci8-instant-client=/oracle/instantclient/'
'--with-apxs2=/usr/bin/apxs2' '--disable-zts'
Server API  Apache 2.0 Handler
Virtual Directory Support   enabled
Configuration File (php.ini) Path   /usr/local/lib/php.ini
PHP API 20020918
PHP Extension   20020429
Zend Extension  20050606
Debug Build no
Zend Memory Manager enabled
Thread Safety   enabled
Registered PHP Streams  php, http, ftp

Apache:

debian:/usr/src/php-4.4.8# apache2ctl -V Server version: Apache/2.2.3
Server built:   Jan 27 2008 18:13:21
Server's Module Magic Number: 20051115:3 Server loaded:  APR 1.2.7, APR-Util
1.2.7 Compiled using: APR 1.2.7, APR-Util 1.2.7
Architecture:   32-bit
Server MPM: Prefork
  threaded: no
forked: yes (variable process count)
Server compiled with
 -D APACHE_MPM_DIR=server/mpm/prefork
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)  -D
APR_USE_SYSVSEM_SERIALIZE  -D APR_USE_PTHREAD_SERIALIZE  -D
SINGLE_LISTEN_UNSERIALIZED_ACCEPT  -D APR_HAS_OTHER_CHILD  -D
AP_HAVE_RELIABLE_PIPED_LOGS  -D DYNAMIC_MODULE_LIMIT=128  -D HTTPD_ROOT=
 -D SUEXEC_BIN=/usr/lib/apache2/suexec
 -D DEFAULT_PIDLOG=/var/run/apache2.pid
 -D DEFAULT_SCOREBOARD=logs/apache_runtime_status
 -D DEFAULT_LOCKFILE=/var/run/apache2/accept.lock
 -D DEFAULT_ERRORLOG=logs/error_log
 -D AP_TYPES_CONFIG_FILE=/etc/apache2/mime.types
 -D SERVER_CONFIG_FILE=/etc/apache2/apache2.conf 

-Mensagem original-
De: Tom Rogers [mailto:[EMAIL PROTECTED] Enviada em: terça-feira, 19 de
fevereiro de 2008 20:40
Para: Thiago Pojda
Cc: php-general@lists.php.net
Assunto: Re: [PHP] Thread Safety

Hi,

Wednesday, February 20, 2008, 3:00:28 AM, you wrote:
TP Not quite sure if this is the right list, but here I am...
TP  
TP I'm trying to use zend platform and it requires the Thread Safety 
TP option set to off.
TP  
TP I just compiled php and I can't find what argument to build php that 
TP way, what am I missing?
TP  
TP PHP 4.4.8
TP  
TP  
TP Thanks!



--disable-zts should do it

--
regards,
Tom

--
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] Re: temporary error

2008-02-21 Thread Nathan Rixham

Andrés Robinet wrote:

-Original Message-
From: Shawn McKenzie [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 21, 2008 10:36 AM
To: php-general@lists.php.net
Subject: [PHP] Re: temporary error

Mirco Soderi wrote:

In my opinion, variable names are a personal choice, I think the time
you loose when writing the name (about a second is long less than the
time you gain when, months later, you go and modify the code and you
have clear the content and meaning of each variable.

In the original code there were no sintax errors, I added some errors
when pasting here. Sorry.

I have found that in the first execution, it was the
$logQueryInserimentoDatiAllenamentoCalciPiazzati that evaluated to
false. After having removed the two-field key that I had originally
defined for that table and having added an autoincrement key, the
problem seems to be solved.

Do you find any reason for that?


Mirco Soderi [EMAIL PROTECTED] ha scritto nel messaggio
news:[EMAIL PROTECTED]

Consider the following code:

$sqlQueryInserimentoDatiAllenamentoCalciPiazzati = INSERT INTO ...
etc etc  $queryInserimentoDatiAllenamentoCalciPiazzati =
mysql_query($sqlQueryInserimentoDatiAllenamentoCalciPiazzati);
if($queryInserimentoDatiAllenamentoCalciPiazzati) { // do something
} if($queryInserimentoDatiAllenamentoCalciPiazzati) {
$logQueryInserimentoDatiAllenamentoCalciPiazzati =
mysql_query(insert into log ... etc etc ...);
if($logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do
something } } if($queryInserimentoDatiAllenamentoCalciPiazzati 
$logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do something
}

1st execution: $queryInserimentoDatiAllenamentoCalciPiazzati 
$logQueryInserimentoDatiAllenamentoCalciPiazzati, where clause of
last conditional statement, evaluates to false even if both queries
are correctly executed.

I modify as follows:

$sqlQueryInserimentoDatiAllenamentoCalciPiazzati = INSERT INTO ...
etc etc  $queryInserimentoDatiAllenamentoCalciPiazzati =
mysql_query($sqlQueryInserimentoDatiAllenamentoCalciPiazzati);
if($queryInserimentoDatiAllenamentoCalciPiazzati) { // do something
} else echo(error message 1);
if($queryInserimentoDatiAllenamentoCalciPiazzati) {
$logQueryInserimentoDatiAllenamentoCalciPiazzati =
mysql_query(insert into log ... etc etc ...);
if($logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do
something } else echo(error message 2); }
if($queryInserimentoDatiAllenamentoCalciPiazzati 
$logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do something
}

2nd execution: $queryInserimentoDatiAllenamentoCalciPiazzati 
$logQueryInserimentoDatiAllenamentoCalciPiazzati, where clause of
last conditional statement, evaluates to true.

Now, I modify again, back to the original version:

$sqlQueryInserimentoDatiAllenamentoCalciPiazzati = INSERT INTO ...
etc etc  $queryInserimentoDatiAllenamentoCalciPiazzati =
mysql_query($sqlQueryInserimentoDatiAllenamentoCalciPiazzati);
if($queryInserimentoDatiAllenamentoCalciPiazzati) { // do something
} if($queryInserimentoDatiAllenamentoCalciPiazzati) {
$logQueryInserimentoDatiAllenamentoCalciPiazzati =
mysql_query(insert into log ... etc etc ...);
if($logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do
something } } if($queryInserimentoDatiAllenamentoCalciPiazzati 
$logQueryInserimentoDatiAllenamentoCalciPiazzati) { // do something
}

3rd execution: $queryInserimentoDatiAllenamentoCalciPiazzati 
$logQueryInserimentoDatiAllenamentoCalciPiazzati, where clause of
last conditional statement, evaluates to true.

Do you know any reason for that?

Glad to see that you found your problem. Variables may be easier to read
with some underscores.

Personally, here is what I use as a counter in most all of my code,
instead of $i++; which isn't always clear.

$Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter =
$Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter +
($Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter /
$Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter);

If you wan to shorten a bit you can use a constant as the counter
increment like so:

define('Increment_Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter', 1);

$Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter =
$Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter +
Increment_Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter;

-Shawn



You forgot to add the project name you are working on to the counter, this way
you'll never confuse yourself at all.

define('Increment_Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter_For_Project
_Spaghetti', 1);

$Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter_For_Project_Spaghetti =
$Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter_For_Project_Spaghetti +
Increment_Super_Cala_Fraga_Listic_Ex_Peal_Ado_Tio_Us_Counter_For_Project_Spaghet
ti;

LOL


I often find the best way to clarify whats going on in a specific 
section of code is to document it properly. I'd strongly suggest you do 
the same Mirco, it'll save you hours in the future.



Re: [PHP] APC __autoload webclusters

2008-02-21 Thread Nathan Nobbe
On Thu, Feb 21, 2008 at 12:01 PM, Jochem Maas [EMAIL PROTECTED] wrote:

 Richard Lynch schreef:
  If it's that inter-tangled, then I would hazard a WILD GUESS that the
  __autoload will still end up loading everything...

 but not on every request ;-) ... I do use output caching, and I know
 not everything is actually used in every request.


i think youre good to go w/ autoload not loading everything up, but what
about existing include / require directives?  if the code doesnt already
use __autoload() its almost certainly strewn w/ these.  so i think if you
want the boost from __autoload, not loading up everything, youll at least
have
to strip these out.

I know - but it's a rubbish solution because it offer no control as to what
 is cleared from the APC cache, sometimes I want to clear opcodes,
 sometimes user-data,
 sometimes both ... graceful means being forced to clear everything.


you can pass a parameter to apc_clear_cache()
http://www.php.net/manual/en/function.apc-clear-cache.php
that distinguishes what you want to clear; user data or cached opcode.
obviously calling it from the cli will not clear the webserver user cache
though.

One would think that there was something like this indeed - I cannot find
 it,
 but then there must be something ... I assume, for instance, that Yahoo!**
 occassionally
 see fit to clear APC caches on more than one machine and I doubt Rasmus
 sits there and
 opens a browser to run apc.php on each one ;-)


i dont know how yahoo does it, but i do know a little about how facebook
does it; they had
3 speakers at the dc php conference last year.  i think you might find these
slides helpful,
(sorry for the ridiculuus url)
http://www.google.com/url?sa=tct=rescd=1url=http%3A%2F%2Ftekrat.com%2Ftalks_files%2Fphpdc2007%2Fapc%40facebook.pdfei=tce9R9T4FqrszATeiZG6CAusg=AFQjCNF_1Ecm2cL1EINgRQG9k3fTEclzpAsig2=ifrJK545M2liBdXbRrHrIw

you can use capistrano to deploy the new files; but it may be more
convenient to use php
and http requests to update all the server caches; *just a thought*.

there are optimizations that are possible as well, such as setting,
apc.stat=0 and
using apc_compile_file() rather than clearing the entire cache, but these
techniques add
complexity.  it sounds like you just want to get a decent bumb w/o too much
additional
complexity, so i wouldnt recommend them here, but i thought id mention them
in passing..

-nathan


Re: [PHP] All Survey leading to PHP

2008-02-21 Thread Jason Pruim
Also, if the program is that good and revolutionary someone will just  
rewrite it. Granted, a compiled program would take longer to clone  
then an open source program.  But it can still be done...


In fact that's how I got started in programming... Cloning other  
peoples apps to figure out how they did it and if I could make it do  
it to :) But I did it just for me. Didn't sell my programs.



On Feb 21, 2008, at 2:24 PM, Matty Sarro wrote:


You can attempt to protect your code with Zend guard or a couple other
utilities. I believe theres also some php obfuscation utilities out  
there -
consult google. Ultimately though, even with compiled code you will  
never
stop someone who wants to see your code, decompilers are  
commonplace. As
mentioned in a previous response, a clear cut contract is your best  
bet here
(especially since things like zend guard require additional  
software, which

will in turn decrease performance).

On Thu, Feb 21, 2008 at 12:07 PM, Andrés Robinet [EMAIL PROTECTED] 


wrote:


-Original Message-
From: Richard Lynch [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 21, 2008 11:36 AM
To: Allan Fernandes
Cc: php-general@lists.php.net
Subject: Re: [PHP] All Survey leading to PHP

On Thu, February 21, 2008 6:29 am, Allan Fernandes wrote:
1) Is there any method to protect source code of my applications  
even

when
deployed at the clients Server.


Have a good, clear contract and relationship with the client.

You can also attempt to encode them with any number of PHP  
encoders,

all of which have been and can be cracked by a determined user.


2) Can I call Delphi Dll's


You may be able to use COM objects.
http://php.net/com

--
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/from/lynch
Yeah, I get a buck. So?

--


I assume you will be deploying your applications on a windows server,
right?
Otherwise, COM is NOT an option (probably .Net is ???).

Just curious, why would you want to call a Delphi DLL (which is no
different
than any DLL)?
Just curious (x2) has anybody tried Delphi 4 PHP
(http://www.codegear.com/products/delphi/php)?

As a Delphi fan... if you are moving to PHP development, I'd say you
forget all
you know about Delphi (or .Net for that matter) except the very  
generic

programming and OOP concepts.

If you plan to target Linux... forget about DLLs. However, if you  
will

always
use your own server for deployment, you could try *migrating* your
existing
codebase as a set of modules and cgi programs (I don't know, it  
depends on

what
you are trying to do). Check out Freepascal (http://www.freepascal.org/ 
).


Anyway, if you are deploying PHP web applications for *all* OSs,  
you'd

better
off forgetting about Delphi and get good tutorials/courses/books on  
PHP.

And if
you want a Delphi-like IDE... be prepared for deception, only  
Delphi4PHP

gets
somewhere close to that (and I don't know how high are the runtime
requirements
to run PHP-VCL applications). There are very good PHP IDEs, such as  
Zend

Studio,
PHPDesigner, and NuSphere, etc... but forget about clicking and  
dragging

components on a form if that's your choice.

Regards,

Rob

Andrés Robinet | Lead Developer | BESTPLACE CORPORATION
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale,  
FL

33308 |
TEL 954-607-4207 | FAX 954-337-2695 |
Email: [EMAIL PROTECTED]  | MSN Chat: [EMAIL PROTECTED]  |  SKYPE:
bestplace |
Web: bestplace.biz  | Web: seo-diy.com


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




--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]

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



Re: [PHP] All Survey leading to PHP

2008-02-21 Thread Matty Sarro
You can attempt to protect your code with Zend guard or a couple other
utilities. I believe theres also some php obfuscation utilities out there -
consult google. Ultimately though, even with compiled code you will never
stop someone who wants to see your code, decompilers are commonplace. As
mentioned in a previous response, a clear cut contract is your best bet here
(especially since things like zend guard require additional software, which
will in turn decrease performance).

On Thu, Feb 21, 2008 at 12:07 PM, Andrés Robinet [EMAIL PROTECTED]
wrote:

  -Original Message-
  From: Richard Lynch [mailto:[EMAIL PROTECTED]
  Sent: Thursday, February 21, 2008 11:36 AM
  To: Allan Fernandes
  Cc: php-general@lists.php.net
  Subject: Re: [PHP] All Survey leading to PHP
 
  On Thu, February 21, 2008 6:29 am, Allan Fernandes wrote:
   1) Is there any method to protect source code of my applications even
   when
   deployed at the clients Server.
 
  Have a good, clear contract and relationship with the client.
 
  You can also attempt to encode them with any number of PHP encoders,
  all of which have been and can be cracked by a determined user.
 
   2) Can I call Delphi Dll's
 
  You may be able to use COM objects.
  http://php.net/com
 
  --
  Some people have a gift link here.
  Know what I want?
  I want you to buy a CD from some indie artist.
  http://cdbaby.com/from/lynch
  Yeah, I get a buck. So?
 
  --

 I assume you will be deploying your applications on a windows server,
 right?
 Otherwise, COM is NOT an option (probably .Net is ???).

 Just curious, why would you want to call a Delphi DLL (which is no
 different
 than any DLL)?
 Just curious (x2) has anybody tried Delphi 4 PHP
 (http://www.codegear.com/products/delphi/php)?

 As a Delphi fan... if you are moving to PHP development, I'd say you
 forget all
 you know about Delphi (or .Net for that matter) except the very generic
 programming and OOP concepts.

 If you plan to target Linux... forget about DLLs. However, if you will
 always
 use your own server for deployment, you could try *migrating* your
 existing
 codebase as a set of modules and cgi programs (I don't know, it depends on
 what
 you are trying to do). Check out Freepascal (http://www.freepascal.org/).

 Anyway, if you are deploying PHP web applications for *all* OSs, you'd
 better
 off forgetting about Delphi and get good tutorials/courses/books on PHP.
 And if
 you want a Delphi-like IDE... be prepared for deception, only Delphi4PHP
 gets
 somewhere close to that (and I don't know how high are the runtime
 requirements
 to run PHP-VCL applications). There are very good PHP IDEs, such as Zend
 Studio,
 PHPDesigner, and NuSphere, etc... but forget about clicking and dragging
 components on a form if that's your choice.

 Regards,

 Rob

 Andrés Robinet | Lead Developer | BESTPLACE CORPORATION
 5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL
 33308 |
 TEL 954-607-4207 | FAX 954-337-2695 |
 Email: [EMAIL PROTECTED]  | MSN Chat: [EMAIL PROTECTED]  |  SKYPE:
 bestplace |
  Web: bestplace.biz  | Web: seo-diy.com


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




Re: [PHP] APC __autoload webclusters

2008-02-21 Thread Nathan Rixham

Nathan Nobbe wrote:

On Thu, Feb 21, 2008 at 12:01 PM, Jochem Maas [EMAIL PROTECTED] wrote:


Richard Lynch schreef:

If it's that inter-tangled, then I would hazard a WILD GUESS that the
__autoload will still end up loading everything...

but not on every request ;-) ... I do use output caching, and I know
not everything is actually used in every request.



i think youre good to go w/ autoload not loading everything up, but what
about existing include / require directives?  if the code doesnt already
use __autoload() its almost certainly strewn w/ these.  so i think if you
want the boost from __autoload, not loading up everything, youll at least
have
to strip these out.

I know - but it's a rubbish solution because it offer no control as to what

is cleared from the APC cache, sometimes I want to clear opcodes,
sometimes user-data,
sometimes both ... graceful means being forced to clear everything.



you can pass a parameter to apc_clear_cache()
http://www.php.net/manual/en/function.apc-clear-cache.php
that distinguishes what you want to clear; user data or cached opcode.
obviously calling it from the cli will not clear the webserver user cache
though.

One would think that there was something like this indeed - I cannot find

it,
but then there must be something ... I assume, for instance, that Yahoo!**
occassionally
see fit to clear APC caches on more than one machine and I doubt Rasmus
sits there and
opens a browser to run apc.php on each one ;-)



i dont know how yahoo does it, but i do know a little about how facebook
does it; they had
3 speakers at the dc php conference last year.  i think you might find these
slides helpful,
(sorry for the ridiculuus url)
http://www.google.com/url?sa=tct=rescd=1url=http%3A%2F%2Ftekrat.com%2Ftalks_files%2Fphpdc2007%2Fapc%40facebook.pdfei=tce9R9T4FqrszATeiZG6CAusg=AFQjCNF_1Ecm2cL1EINgRQG9k3fTEclzpAsig2=ifrJK545M2liBdXbRrHrIw

you can use capistrano to deploy the new files; but it may be more
convenient to use php
and http requests to update all the server caches; *just a thought*.

there are optimizations that are possible as well, such as setting,
apc.stat=0 and
using apc_compile_file() rather than clearing the entire cache, but these
techniques add
complexity.  it sounds like you just want to get a decent bumb w/o too much
additional
complexity, so i wouldnt recommend them here, but i thought id mention them
in passing..

-nathan



Nathan,

cheers for the link to facebook pdf, just had a read and it's good 
stuff, also lead me on to this after a short google:


http://sizzo.org/wp/wp-content/uploads/2007/09/facebook_performance_caching.pdf

*wanders off for a couple of hours on php.net/apc*

Nathan:
almost march 14th :D

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



[PHP] PHP To an EXE Executable for Win32 ( Is it possible)

2008-02-21 Thread Dan
I know that there's apparently some way to compile PHP to make it run 
faster.  But has anyone come up with a system to turn PHP scripts into an 
.exe?  What I mean is you would run the exe and see exactly the same thing 
as if you were viewing the script through a webbrowser, but without having 
to install php.


What is the name of this?

- Dan 


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



Re: [PHP] PHP To an EXE Executable for Win32 ( Is it possible)

2008-02-21 Thread Mario Guenterberg
On Thu, Feb 21, 2008 at 02:16:55PM -0700, Dan wrote:
 I know that there's apparently some way to compile PHP to make it run  
 faster.  But has anyone come up with a system to turn PHP scripts into an 
 .exe?  What I mean is you would run the exe and see exactly the same 
 thing as if you were viewing the script through a webbrowser, but without 
 having to install php.

 What is the name of this?

Hi...

look at this:
http://www.php-editors.com/forums/other-php-tools/2374-php-compiler-embedder-php2exe.html

Greetings
Mario

-- 
-BEGIN GEEK CODE BLOCK-
Version: 3.12
GCS/CM d- s++: a+ C$ UBL*$ P++ L+++ E--- W+++ N+ o-- K- w O- M-
V-- PS++ PE++ Y PGP+++ t--- 5 X R++ tv- b+++ DI D  G++ e* h
r+++ y
--END GEEK CODE BLOCK--


signature.asc
Description: Digital signature


Re: [PHP] PHP To an EXE Executable for Win32 ( Is it possible)

2008-02-21 Thread Matty Sarro
Color me corrected :) I'm gonna have to look into these utils myself.
Thanks!

On Thu, Feb 21, 2008 at 4:27 PM, Mario Guenterberg [EMAIL PROTECTED] wrote:

 On Thu, Feb 21, 2008 at 02:16:55PM -0700, Dan wrote:
  I know that there's apparently some way to compile PHP to make it run
  faster.  But has anyone come up with a system to turn PHP scripts into
 an
  .exe?  What I mean is you would run the exe and see exactly the same
  thing as if you were viewing the script through a webbrowser, but
 without
  having to install php.
 
  What is the name of this?

 Hi...

 look at this:

 http://www.php-editors.com/forums/other-php-tools/2374-php-compiler-embedder-php2exe.html

 Greetings
 Mario

 --
 -BEGIN GEEK CODE BLOCK-
 Version: 3.12
 GCS/CM d- s++: a+ C$ UBL*$ P++ L+++ E--- W+++ N+ o-- K- w O- M-
 V-- PS++ PE++ Y PGP+++ t--- 5 X R++ tv- b+++ DI D  G++ e* h
 r+++ y
 --END GEEK CODE BLOCK--

 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.6 (GNU/Linux)

 iQIVAwUBR73sqjUZahlMISn3AQJuNQ//eAozmA34NNxxogHP4BgtPTG8XbyzN6mE
 arKS08SFbehG/rjVL38dDRkuXUPeP4Dvjfk8oNgVGbnbRt7wjgRhXm/GtTiFdDG0
 JjmH+II6oKlWjmX92dOzShdlAqy4o8HM1km9gwNsLeGsCxWCu5yUq8m2RBh8WoVs
 9nwW3ENHeGO+Sy4wx51bb03MnMJ5CApaITUdz54Uvx5fqivK+tZEZ6Adnu2ULDmR
 5AcRKlHYWZQPhf0JZb55NeOLjrcBRBV1arMFCHTnYBD9HU0tjYl4yBU4WBrlwfOx
 6reN4xiJ4htMxhpSjA5FtVPFh5E5RkO9JTz1vXoR2h0PS7ciSyufJbmjd6ej6ume
 mHKG0oqmWBR47KJkhufrg+KbmYmMlhPzfRjzDMTvnXvO+808Uy/YQDOqnPcz+Ukz
 atUGRpP46vHt45x4f4l1wL3ClVjIoJW2GGx/ZJzclWZjJBAnR9Wr30VTlll6hi0f
 8hukSEEYWz1zzsU10X7RYa/nK79RgipUgbl5282AXZRZcVt4QRO/h1D9xIZWsNcv
 TZs1XfKfSx5o8loc7iFyVLuf9h7j1iMvf5+2dTcNiKnwb4rszYOIh3y4vQUI6Re9
 PbFCh5p8XeaWX5i+4TU5cuGTmQkS/zoqlBl9CdOiWsv9pWHzhbgAv8W7b76HRFEF
 RKgdWnJ5QvI=
 =yyh+
 -END PGP SIGNATURE-




RE: [PHP] PHP To an EXE Executable for Win32 ( Is it possible)

2008-02-21 Thread Jay Blanchard
[snip]
But has anyone come up with a system to turn PHP scripts into an 
.exe?
[/snip]

http://www.priadoblender.com/index.php?layout=maincslot_1=2

 

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



RE: [PHP] PHP To an EXE Executable for Win32 ( Is it possible)

2008-02-21 Thread Andrés Robinet
 -Original Message-
 From: Dan [mailto:[EMAIL PROTECTED]
 Sent: Thursday, February 21, 2008 4:17 PM
 To: php-general@lists.php.net
 Subject: [PHP] PHP To an EXE Executable for Win32 ( Is it possible)
 
 I know that there's apparently some way to compile PHP to make it run
 faster.  But has anyone come up with a system to turn PHP scripts into an
 .exe?  What I mean is you would run the exe and see exactly the same thing
 as if you were viewing the script through a webbrowser, but without having
 to install php.
 
 What is the name of this?
 
 - Dan
 
 --

If you want to see exactly the same thing as if you were viewing the script
through a webbrowser...
... THEN YOU'LL NEED a webbrowser.

PHP only generates the HTML output (and under some circunstances JS, CSS and
other file types).

If you mean to develop desktop applications in PHP, then you want to take a look
at PHP-GTK (http://gtk.php.net/).

If you mean to just convert a script PHP into binary code for whatever purpose
you want, then probably you should be after the Roadsend compiler
http://www.roadsend.com/home/index.php?pageID=compiler or any other similar
solution (if they exist - ???).

However, assuming that your solely goal is to make PHP run faster, the first and
best step you can take is to improve your application and database design and
optimize your PHP code. Then, you can take further steps, such as installing
an opcode cache, or accelerator (Zend Optimizer, eAccelerator, XCache, etc).

Regards,

Rob

Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 |
TEL 954-607-4207 | FAX 954-337-2695 | 
Email: [EMAIL PROTECTED]  | MSN Chat: [EMAIL PROTECTED]  |  SKYPE: bestplace |
 Web: bestplace.biz  | Web: seo-diy.com

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



[PHP] Cannot get php_http.dll to work

2008-02-21 Thread Alexis

Hi,

I have tried umpteen times to get this to work by PHP still insists that 
it cannot find the 'HttpRequest' Class.


Using PHP 5.2.3
Downloaded latest version of php_http.dll, for PHP 5.2.x from the PECL 
website

Installed it in the D:\PHP\ext directory
Added 'extension=php_http.dll' to the php.ini file
made sure the extension_dir is set to 'D:\PHP'
Restarted Apache..even restarted the entire computer

And with all of this it's still not recognising this Class.

I've searched all over the net but to no avail...pretty much every 
answer refers to adding the extension line to the .ini file.


Can anyone advise what else I may be able to do?

Thanks
Alexis

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



[PHP] Copy Network Share W/ Diff. Creds To Local Folder?

2008-02-21 Thread Jason Paschal
I'm building a web app on a windows server for a company.
an aspect of that requires grabbing a sound file from a network share, which
i attempted with a windows copy command via exec(), but PHP needs to be able
to pass the authentication credentials.

runas requires password interactivity, and i've looked at runasspc but that
costs for commercial use and was hoping to avoid it if possible.

is there a way to finesse runas with PHP?  some trick to get PHP to offer
the password?

or is there some other clever way to make this happen?

Thank you,
Jason


[PHP] AMP installer

2008-02-21 Thread Ryan A
Hey!

Need to reinstall Apache PHP and MySql for personal development use on my new 
laptop... I usually used phpdev in the past but now I want php5 
compatability... can anyone recommend any such all in one installer.

And yes, I know its good experience and so on to do each one manually... but 
dont have the time to pure over help docs for hours or days.

Am on Win Vista premium.

Thanks!
Ryan
 
--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)




  

Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs

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



Re: [PHP] More than one values returned?

2008-02-21 Thread Greg Donald
On 2/19/08, Nick Stinemates [EMAIL PROTECTED] wrote:
  I said, simply, returning an array of objects was usually an indication
  of poor design.

No it's not.  Nearly every MVC framework in existence implements some
sort of ActiveRecord finder that does exactly that.

Rails:
@foo = Foo.find( :all )

Django:
foo = Foo.objects.all()

ZF:
$foo = new Foo();
$foo-fetchRow( $foo-select() );

All return arrays of objects.


-- 
Greg Donald
http://destiney.com/

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



Re: [PHP] AMP installer

2008-02-21 Thread Chris

Ryan A wrote:

Hey!

Need to reinstall Apache PHP and MySql for personal development use on my new laptop... I 
usually used phpdev in the past but now I want php5 compatability... can anyone recommend 
any such all in one installer.

And yes, I know its good experience and so on to do each one manually... but 
dont have the time to pure over help docs for hours or days.


http://www.apachefriends.org/en/xampp.html

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] APC __autoload webclusters

2008-02-21 Thread Nathan Nobbe
On Thu, Feb 21, 2008 at 3:20 PM, Nathan Rixham [EMAIL PROTECTED] wrote:

 Nathan,

 cheers for the link to facebook pdf, just had a read and it's good
 stuff, also lead me on to this after a short google:


 http://sizzo.org/wp/wp-content/uploads/2007/09/facebook_performance_caching.pdf


ya; thats another from the dc conference.  and thats where i  discovered
that facebook
uses globals, which i mentioned in a thread a while back about globals.  i
dont know that
much of their stuff is really oo at all; but im sure some of it is, since
the system is so big.

http://sizzo.org/wp/wp-content/uploads/2007/09/facebook_performance_caching.pdf
 Nathan:
 almost march 14th :D


i already submitted an abstract for the 08 conference if thats the
allusion.. :)
on spl, to be precise; but it seems nobody really cares about it, much;
which is a shame if you ask me; ergo the topic choice ;)

-nathan


RE: [PHP] AMP installer

2008-02-21 Thread Andrés Robinet
 -Original Message-
 From: Ryan A [mailto:[EMAIL PROTECTED]
 Sent: Thursday, February 21, 2008 6:24 PM
 To: php php
 Subject: [PHP] AMP installer
 
 Hey!
 
 Need to reinstall Apache PHP and MySql for personal development use on my
 new laptop... I usually used phpdev in the past but now I want php5
 compatability... can anyone recommend any such all in one installer.
 
 And yes, I know its good experience and so on to do each one manually...
 but dont have the time to pure over help docs for hours or days.
 
 Am on Win Vista premium.
 
 Thanks!
 Ryan
 
 --
 - The faulty interface lies between the chair and the keyboard.
 - Creativity is great, but plagiarism is faster!
 - Smile, everyone loves a moron. :-)
 
 
 
 
 
 ___
 _
 Never miss a thing.  Make Yahoo your home page.
 http://www.yahoo.com/r/hs
 
 --

Hi there,

It's not that hard to install them all separately and configure them. However,
yes, sometimes you just want a quickstart and then customize as needed. This is
my recommendation for Windows XP
(http://www.apachefriends.org/en/xampp-windows.html), I don't know of Vista, but
it seems to work for that OS too.

Also, I prefer to use MySQL gui tools for MySQL administration (instead of the
bundled mysqladmin - or even PHPMyadmin, which I use only for exporting - that
comes with XAMPP) http://dev.mysql.com/downloads/gui-tools/5.0.html.

Hope this helps, though you will get other options as well, this is much of a
personal choice (One year ago I installed them all separately, to get very
familiar with the setup).

Regards,

Rob

Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 |
TEL 954-607-4207 | FAX 954-337-2695 | 
Email: [EMAIL PROTECTED]  | MSN Chat: [EMAIL PROTECTED]  |  SKYPE: bestplace |
 Web: bestplace.biz  | Web: seo-diy.com

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



RE: [PHP] PHP To an EXE Executable for Win32 ( Is it possible)

2008-02-21 Thread Bastien Koert

www.roadsend.com ?


bastien

 To: php-general@lists.php.net
 From: [EMAIL PROTECTED]
 Date: Thu, 21 Feb 2008 14:16:55 -0700
 Subject: [PHP] PHP To an EXE Executable for Win32 ( Is it possible)
 
 I know that there's apparently some way to compile PHP to make it run 
 faster.  But has anyone come up with a system to turn PHP scripts into an 
 .exe?  What I mean is you would run the exe and see exactly the same thing 
 as if you were viewing the script through a webbrowser, but without having 
 to install php.
 
 What is the name of this?
 
 - Dan 
 
 -- 
 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] AMP installer

2008-02-21 Thread Warren Vail
I can recommend apache2triad  http://apache2triad.net

Downloads at

http://sourceforge.net/project/showfiles.php?group_id=93507

release 1.5.4 includes

php
perl
python
mysql
postgress
and much more included pop and ftp servers, open SSL, etc, that all run on
Windows

HTH,

Warren Vail

 -Original Message-
 From: Chris [mailto:[EMAIL PROTECTED]
 Sent: Thursday, February 21, 2008 3:53 PM
 To: Ryan A
 Cc: php php
 Subject: Re: [PHP] AMP installer
 
 Ryan A wrote:
  Hey!
 
  Need to reinstall Apache PHP and MySql for personal development use on
 my new laptop... I usually used phpdev in the past but now I want php5
 compatability... can anyone recommend any such all in one installer.
 
  And yes, I know its good experience and so on to do each one manually...
 but dont have the time to pure over help docs for hours or days.
 
 http://www.apachefriends.org/en/xampp.html
 
 --
 Postgresql  php tutorials
 http://www.designmagick.com/
 
 --
 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: AMP installer

2008-02-21 Thread Nathan Rixham

Ryan A wrote:

Hey!

Need to reinstall Apache PHP and MySql for personal development use on my new laptop... I 
usually used phpdev in the past but now I want php5 compatability... can anyone recommend 
any such all in one installer.

And yes, I know its good experience and so on to do each one manually... but 
dont have the time to pure over help docs for hours or days.

Am on Win Vista premium.

Thanks!
Ryan
 
--

- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)




  

Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs


xampp - hate to even say it

seriously though just run the msi installer's from apache, mysql and php 
- it'll take about 10 minutes


nath
march 14th soon :)

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



[PHP] Re: Copy Network Share W/ Diff. Creds To Local Folder?

2008-02-21 Thread Nathan Rixham

Jason Paschal wrote:

I'm building a web app on a windows server for a company.
an aspect of that requires grabbing a sound file from a network share, which
i attempted with a windows copy command via exec(), but PHP needs to be able
to pass the authentication credentials.

runas requires password interactivity, and i've looked at runasspc but that
costs for commercial use and was hoping to avoid it if possible.

is there a way to finesse runas with PHP?  some trick to get PHP to offer
the password?

or is there some other clever way to make this happen?

Thank you,
Jason



tried map network drive, it should automatically connect at logon 
simply letting you X:\file.ext [might work]


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



[PHP] Re: Cannot get php_http.dll to work

2008-02-21 Thread Shawn McKenzie
Alexis wrote:
 Hi,
 
 I have tried umpteen times to get this to work by PHP still insists that
 it cannot find the 'HttpRequest' Class.
 
 Using PHP 5.2.3
 Downloaded latest version of php_http.dll, for PHP 5.2.x from the PECL
 website
 Installed it in the D:\PHP\ext directory
 Added 'extension=php_http.dll' to the php.ini file
 made sure the extension_dir is set to 'D:\PHP'
 Restarted Apache..even restarted the entire computer
 
 And with all of this it's still not recognising this Class.
 
 I've searched all over the net but to no avail...pretty much every
 answer refers to adding the extension line to the .ini file.
 
 Can anyone advise what else I may be able to do?
 
 Thanks
 Alexis

made sure the extension_dir is set to 'D:\PHP' 

Why, when you said it is in 'D:\PHP\ext' ???

-Shawn

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



Re: [PHP] More than one values returned?

2008-02-21 Thread Nick Stinemates
Greg Donald wrote:
 On 2/19/08, Nick Stinemates [EMAIL PROTECTED] wrote:
   
  I said, simply, returning an array of objects was usually an indication
  of poor design.
 

 No it's not.  Nearly every MVC framework in existence implements some
 sort of ActiveRecord finder that does exactly that.

 Rails:
 @foo = Foo.find( :all )

 Django:
 foo = Foo.objects.all()

 ZF:
 $foo = new Foo();
 $foo-fetchRow( $foo-select() );

 All return arrays of objects.


   
I'm glad you're literate enough to understand what *indication* and
*usually* mean.

Oh wait..

-- 
==
Nick Stinemates ([EMAIL PROTECTED])
http://nick.stinemates.org

AIM: Nick Stinemates
MSN: [EMAIL PROTECTED]
Yahoo: [EMAIL PROTECTED]
==

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



[PHP] Re: Copy Network Share W/ Diff. Creds To Local Folder?

2008-02-21 Thread Manuel Lemos
Hello,

on 02/21/2008 07:48 PM Jason Paschal said the following:
 I'm building a web app on a windows server for a company.
 an aspect of that requires grabbing a sound file from a network share, which
 i attempted with a windows copy command via exec(), but PHP needs to be able
 to pass the authentication credentials.
 
 runas requires password interactivity, and i've looked at runasspc but that
 costs for commercial use and was hoping to avoid it if possible.
 
 is there a way to finesse runas with PHP?  some trick to get PHP to offer
 the password?
 
 or is there some other clever way to make this happen?

Yes, you can use this stream handler class that lets you access files in
Windows shares as if they were local files:

http://www.phpclasses.org/smb4php

-- 

Regards,
Manuel Lemos

PHP professionals looking for PHP jobs
http://www.phpclasses.org/professionals/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



[PHP] Problem with quotes

2008-02-21 Thread Mário Gamito

Hi,

Sorry for such a laim question.



I have this code:

$host = 'http://' . $_SERVER['HTTP_HOST'];

foreach($browser as $key = $val){
echo img src=\dcs/ . $key . '.png' .  / .  ;
(...) 


but it has a bug, I need to add the server domain before the picture, so 
 I did:


$host = 'http://' . $_SERVER['HTTP_HOST'];

foreach($browser as $key = $val){
echo $host . img src=\dcs/ . $key . '.png' .  / .  ;
(...)

But this way, all it echoes is the $host variable.

What am I missing here ?

Any help would be appreciated.

Warm Regards,
Mário Gamito

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



[PHP] Exception vs exception

2008-02-21 Thread Prabath Kumarasinghe
Hi All

Recently I'm came across following code snippet
regarding exceptions there I'm executing invalid query
and catch the exception as follows.

First Approach
---
try{
$result = mysql_query('SELECT * from unknowntable');


}catch(exception $e){
  echo $e-getTrace();

}
---


Second Approach
---
try{

$result = mysql_query('SELECT * from unknowntable');
if (!$result) {
throw new MySQLException('Query failed to
execute')
}

}cathc(MySQLException $e){
 echo $e-getMessage();
}cathc(Exception $e){
 echo $e-getMessage();
}
---

Which one is the best approach and efficient and what
the recommended approach.

Cheers

Prabath


  

Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs

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



RE: [PHP] Problem with quotes

2008-02-21 Thread Andrés Robinet
 -Original Message-
 From: Mário Gamito [mailto:[EMAIL PROTECTED]
 Sent: Thursday, February 21, 2008 11:04 PM
 To: php-general@lists.php.net
 Subject: [PHP] Problem with quotes
 
 Hi,
 
 Sorry for such a laim question.
 
 
 
 I have this code:
 
 $host = 'http://' . $_SERVER['HTTP_HOST'];
 
 foreach($browser as $key = $val){
  echo img src=\dcs/ . $key . '.png' .  / .  ;
  (...) 
 
 
 but it has a bug, I need to add the server domain before the picture, so
   I did:
 
 $host = 'http://' . $_SERVER['HTTP_HOST'];
 
 foreach($browser as $key = $val){
  echo $host . img src=\dcs/ . $key . '.png' .  / .  ;
  (...)
 
 But this way, all it echoes is the $host variable.
 
 What am I missing here ?
 
 Any help would be appreciated.
 
 Warm Regards,
 Mário Gamito

Mmm... It may have to do with operator precedence

Try either:

code
echo ($host . img src=\dcs/ . $key . '.png' .  / .  );
/code

Or,

code
$output = $host . img src=\dcs/ . $key . '.png' .  / .  ;
echo $output;
/code

Regards,

Rob

Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 |
TEL 954-607-4207 | FAX 954-337-2695 | 
Email: [EMAIL PROTECTED]  | MSN Chat: [EMAIL PROTECTED]  |  SKYPE: bestplace |
 Web: bestplace.biz  | Web: seo-diy.com

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



Re: [PHP] Problem with quotes

2008-02-21 Thread Casey
On Thu, Feb 21, 2008 at 8:04 PM, Mário Gamito [EMAIL PROTECTED] wrote:
 Hi,

  Sorry for such a laim question.



  I have this code:

  $host = 'http://' . $_SERVER['HTTP_HOST'];

  foreach($browser as $key = $val){
  echo img src=\dcs/ . $key . '.png' .  / .  ;
  (...) 


  but it has a bug, I need to add the server domain before the picture, so
   I did:

  $host = 'http://' . $_SERVER['HTTP_HOST'];

  foreach($browser as $key = $val){
  echo $host . img src=\dcs/ . $key . '.png' .  / .  ;
  (...)

  But this way, all it echoes is the $host variable.

  What am I missing here ?

  Any help would be appreciated.

  Warm Regards,
  Mário Gamito



Not the problem, but:

echo img src=\dcs/ . $key . '.png' .  / .  ;

can be condensed to:

echo img src=\dcs/$key.png\ / ;

-- 
-Casey

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



Re: [PHP] Exception vs exception

2008-02-21 Thread Chris

Prabath Kumarasinghe wrote:

Hi All

Recently I'm came across following code snippet
regarding exceptions there I'm executing invalid query
and catch the exception as follows.

First Approach
---
try{
$result = mysql_query('SELECT * from unknowntable');


}catch(exception $e){
  echo $e-getTrace();

}
---


Since mysql_query doesn't throw an exception, you cannot catch it.

mysql_query returns false if an error occurs, otherwise it returns a 
result resource.


http://www.php.net/mysql_query

--
Postgresql  php tutorials
http://www.designmagick.com/

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



[PHP] form cleaner class

2008-02-21 Thread nihilism machine
What is a better idea? Using this class in my db class and using  
CleanInput on the sql statements, or using it in the top of the all  
pages with form input to clean the $_POST's? Also, any ideas or  
comments on improving the class?


?php

class FormCleaner {

// Initializer  
function __construct() {
if (count($_POST)  0) {
foreach($_POST as $curPostKey = $curPostVal) {
$_POST[$curPostKey] = 
$this-CleanInput($curPostVal);
}
}
}

// Clean Form Input
public function CleanInput($UserInput) {
		$allowedtags = b/bi/ih1/h1a/aimgul/ulli/ 
liblockquote/blockquote;
		$notallowedattribs = array(@javascript:|onclick|ondblclick| 
onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress| 
onkeydown|[EMAIL PROTECTED]);

$changexssto = '';
		$UserInput = preg_replace($notallowedattribs, $changexssto,  
$UserInput);

$UserInput = strip_tags($UserInput, $allowedtags);
$UserInput = nl2br($UserInput);
return $UserInput;
}
}

?

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



RE: [PHP] Exception vs exception

2008-02-21 Thread Andrés Robinet
 -Original Message-
 From: Prabath Kumarasinghe [mailto:[EMAIL PROTECTED]
 Sent: Thursday, February 21, 2008 11:19 PM
 To: php-general@lists.php.net
 Subject: [PHP] Exception vs exception
 
 Hi All
 
 Recently I'm came across following code snippet
 regarding exceptions there I'm executing invalid query
 and catch the exception as follows.
 
 First Approach
 ---
 try{
 $result = mysql_query('SELECT * from unknowntable');
 
 
 }catch(exception $e){
   echo $e-getTrace();
 
 }
 ---
 
 
 Second Approach
 ---
 try{
 
 $result = mysql_query('SELECT * from unknowntable');
 if (!$result) {
 throw new MySQLException('Query failed to
 execute')
 }
 
 }cathc(MySQLException $e){
  echo $e-getMessage();
 }cathc(Exception $e){
  echo $e-getMessage();
 }
 ---
 
 Which one is the best approach and efficient and what
 the recommended approach.
 
 Cheers
 
 Prabath
 
 
 
 ___
 _
 Never miss a thing.  Make Yahoo your home page.
 http://www.yahoo.com/r/hs

Class names are case insensitive, so Exception is the same as exception.

Now, about the first approach: Does the mysql extension throw exceptions???
(maybe you just didn't write the throw statement, I presume).

About the second approach: What is catchc? (I guess it's just a typo). And,
what other exceptions are you expecting to be thrown out of the try block to use
the second *generic* catch? If you and only you are throwing the custom *
MySQLException* exception (which you should code and throw under the proper
conditions) why do you need a generic *Exception* catch block?

Regards,

Rob


Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 |
TEL 954-607-4207 | FAX 954-337-2695 | 
Email: [EMAIL PROTECTED]  | MSN Chat: [EMAIL PROTECTED]  |  SKYPE: bestplace |
 Web: bestplace.biz  | Web: seo-diy.com

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



Re: [PHP] form cleaner class

2008-02-21 Thread Casey
On Thu, Feb 21, 2008 at 8:53 PM, nihilism machine
[EMAIL PROTECTED] wrote:
 What is a better idea? Using this class in my db class and using
  CleanInput on the sql statements, or using it in the top of the all
  pages with form input to clean the $_POST's? Also, any ideas or
  comments on improving the class?

  ?php

  class FormCleaner {

 // Initializer
 function __construct() {
 if (count($_POST)  0) {
 foreach($_POST as $curPostKey = $curPostVal) {
 $_POST[$curPostKey] = 
 $this-CleanInput($curPostVal);
 }
 }
 }

 // Clean Form Input
 public function CleanInput($UserInput) {
 $allowedtags = 
 b/bi/ih1/h1a/aimgul/ulli/
  liblockquote/blockquote;
 $notallowedattribs = array(@javascript:|onclick|ondblclick|
  onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|
  onkeydown|[EMAIL PROTECTED]);
 $changexssto = '';
 $UserInput = preg_replace($notallowedattribs, $changexssto,
  $UserInput);
 $UserInput = strip_tags($UserInput, $allowedtags);
 $UserInput = nl2br($UserInput);
 return $UserInput;
 }
  }

  ?


Does this line work?:
   foreach($_POST as $curPostKey = $curPostVal) {
   $_POST[$curPostKey] =
$this-CleanInput($curPostVal);
   }

If I recall correctly, you can't modify the array within a foreach
block... or am I going crazy?

-- 
-Casey

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



Re: [PHP] Exception vs exception

2008-02-21 Thread Prabath Kumarasinghe

--- Chris [EMAIL PROTECTED] wrote:

 Prabath Kumarasinghe wrote:
  Hi All
  
  Recently I'm came across following code snippet
  regarding exceptions there I'm executing invalid
 query
  and catch the exception as follows.
  
  First Approach
  ---
  try{
  $result = mysql_query('SELECT * from
 unknowntable');
  
  
  }catch(exception $e){
echo $e-getTrace();
  
  }
  ---
 
 Since mysql_query doesn't throw an exception, you
 cannot catch it.
 
 mysql_query returns false if an error occurs,
 otherwise it returns a 
 result resource.
 
 http://www.php.net/mysql_query

But it's give a many information using $e-getTrace()
is this correct. If there are several mysql_query then
I can put it as bunch within try block and catch
exception easily.

In second approach for every query I have to write
throw new MySQLException(My Message). It's very time
consuming isn't it?

Cheers

Prabath

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



  

Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  
http://tools.search.yahoo.com/newsearch/category.php?category=shopping

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



Re: [PHP] form cleaner class

2008-02-21 Thread Casey
On Thu, Feb 21, 2008 at 8:59 PM, Casey [EMAIL PROTECTED] wrote:

 On Thu, Feb 21, 2008 at 8:53 PM, nihilism machine
  [EMAIL PROTECTED] wrote:
   What is a better idea? Using this class in my db class and using
CleanInput on the sql statements, or using it in the top of the all
pages with form input to clean the $_POST's? Also, any ideas or
comments on improving the class?
  
?php
  
class FormCleaner {
  
   // Initializer
   function __construct() {
   if (count($_POST)  0) {
   foreach($_POST as $curPostKey = $curPostVal) {
   $_POST[$curPostKey] = 
 $this-CleanInput($curPostVal);
   }
   }
   }
  
   // Clean Form Input
   public function CleanInput($UserInput) {
   $allowedtags = 
 b/bi/ih1/h1a/aimgul/ulli/
liblockquote/blockquote;
   $notallowedattribs = 
 array(@javascript:|onclick|ondblclick|
onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|
onkeydown|[EMAIL PROTECTED]);
   $changexssto = '';
   $UserInput = preg_replace($notallowedattribs, $changexssto,
$UserInput);
   $UserInput = strip_tags($UserInput, $allowedtags);
   $UserInput = nl2br($UserInput);
   return $UserInput;
   }
}
  
?
  

  Does this line work?:

foreach($_POST as $curPostKey = $curPostVal) {
$_POST[$curPostKey] =
  $this-CleanInput($curPostVal);
}

  If I recall correctly, you can't modify the array within a foreach
  block... or am I going crazy?

  --
  -Casey


Nevermind, wrong language! :P

-- 
-Casey

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



RE: [PHP] form cleaner class

2008-02-21 Thread Andrés Robinet
 -Original Message-
 From: nihilism machine [mailto:[EMAIL PROTECTED]
 Sent: Thursday, February 21, 2008 11:53 PM
 To: php-general@lists.php.net
 Subject: [PHP] form cleaner class
 
 What is a better idea? Using this class in my db class and using
 CleanInput on the sql statements, or using it in the top of the all
 pages with form input to clean the $_POST's?

Will all your $_POST variables contain HTML code that must be filtered out
except a set of tags that must be kept?
Otherwise, it's not worth to filter everything everytime (it will become a
performance issue).
IMO, if you expect an integer for some *whatever* input variable, it's best to
do:

$whatever = (int)$_POST['whatever'];

 Also, any ideas or
 comments on improving the class?

I'd check out how well-known PHP Frameworks/CMS clean out HTML code to prevent
XSS attacks (If somebody has done the job already, you just need to improve it -
if you ever can). And what other precautions they take.

 
 ?php
 
 class FormCleaner {
 
   // Initializer
   function __construct() {
   if (count($_POST)  0) {
   foreach($_POST as $curPostKey = $curPostVal) {
   $_POST[$curPostKey] = $this-
 CleanInput($curPostVal);
   }
   }
   }
 
   // Clean Form Input
   public function CleanInput($UserInput) {
   $allowedtags =
 b/bi/ih1/h1a/aimgul/ulli/
 liblockquote/blockquote;
   $notallowedattribs = array(@javascript:|onclick|ondblclick|
 onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|
 onkeydown|[EMAIL PROTECTED]);
   $changexssto = '';
   $UserInput = preg_replace($notallowedattribs, $changexssto,
 $UserInput);
   $UserInput = strip_tags($UserInput, $allowedtags);
   $UserInput = nl2br($UserInput);
   return $UserInput;
   }
 }
 
 ?
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

Regards,

Rob


Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 |
TEL 954-607-4207 | FAX 954-337-2695 | 
Email: [EMAIL PROTECTED]  | MSN Chat: [EMAIL PROTECTED]  |  SKYPE: bestplace |
 Web: bestplace.biz  | Web: seo-diy.com

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



Re: [PHP] Exception vs exception

2008-02-21 Thread Paul Scott

On Thu, 2008-02-21 at 21:01 -0800, Prabath Kumarasinghe wrote:
 In second approach for every query I have to write
 throw new MySQLException(My Message). It's very time
 consuming isn't it?

In order to *be* lazy, you have to *think* lazy...

Don't go and define every single query with an exception, thats just not
the lazy way, rather define a few functions that do generic stuff (or
even a single function that runs a query) and then send all of your
queries through that:

public function queryWithException($filter)
{
$results = $dblayer-query($filter);
if($results === FALSE)
{
 throw new MyException(Query failed!);
}
else {
return $results;
}
}

then in your code:

try {
$this-queryWithException(SELECT * FROM users WHERE clue  0);
}
catch (MyException $e)
{
   // clean up
}

--Paul

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

Re: [PHP] Exception vs exception

2008-02-21 Thread Chris



But it's give a many information using $e-getTrace()
is this correct. If there are several mysql_query then
I can put it as bunch within try block and catch
exception easily.


No, it doesn't give any such information.

1 :?php
2 :mysql_connect('server', 'username', 'password');
3 :mysql_select_db('database_name');
4 :
5 :try{
6 :$result = mysql_query('SELECT * from unknowntable');
7 :echo __LINE__ . \n;
8 :}catch(exception $e){
9 :echo __LINE__ . \n;
10:}

Line numbers added for effect.

It will print the line number in the try.

It never prints the line number in the catch.

$ php -f ./test.php
7


In second approach for every query I have to write
throw new MySQLException(My Message). It's very time
consuming isn't it?


Use a database abstraction layer and run everything through that or 
simply use a function.



function Query($query='')
{
if (!$query) {
throw new Exception(No query passed to Query method);
}

$result = mysql_query($query);
if (!$result) {
throw new Exception(Query  . $query .  is invalid.);
}
return $result;
}

Then simply:

$myquery = select * from table_that_exists;
try {
$result = Query($myquery);
echo Got result \n;
} catch (Exception $e) {
echo $e-getMessage() . \n;
// ... do whatever here.
}

$myquery = select * from table_that_doesnt_exist;
try {
$result = Query($myquery);
echo Got result\n;
} catch (Exception $e) {
echo $e-getMessage() . \n;
// ... do whatever here.
}



--
Postgresql  php tutorials
http://www.designmagick.com/

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



[PHP] Deleting all rows in a database every 24 hours?

2008-02-21 Thread Zoran Bogdanov
The title says it all, how do I perform an action every 24 hours?

Thank you. 

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



Re: [PHP] Deleting all rows in a database every 24 hours?

2008-02-21 Thread Paul Scott

On Fri, 2008-02-22 at 07:28 +0100, Zoran Bogdanov wrote:
 The title says it all, how do I perform an action every 24 hours?
 

$sql = TRUNCATE TABLE 'sometable';
$this-query($sql);

on a cron.daily

--Paul
-- 
.
| Chisimba PHP5 Framework - http://avoir.uwc.ac.za   |
::

All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm 

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

[PHP] URL modification

2008-02-21 Thread Xavier de Lapeyre
Hi all,

I saw on some websites that modifies the links to access the webpages.

Something like:
http://www.example.com/login/
instead of 
http://www.example.com/login.php

Does anyone knows how this works or how its call / which PHP library
performs this action?


Xavier de Lapeyre

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



RE: [PHP] URL modification

2008-02-21 Thread Andrés Robinet
 -Original Message-
 From: Xavier de Lapeyre [mailto:[EMAIL PROTECTED]
 Sent: Friday, February 22, 2008 2:09 AM
 To: php-general@lists.php.net
 Subject: [PHP] URL modification
 Importance: High
 
 Hi all,
 
 I saw on some websites that modifies the links to access the webpages.
 
 Something like:
 http://www.example.com/login/
 instead of
 http://www.example.com/login.php
 
 Does anyone knows how this works or how its call / which PHP library
 performs this action?
 
 
 Xavier de Lapeyre

That's called URI/URL Routing and it's usually performed as part of every MVC
Framework I know of (CodeIgniter, CakePHP, Symfony, Zend Framework... just to
name a few). It's usually implemented through Apache's mod_rewrite module, but
you can get close without that module, if you allow for something like:

http://www.example.com/index.php/myaccount/profile (that is, you don't need
mod_rewrite unless you want to remove the index.php part of the URI path)

However, if you have an existing website, migrating it to use one of the MVC
frameworks (or just using a stand-alone URI Routing class) may not be the path
you want to follow.
 
Regards,

Rob

Andrés Robinet | Lead Developer | BESTPLACE CORPORATION 
5100 Bayview Drive 206, Royal Lauderdale Landings, Fort Lauderdale, FL 33308 |
TEL 954-607-4207 | FAX 954-337-2695 | 
Email: [EMAIL PROTECTED]  | MSN Chat: [EMAIL PROTECTED]  |  SKYPE: bestplace |
Web: bestplace.biz  | Web: seo-diy.com

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