Re: [PHP] MySQL client version problem

2009-01-05 Thread Rene Fournier
Thing is, I have MySQL 5.0.67 installed, and I've never had MySQL 4 on  
this box (Xserve G5, Mac OS X Server 10.4.11). Here's my configure  
command:


./configure --prefix=/usr/local/php5 --mandir=/usr/share/man -- 
infodir=/usr/share/info --with-apxs --with-ldap=/usr --with-kerberos=/ 
usr --enable-cli --with-zlib-dir=/usr --with-libxml-dir=/usr --enable- 
exif --enable-ftp --enable-mbstring --enable-sockets --enable-fastcgi  
--with-iodbc=/usr --with-curl=/usr --with-config-file-path=/private/ 
etc --with-mysql=/usr --with-mysql-sock=/var/mysql/mysql.sock


If I remove --mysql=/usr, MySQL doesn't work at all (not surprising I  
guess). Is there something else I need to do to compile PHP with the  
latest MySQL module? (Which I don't understand--is the module part of  
the PHP source, or is it something external that gets linked to?)


...Rene

On 5-Jan-09, at 10:13 AM, c...@l-i-e.com wrote:



PHP had a built-in MySQL for awhile as I recall.



You had to explicitly use --with-mysql=/usr/local (or wherever you  
put your mysql headers/libs) to make it choose the one you wanted.




Even if it's not using built-in, it may have found an "old" install  
of your MySQL rather than your shiny new 5.0.45 version.




config.log will tell you what happened.



config.nice will tell you what you typed for ./configure



You definitely will want to fix this before you do anything else.



hth



--
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] MySQL client version problem

2009-01-05 Thread Rene Fournier
After following some instructions on compiling PHP 5.2.8 from source ( http://osx.topicdesk.com/content/view/48/62/ 
 ), I notice now that phpinfo() reports that I am running the MySQL  
client API version 4.1.22 (instead of 5.0.45).  Is this something to  
do with how you compile PHP, or does it depend on MySQL?


...Rene


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



[PHP] Regular expressions (regex) question for parsing

2008-12-22 Thread Rene Fournier
Hi, I'm looking for some ideas on the best way to parse blocks of text  
that is formatted such as:


$sometext %\r\n -- good data
$otherstring %\r\n  -- good data
$andyetmoretext %\r\n   -- good data
$finaltext  -- bad 
data (missing ending)

Each line should start with a $dollar sign, then some arbitrary text,  
ends with a percent sign, followed by carriage-return and line-feed.  
Sometimes though, the final line is not complete. In that case, I want  
to save those lines too.


so that I end up with an array like:

$result = array (   "matches" =>
array ( 0 => "$sometext %\r\n",
1 => "$otherstring %\r\n",
2 => "$andyetmoretext %\r\n"
),
"non_matches" =>
array ( 3 => "$finaltext"
)
);

The key thing here is that the line numbers are preserved and the non- 
matched lines are saved...


Any ideas, what's the best way to go about this? Preg_matc, preg_split  
or something incorporating explode?


Rene

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



[PHP] Instructions on compiling PHP 5.2.8 for Mac OS X Server 10.4.11

2008-12-12 Thread Rene Fournier
Since Marc Liyange hasn't updated his binary since 5.2.4, I've been  
looking for some instructions on building my own, specifically the  
latest 5.2.8 source for 10.4 Server. Google doesn't turn up anything  
for me. Anyone have a good link?


...Rene

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



Re: [PHP] Re: PHP Warning: HTTP request failed -- BSD resource limit reached?

2008-11-20 Thread Rene Fournier


On 20-Nov-08, at 3:57 PM, Nathan Rixham wrote:


Rene Fournier wrote:


On 20-Nov-08, at 12:44 PM, Daniel P. Brown wrote:

On Thu, Nov 20, 2008 at 2:41 PM, Rene Fournier  
<[EMAIL PROTECTED]> wrote:


There is no firewall between any of the servers -- they are all  
on the same

LAN.


  I read when you said that, but I must not have explained myself
well enough before.  Sorry.

  Linux, by default, has firewalls installed with the OS.  It
doesn't matter whether you're on a LAN, WAN, or all by your  
lonesome.


That's a good point, but I don't believe it can explain the  
failures, since even though one process repeatedly fails at an HTTP  
request to Server A, several other processes on the same box are  
successfully executing HTTP requests (file_get_contents()).


It seems to me that I'm periodically maxing-out a certain per- 
process resource limit.  For example, number of open files or  
something similar... (Assuming file_get_contents() counts as  
that)... After 10-60 seconds, previous open files/connections for  
that particular process close, allowing it to again open HTTP  
requests to Server A.  I


I guess my next question is, what resource does file_get_contents()  
use upon execution?


...Rene

is it an https(ssl) address you're calling, and more specifically  
IIS servers? if so they don't close the connection properly meaning  
the connections will be left open until they time out andthus cause  
you're problem.


Nope, it's just http, port 80, and not to IIS. To be clear, PHP  
scripts/processes on Server A (Mac OS X Server 10.4.11, PHP 5.2.4) are  
issuing these http requests (file_get_contents) to Servers B (Centos  
5.2) and itself (Server A).


The failures occur on attempts to Server B and A (itself), but only in  
one process at a time. (Server A is running several identical scripts/ 
processes -- even while one fails for a while, the others work -- that  
is, Servers B and A respond fine.)


...Rene



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



Re: [PHP] Re: PHP Warning: HTTP request failed -- BSD resource limit reached?

2008-11-20 Thread Rene Fournier


On 20-Nov-08, at 12:44 PM, Daniel P. Brown wrote:

On Thu, Nov 20, 2008 at 2:41 PM, Rene Fournier <[EMAIL PROTECTED]>  
wrote:


There is no firewall between any of the servers -- they are all on  
the same

LAN.


   I read when you said that, but I must not have explained myself
well enough before.  Sorry.

   Linux, by default, has firewalls installed with the OS.  It
doesn't matter whether you're on a LAN, WAN, or all by your lonesome.


That's a good point, but I don't believe it can explain the failures,  
since even though one process repeatedly fails at an HTTP request to  
Server A, several other processes on the same box are successfully  
executing HTTP requests (file_get_contents()).


It seems to me that I'm periodically maxing-out a certain per-process  
resource limit.  For example, number of open files or something  
similar... (Assuming file_get_contents() counts as that)... After  
10-60 seconds, previous open files/connections for that particular  
process close, allowing it to again open HTTP requests to Server A.  I


I guess my next question is, what resource does file_get_contents()  
use upon execution?


...Rene

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



Re: [PHP] Re: PHP Warning: HTTP request failed -- BSD resource limit reached?

2008-11-20 Thread Rene Fournier


On 20-Nov-08, at 10:46 AM, Nathan Rixham wrote:


Daniel P. Brown wrote:
On Thu, Nov 20, 2008 at 11:50 AM, Rene Fournier  
<[EMAIL PROTECTED]> wrote:
Don't think that can be it, since (a) the other processes are not  
being
denied their http requests and (b) requests are going to two  
servers.

   Have you checked your firewall settings?  It may be configured to
deny requests temporarily on hosts it thinks may be attempting an  
HTTP
DDoS, or perhaps something similar.  Nathan mentioned the same, but  
is

it possible that you're only considering a hardware firewall?  Unless
explicitly configured, a software firewall on the OS level could be
blocking all matching traffic on all interfaces (including the LAN).


Rene, are you forking the command line script for each request by  
any chance? if you are remember to do an exit() after each one is  
finished otherwise the new forked process will stay open until  
cleaned up by the system (or until the thread that forked is  
finished) which could be creating you're problem.


apologies if way off the mark, just attempting some lateral thinking  
on this one!


No apologies necessary -- I really appreciate the feedback.

But no, I'm not forking anything. Each script (process) runs in a  
loop, and during each iteration it will call file_get_contents(Server  
A/B) one or more times.


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



Re: [PHP] Re: PHP Warning: HTTP request failed -- BSD resource limit reached?

2008-11-20 Thread Rene Fournier


On 20-Nov-08, at 9:56 AM, Daniel P. Brown wrote:

On Thu, Nov 20, 2008 at 11:50 AM, Rene Fournier  
<[EMAIL PROTECTED]> wrote:


Don't think that can be it, since (a) the other processes are not  
being

denied their http requests and (b) requests are going to two servers.


   Have you checked your firewall settings?  It may be configured to
deny requests temporarily on hosts it thinks may be attempting an HTTP
DDoS, or perhaps something similar.  Nathan mentioned the same, but is
it possible that you're only considering a hardware firewall?  Unless
explicitly configured, a software firewall on the OS level could be
blocking all matching traffic on all interfaces (including the LAN).


There is no firewall between any of the servers -- they are all on the  
same LAN.


...Rene

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



Re: [PHP] Re: PHP Warning: HTTP request failed -- BSD resource limit reached?

2008-11-20 Thread Rene Fournier


On 20-Nov-08, at 2:59 AM, Nathan Rixham wrote:


Rene Fournier wrote:

On 19-Nov-08, at 12:52 PM, Nathan Rixham wrote:

Rene Fournier wrote:

Hi,
I have four identical command-line PHP scripts running, and each  
will frequently fetch some data from another server via  
file_get_contents(). By frequently, I mean on average, every  
second.
Periodically, one of the processes (command-line PHP scripts),  
will fail on file_get_contents(), with the error message:


first thing that springs to mind is some form of hardware  
limitation, quite sure it's not php - could be a firewall with  
flood protection (or even your own isp's anti malware set-up)
to combat it try binding the outgoing request to a random ip each  
time (if you have multiple ip's on the box) [context: socket ->  
bindto]
That could explain it, except that all the traffic is on the same  
LAN. There's no firewall between Server A and Servers B and C.
next up (very unlikely) but possibly outgoing port conflict where  
the previous local port is still closing whilst trying to be re- 
opened.

That's interesting. I will look into that.
to get an ideal fix though you'll want to move away from  
file_get_contents() as you're not doing things
Yes, I've also read that CURL is preferred to file_get_contents for  
reasons of performance and security. I'm going to try that too.
the most efficient way; HTTP/1.1 allows you to keep a port open  
and make multiple requests through the same socket/connection,  
simply keep the socket open and don't send a connection: close  
header after the request. (i say simply but you'll be needing to  
make you're own, or find a good, http handler that allows you to  
write raw requests and decode the raw http responses that come back)


best of luck; feel free to post your code incase anything jumps  
out as obvious.



I will let you know how it goes. Thanks for the advice!
...Rene


had another thought, it could be the web server you're requesting  
that is locking up, not enough worker threads, running cpu high etc  
etc - worth checking


Don't think that can be it, since (a) the other processes are not  
being denied their http requests and (b) requests are going to two  
servers.



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



[PHP] fread() behaviour

2008-11-19 Thread Rene Fournier
I'm trying to understand something about fread(). I'm using fread() on  
an incoming socket stream that will send, for example, 26630 characters:


while ( ($buf=fread($read[$i], 8192)) != '' ) {
$sock_data .= $buf;
usleep(1000);
echo ".";
}
echo ",";


As soon as the socket client sends the data, immediately the server  
will echo:




Then wait nearly a minute, and echo:

,

So my question is, why does fread wait if there is nothing more to  
read? Shouldn't it return immediately? (That's what I want.) And as  
for the delay, it's there so that if the incoming data is a little  
slow, it has time to catch up with fread. Thanks.


...Rene

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



Re: [PHP] Re: PHP Warning: HTTP request failed -- BSD resource limit reached?

2008-11-19 Thread Rene Fournier

On 19-Nov-08, at 12:52 PM, Nathan Rixham wrote:


Rene Fournier wrote:

Hi,
I have four identical command-line PHP scripts running, and each  
will frequently fetch some data from another server via  
file_get_contents(). By frequently, I mean on average, every second.
Periodically, one of the processes (command-line PHP scripts), will  
fail on file_get_contents(), with the error message:


first thing that springs to mind is some form of hardware  
limitation, quite sure it's not php - could be a firewall with flood  
protection (or even your own isp's anti malware set-up)
to combat it try binding the outgoing request to a random ip each  
time (if you have multiple ip's on the box) [context: socket ->  
bindto]


That could explain it, except that all the traffic is on the same LAN.  
There's no firewall between Server A and Servers B and C.


next up (very unlikely) but possibly outgoing port conflict where  
the previous local port is still closing whilst trying to be re- 
opened.


That's interesting. I will look into that.

to get an ideal fix though you'll want to move away from  
file_get_contents() as you're not doing things


Yes, I've also read that CURL is preferred to file_get_contents for  
reasons of performance and security. I'm going to try that too.



the most efficient way; HTTP/1.1 allows you to keep a port open and  
make multiple requests through the same socket/connection, simply  
keep the socket open and don't send a connection: close header after  
the request. (i say simply but you'll be needing to make you're own,  
or find a good, http handler that allows you to write raw requests  
and decode the raw http responses that come back)


best of luck; feel free to post your code incase anything jumps out  
as obvious.





I will let you know how it goes. Thanks for the advice!

...Rene


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



[PHP] PHP Warning: HTTP request failed -- BSD resource limit reached?

2008-11-19 Thread Rene Fournier

Hi,

I have four identical command-line PHP scripts running, and each will  
frequently fetch some data from another server via  
file_get_contents(). By frequently, I mean on average, every second.


Periodically, one of the processes (command-line PHP scripts), will  
fail on file_get_contents(), with the error message:


	PHP Warning: file_get_contents(http://.../): failed to open stream:  
HTTP request failed!


Sometimes it's a single failure, other times, it fails repeatedly for  
30-60 seconds, then starts working again. Strange, no?


At first, I thought maybe I've maxed out the server in question, but  
I'm not. This problem happens on both servers that the scripts fetch  
data from. And more significantly, while one process may fail at  
file_get_contents(), the other processes (running identical code) on  
the same box continue to execute the function (against the same  
servers) without incident.


My question is, is there some resource in Mac OS X Server 10.4 (or PHP  
5.2.4) that would limit a continuously running PHP script from  
executing file_get_contents()? And to be clear, the failure doesn't  
kill the script, and after the failure, it will start working again.


...Rene

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



[PHP] Re: Ancient, unsolved high-CPU problem

2008-09-22 Thread Rene Fournier

In case you wanted more detail:

+---+---+
| Variable_name | Value |
+---+---+
| Aborted_clients   | 14|
| Aborted_connects  | 4 |
| Binlog_cache_disk_use | 0 |
| Binlog_cache_use  | 0 |
| Bytes_received| 78|
| Bytes_sent| 72|
| Com_admin_commands| 0 |
| Com_alter_db  | 0 |
| Com_alter_table   | 0 |
| Com_analyze   | 0 |
| Com_backup_table  | 0 |
| Com_begin | 0 |
| Com_call_procedure| 0 |
| Com_change_db | 0 |
| Com_change_master | 0 |
| Com_check | 0 |
| Com_checksum  | 0 |
| Com_commit| 0 |
| Com_create_db | 0 |
| Com_create_function   | 0 |
| Com_create_index  | 0 |
| Com_create_table  | 0 |
| Com_create_user   | 0 |
| Com_dealloc_sql   | 0 |
| Com_delete| 0 |
| Com_delete_multi  | 0 |
| Com_do| 0 |
| Com_drop_db   | 0 |
| Com_drop_function | 0 |
| Com_drop_index| 0 |
| Com_drop_table| 0 |
| Com_drop_user | 0 |
| Com_execute_sql   | 0 |
| Com_flush | 0 |
| Com_grant | 0 |
| Com_ha_close  | 0 |
| Com_ha_open   | 0 |
| Com_ha_read   | 0 |
| Com_help  | 0 |
| Com_insert| 0 |
| Com_insert_select | 0 |
| Com_kill  | 0 |
| Com_load  | 0 |
| Com_load_master_data  | 0 |
| Com_load_master_table | 0 |
| Com_lock_tables   | 0 |
| Com_optimize  | 0 |
| Com_preload_keys  | 0 |
| Com_prepare_sql   | 0 |
| Com_purge | 0 |
| Com_purge_before_date | 0 |
| Com_rename_table  | 0 |
| Com_repair| 0 |
| Com_replace   | 0 |
| Com_replace_select| 0 |
| Com_reset | 0 |
| Com_restore_table | 0 |
| Com_revoke| 0 |
| Com_revoke_all| 0 |
| Com_rollback  | 0 |
| Com_savepoint | 0 |
| Com_select| 0 |
| Com_set_option| 0 |
| Com_show_binlog_events| 0 |
| Com_show_binlogs  | 0 |
| Com_show_charsets | 0 |
| Com_show_collations   | 0 |
| Com_show_column_types | 0 |
| Com_show_create_db| 0 |
| Com_show_create_table | 0 |
| Com_show_databases| 0 |
| Com_show_errors   | 0 |
| Com_show_fields   | 0 |
| Com_show_grants   | 0 |
| Com_show_innodb_status| 0 |
| Com_show_keys | 0 |
| Com_show_logs | 0 |
| Com_show_master_status| 0 |
| Com_show_ndb_status   | 0 |
| Com_show_new_master   | 0 |
| Com_show_open_tables  | 0 |
| Com_show_privileges   | 0 |
| Com_show_processlist  | 0 |
| Com_show_slave_hosts  | 0 |
| Com_show_slave_status | 0 |
| Com_show_status   | 1 |
| Com_show_storage_engines  | 0 |
| Com_show_tables   | 0 |
| Com_show_triggers | 0 |
| Com_show_variables| 0 |
| Com_show_warnings | 0 |
| Com_slave_start   | 0 |
| Com_slave_stop| 0 |
| Com_stmt_close| 0 |
| Com_stmt_execute  | 0 |
| Com_stmt_fetch| 0 |
| Com_stmt_prep

[PHP] Command-line PHP memory limit

2008-06-11 Thread Rene Fournier
Is it possible to set a unique memory limit for PHP scripts that are  
run from the command line? (That is, different from what's specified  
in php.ini.)


...Rene



[PHP] htaccess and $PHP_AUTH_USER

2001-08-28 Thread Rene Fournier

Please, someone, help me...

What I want to do:  Have a user prompted for an ID/password, both of which
(if valid), get passed to a PHP script, which then uses the ID/password to
selectively display certain fields of a table.  (For example, if the user
logs in as "Sales", he would only see the sales-related fields of the
tables.  Whereas, if the user logs in as "Production", she would see the
production-related fields.  Pretty simple.)

I've read the PHP docs on $PHP_AUTH_USER.  One stupid question:  Must I use
the htaccess directory-protection feature of Apache in order for this to
work (or is$PHP_AUTH_USER not dependent on Apache (or any web server) at
all)?  I mean, from reading the docs, it seems as if the value stored in
$PHP_AUTH_USER comes what the user types into the Apache-spawned dialog box
(when the user types the URL containing that password-protected
directory.)??  The thing is, when I turn password protection on for the
directory in question, and add the users and passwords to the htaccess file,
then go to the URL in the browser, I get prompted several times for a user
and password--first, it seems, by Apache, then by the PHP code I copied from
the docs.

If anyone can help, I'd greatly appreciate it.  Best would be some real code
running in a similar server environment.  (The site in question is running
on www.fatcow.com servers--they're running PHP3 (shouldn't matter, right)
and Apache.)

MUCH thanks in advance...

...Rene

---
Rene Fournier,
[EMAIL PROTECTED]


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




[PHP] Can I turn this error off?

2001-08-17 Thread Rene Fournier

Just started learning PHP/MySQL a couple days ago, and would like to know if
I can somehow suppress the following error:

Warning: Undefined variable: submit in c:\Program Files\Apache
Group\Apache\htdocs/smartslitters/invoices.php on line 22

Is it just a server or PHP setting or something?  Any suggestions are much
appreciated. Thanks.

(I hope no minds if I attach the source files...)

...Rene

---
Rene Fournier,
[EMAIL PROTECTED]



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