Re: [PHP] Looking for ways to prevent timeout

2007-11-05 Thread Jon Westcot
Hi Nathan:

No, I'm not familiar with Ajax.  Where can I read up on it?  More
important, how can I find out if Ajax is implemented on the server?  Or is
it something I can add myself?

Thanks again,

Jon

- Original Message -
From: "Nathan Nobbe" <[EMAIL PROTECTED]>
To: "Jon Westcot" <[EMAIL PROTECTED]>
Cc: "PHP General" 
Sent: Sunday, November 04, 2007 7:53 PM
Subject: Re: [PHP] Looking for ways to prevent timeout


> On 11/4/07, Jon Westcot <[EMAIL PROTECTED]> wrote:
> >
> > Hi all:
> >
> > I'm hoping to find a solution to the problem I'm having with my
script
> > timing out while inserting records into a table.
> >
> > Overall, the process is pretty fast, which is impressive, but when
it
> > gets to the 22,000 to 23,000 record mark, it seems to time out.  I've
had it
> > get up over 26,000 so far, but nothing better than that.  And I only
need to
> > process around 30,000 right now.
> >
> > I've tried setting max_execution_time to 1800; no improvement.  The
> > value for max_input_time is -1, which, if I understood it correcctly, is
the
> > same as saying no limit.  And I've tried calling set_time_limit() with
both
> > 0 and with 360, none of which seemed to help.
> >
> > Is there ANY WAY to increase the amount of time I can use when
running
> > a script that will work?  I've tried everything I can find in the PHP
> > manual.
> >
> > Any help you can provide will be greatly appreciated!
>
>
> are you familiar with ajax ?
> i would build some client side tool that would split the job into a series
> of requests.
> say, you input 20,000; then the script fires off 5 requests, to do 4000
> inserts a piece.
> you could easily implement a status bar and it would be guaranteed to
work.
> also, it would scale just about as high as you can imagine.
>
> -nathan
>

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



Re: [PHP] Looking for ways to prevent timeout

2007-11-05 Thread Jon Westcot
Hi Jochem:

Thanks for the suggestion.  Not to sound more dense than I already seem,
but how do I do this?  How do I tell the browser that something is still
running?  I'm issuing a flush() after every 1000 records along with echoing
a textual status update.  Should I do it more frequently, say every 100
records?

I'm really struggling with this concept here, and I appreciate the help
that everyone is giving me!

Jon

- Original Message -
From: "Jochem Maas" <[EMAIL PROTECTED]>
To: "Jon Westcot" <[EMAIL PROTECTED]>
Cc: "PHP General" 
Sent: Sunday, November 04, 2007 7:28 PM
Subject: Re: [PHP] Looking for ways to prevent timeout


> Jon Westcot wrote:
> > Hi all:
> >
> > I'm hoping to find a solution to the problem I'm having with my
script timing out while inserting records into a table.
> >
> > Overall, the process is pretty fast, which is impressive, but when
it gets to the 22,000 to 23,000 record mark, it seems to time out.  I've had
it get up over 26,000 so far, but nothing better than that.  And I only need
to process around 30,000 right now.
> >
> > I've tried setting max_execution_time to 1800; no improvement.  The
value for max_input_time is -1, which, if I understood it correcctly, is the
same as saying no limit.  And I've tried calling set_time_limit() with both
0 and with 360, none of which seemed to help.
> >
> > Is there ANY WAY to increase the amount of time I can use when
running a script that will work?  I've tried everything I can find in the
PHP manual.
> >
> > Any help you can provide will be greatly appreciated!
>
> http://php.net/ignore_user_abort will help, but nothing will stop you
hitting a max execution time.
> but my guess is your not hitting the max but rather the browser is killing
the connection because it's
> had no response fom your script and as a result apache is killing your
script as it thinks it's no longer
> needed (i.e. the browser no longer wants the response).
>
> >
> > Jon
> >
>
>

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



Re: [PHP] How to replace define in a require file with mysql?

2007-11-05 Thread Zoltán Németh
2007. 11. 5, hétfő keltezéssel 06.10-kor Ronald Wiplinger ezt írta:
> Jim Lucas wrote:
> > Ronald Wiplinger wrote:
> >> I have a file linked with require into my program with statements like:
> >>
> >> define("_ADDRESS","Address");
> >> define("_CITY","City");
> >>
> >> I would like to replace this with a mysql table with these two fields
> >> (out of many other fields).
> >>
> >> How can I do that?
> >>
> >> bye
> >>
> >> Ronald
> >>
> > Well, if you have all the settings in a DB already, then what I would
> > do is this.
> >
> > SELECT param_name, param_value FROM yourTable;
> >
> > then
> >
> > while ( list($name, $value) = mysql_fetch_row($results_handler) ) {
> > define($name, $value);
> > }
> >
> > put this in place of your existing defines and you should be good.
> >
> 
> Thanks! Works fine!
> I need now a modification for that.
> 
> Two values:
> SELECT param_name, param_value1, param_value2 FROM yourTable;
> 
> IF param_value1 is empty, than it should use param_value2

try something like this sql:

SELECT param_name, IF ((param_value1 <> '') AND NOT
ISNULL(param_value1), param_value1, param_value2) AS param_value FROM
yourTable

greets
Zoltán Németh

> 
> How can I add this?
> 
> Thank you again.
> 
> bye
> 
> Ronald
> 

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



Re: [PHP] Looking for ways to prevent timeout

2007-11-05 Thread Jochem Maas
Jon Westcot wrote:
> Hi Jochem:
> 
> Thanks for the suggestion.  Not to sound more dense than I already seem,
> but how do I do this?  

by calling the function somewhere near the top of your script?

ignore_user_abort();

How do I tell the browser that something is still
> running?  I'm issuing a flush() after every 1000 records along with echoing
> a textual status update.  Should I do it more frequently, say every 100
> records?

I have never trusted that method of keeping the browser from thinking the
response is not forthcoming but it's better than nothing.

> 
> I'm really struggling with this concept here, and I appreciate the help
> that everyone is giving me!

dont forget to read the manuAl AND the user comments on the pages relevant to
the functions you are using to tackle the problem

> 
> Jon
> 
> - Original Message -
> From: "Jochem Maas" <[EMAIL PROTECTED]>
> To: "Jon Westcot" <[EMAIL PROTECTED]>
> Cc: "PHP General" 
> Sent: Sunday, November 04, 2007 7:28 PM
> Subject: Re: [PHP] Looking for ways to prevent timeout
> 
> 
>> Jon Westcot wrote:
>>> Hi all:
>>>
>>> I'm hoping to find a solution to the problem I'm having with my
> script timing out while inserting records into a table.
>>> Overall, the process is pretty fast, which is impressive, but when
> it gets to the 22,000 to 23,000 record mark, it seems to time out.  I've had
> it get up over 26,000 so far, but nothing better than that.  And I only need
> to process around 30,000 right now.
>>> I've tried setting max_execution_time to 1800; no improvement.  The
> value for max_input_time is -1, which, if I understood it correcctly, is the
> same as saying no limit.  And I've tried calling set_time_limit() with both
> 0 and with 360, none of which seemed to help.
>>> Is there ANY WAY to increase the amount of time I can use when
> running a script that will work?  I've tried everything I can find in the
> PHP manual.
>>> Any help you can provide will be greatly appreciated!
>> http://php.net/ignore_user_abort will help, but nothing will stop you
> hitting a max execution time.
>> but my guess is your not hitting the max but rather the browser is killing
> the connection because it's
>> had no response fom your script and as a result apache is killing your
> script as it thinks it's no longer
>> needed (i.e. the browser no longer wants the response).
>>
>>> Jon
>>>
>>
> 

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



Re: [PHP] Page cannot be displayed error in IE6

2007-11-05 Thread tanzeem

Thanks nathan, But i  cant use 'get' since the string being submitted is very
big. I tried PHP headers as referred to by another website. This only
produced  warning message: headers already sent... etc .

quickshiftin wrote:
> 
> On 11/3/07, tanzeem <[EMAIL PROTECTED]> wrote:
>>
>>
>> i have 3 php files pag1.php,page2.php,page3.php
>> I posted to page2.php from page1.php
>> Then again posted from page2.php to page3.php
>> But when i click th back button from page3.php in IE 6.0 it displays
>> a page cannot be displayed error.
>> When i tried the same with Firefox it displayed the page2.php correctly.
>> Can anyone suggest a solution to thsi problem
> 
> 
> im surprised you  dont get a warning in firefox as well.
> when you send a request to the server  via HTTP POST,
> subsequent retransmission of the same request causes browsers
> to generate an warning.
> the reason is because HTTP POST is designed for requests that will
> alerter, add, or destroy data on the server; typically in a database
> these days, whereas a get request is just for viewing a resource.
> think of a site where you make a purchase.  on the last page of
> the checkout process, your sensitive data is posted to the server,
> then if you try pressing back the warning is raised by the browser.
> this is so your card is not accidentally billed twice, and usually
> you will see messages on the page that say dont press back or
> dont send this page twice.
> 
> so if youre pages constitute a request that inovokes a change
> in the data on the server, they are probly fine already.  otherwise
> switch the request method to get, and youll be able to use the
> back button w/o warning.
> 
> -nathan
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Page-cannot-be-displayed-error-in-IE6-tf4742094.html#a13583793
Sent from the PHP - General mailing list archive at Nabble.com.

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



Re: [PHP] How to replace define in a require file with mysql?

2007-11-05 Thread Robin Vickery
On 05/11/2007, Zoltán Németh <[EMAIL PROTECTED]> wrote:
> 2007. 11. 5, hétfő keltezéssel 06.10-kor Ronald Wiplinger ezt írta:
> > Jim Lucas wrote:
> > > Ronald Wiplinger wrote:
> > >> I have a file linked with require into my program with statements like:
> > >>
> > >> define("_ADDRESS","Address");
> > >> define("_CITY","City");
> > >>
> > >> I would like to replace this with a mysql table with these two fields
> > >> (out of many other fields).
> > >>
> > >> How can I do that?
> > >>
> > >> bye
> > >>
> > >> Ronald
> > >>
> > > Well, if you have all the settings in a DB already, then what I would
> > > do is this.
> > >
> > > SELECT param_name, param_value FROM yourTable;
> > >
> > > then
> > >
> > > while ( list($name, $value) = mysql_fetch_row($results_handler) ) {
> > > define($name, $value);
> > > }
> > >
> > > put this in place of your existing defines and you should be good.
> > >
> >
> > Thanks! Works fine!
> > I need now a modification for that.
> >
> > Two values:
> > SELECT param_name, param_value1, param_value2 FROM yourTable;
> >
> > IF param_value1 is empty, than it should use param_value2
>
> try something like this sql:
>
> SELECT param_name, IF ((param_value1 <> '') AND NOT
> ISNULL(param_value1), param_value1, param_value2) AS param_value FROM
> yourTable

or use COALESCE()

(http://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html#function_coalesce)

SELECT param_name, COALESCE(param_value1, param_value2) AS param_value
FROM yourTable;

-robin


[PHP] Re: How do I specify a local file for fopen()?

2007-11-05 Thread Colin Guthrie
Jon Westcot wrote:
> Hi all:
> 
> I've been beating my head against a brick wall trying to figure this
> out and I'm still no closer than I was two weeks ago.
> 
> How do I specify a local file on my computer to use with fopen() on
> the server?

Keep on beating it until you get the concept of client-server computing :p

There is no standard way a webserver can access information on the
client's computer. Enabling this kind of interaction would be a complete
no-no from a security perspective and it would also require that a
channel be opened *from* the server *to* the client (which is the
opposite way round - e.g. the client becomes a server and the server
becomes a client!

> I've checked and the allow_url_fopen setting is set to On.  I use the
> html  to let me browse to the file.  This,
> however, forces me to also POST the entire file to the server, which
> I DO NOT WANT it to do.  I just wanted to be able to use the 
> button to get to the file name.  But, even when I do this, the file
> name returned in the $_FILES array doesn't give me a file name that
> fopen() will actually open.

This is how you send files to the webserver. If you want the server to
access the files on the client then you have to either send them or
provide some way for the client to become a server in some capacity
through the running of a local application (or Java Applet), and then
you have to make sure you can negotiate any firewall and NAT'ed gateways
that may be inbetween!


> Do I somehow have to get the server to recognize my computer as an
> http-based address?  If so, how do I do this?  The computer that has
> the file to be opened is a Windows-based computer (running WinXP or
> Vista), and it obviously has an Internet connection.  Do I need to
> retrieve, from the server, my computer's IP address and use that, in
> whole or in part, to reference the file to be opened?  If so, how?

It's one of the ways, or you could just setup the client to do a samba
share and mount it on the server, or any number of other techniques.
Obviously this architecture only has legs in a very locked down and
standard environment - it's no good for the open internet.

> While I'm asking questions, does anyone know how to keep the file
> referenced in the  setup from actually being sent?
> All I think I really need is the NAME of the file, not its actual
> contents, since I'm hoping to use fopen() to open the file and then
> to use fgetcsv() to retrieve the contents.

The name gives you nothing, as there is no way to hook back to the
client! You're approach is fundamentally wrong.


> ANY help you all can send my way will be greatly appreciated!

Depending what you want your app to do you need to look at running
something locally on the client. One method that spring to mind would be
a Java applet that can run load up the local files and then manipulate
them accordingly, potentially speaking to webservices provided by your
server in the process.


Col

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



[PHP] Problem with input name, how can i use . (dot) in a name of a input type text?

2007-11-05 Thread Jônata Tyska Carvalho
Hi

Im having a big problem because the name of one input type text that is '
table.name' in my html, becomes 'table_name' in php, it is a kind of bug??
=S





in PHP we have:

$_POST["table_name"] instead of $_POST["table.name"]



someone knows some way to put this to work?? i wanna send 'table.name' and
receive in php 'table.name'!

Thanks

-- 
Jônata Tyska Carvalho
-
-- Técnico em Informática pelo Colégio Técnico Industrial (CTI)
-- Graduando em Engenharia de Computação
Fundação Universidade Federal de Rio Grande (FURG)


RE: [PHP] Re: How do I specify a local file for fopen()?

2007-11-05 Thread admin
I simply do this

$file="/home/images/index.html";
$output = fopen($file, "w");



-Original Message-
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Colin Guthrie
Sent: Monday, November 05, 2007 4:06 AM
To: php-general@lists.php.net
Subject: [PHP] Re: How do I specify a local file for fopen()?

Jon Westcot wrote:
> Hi all:
> 
> I've been beating my head against a brick wall trying to figure this
> out and I'm still no closer than I was two weeks ago.
> 
> How do I specify a local file on my computer to use with fopen() on
> the server?

Keep on beating it until you get the concept of client-server computing :p

There is no standard way a webserver can access information on the
client's computer. Enabling this kind of interaction would be a complete
no-no from a security perspective and it would also require that a
channel be opened *from* the server *to* the client (which is the
opposite way round - e.g. the client becomes a server and the server
becomes a client!

> I've checked and the allow_url_fopen setting is set to On.  I use the
> html  to let me browse to the file.  This,
> however, forces me to also POST the entire file to the server, which
> I DO NOT WANT it to do.  I just wanted to be able to use the 
> button to get to the file name.  But, even when I do this, the file
> name returned in the $_FILES array doesn't give me a file name that
> fopen() will actually open.

This is how you send files to the webserver. If you want the server to
access the files on the client then you have to either send them or
provide some way for the client to become a server in some capacity
through the running of a local application (or Java Applet), and then
you have to make sure you can negotiate any firewall and NAT'ed gateways
that may be inbetween!


> Do I somehow have to get the server to recognize my computer as an
> http-based address?  If so, how do I do this?  The computer that has
> the file to be opened is a Windows-based computer (running WinXP or
> Vista), and it obviously has an Internet connection.  Do I need to
> retrieve, from the server, my computer's IP address and use that, in
> whole or in part, to reference the file to be opened?  If so, how?

It's one of the ways, or you could just setup the client to do a samba
share and mount it on the server, or any number of other techniques.
Obviously this architecture only has legs in a very locked down and
standard environment - it's no good for the open internet.

> While I'm asking questions, does anyone know how to keep the file
> referenced in the  setup from actually being sent?
> All I think I really need is the NAME of the file, not its actual
> contents, since I'm hoping to use fopen() to open the file and then
> to use fgetcsv() to retrieve the contents.

The name gives you nothing, as there is no way to hook back to the
client! You're approach is fundamentally wrong.


> ANY help you all can send my way will be greatly appreciated!

Depending what you want your app to do you need to look at running
something locally on the client. One method that spring to mind would be
a Java applet that can run load up the local files and then manipulate
them accordingly, potentially speaking to webservices provided by your
server in the process.


Col

-- 
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] Problem with input name, how can i use . (dot) in a name of a input type text?

2007-11-05 Thread Stut

Jônata Tyska Carvalho wrote:

Im having a big problem because the name of one input type text that is '
table.name' in my html, becomes 'table_name' in php, it is a kind of bug??
=S





in PHP we have:

$_POST["table_name"] instead of $_POST["table.name"]

someone knows some way to put this to work?? i wanna send 'table.name' and
receive in php 'table.name'!


I don't know for certain but that's likely happening because a period is 
not valid in a PHP variable name. One alternative would be to use 
table[name] instead. This will lead to $_POST['table']['name'].


-Stut

--
http://stut.net/

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



Re: [PHP] Problem with input name, how can i use . (dot) in a name of a input type text?

2007-11-05 Thread Jochem Maas
Stut wrote:
> Jônata Tyska Carvalho wrote:
>> Im having a big problem because the name of one input type text that is '
>> table.name' in my html, becomes 'table_name' in php, it is a kind of
>> bug??
>> =S
>>
>> 
>> 
>> 
>>
>> in PHP we have:
>>
>> $_POST["table_name"] instead of $_POST["table.name"]
>>
>> someone knows some way to put this to work?? i wanna send 'table.name'
>> and
>> receive in php 'table.name'!
> 
> I don't know for certain but that's likely happening because a period is
> not valid in a PHP variable name. One alternative would be to use
> table[name] instead. This will lead to $_POST['table']['name'].

I think Stut is correct - the period is a concatenation operator.
also there are plenty of alertnatives to the Stuts suggested 'table[name]' 
naming approach.

that said given the following code:

$f = "my.bad";
$$f = "MY BAD";
echo $f, "\n", $$f, "\n";

... I personally feel that the $_POST should just contain
'table.name' - which is not an illegal array key - most likely the reason it is 
(the var name)
transformed is due to BC, namely with register_globals set to ON php is 
required to automatically
create a variable $table.name (which is not legal).

> 
> -Stut
> 

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



[PHP] Re: How do I specify a local file for fopen()?

2007-11-05 Thread Colin Guthrie
[EMAIL PROTECTED] wrote:
> I simply do this
> 
> $file="/home/images/index.html";
> $output = fopen($file, "w");

I'd read the post again! The OP was asking how the *server* could open a
file on the *client*. You've just describe how the *server* opens a file
on the *server* (e.g. itself).

Quite different I'm sure you'll agree!

Col

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



RE: [PHP] Re: How do I specify a local file for fopen()?

2007-11-05 Thread admin
I would like to change my answer to that question. Due to my lack in desire, to 
read the entire email at first
I have made a bad judgment error in exactly what you was trying to do.

Yes trying to open a file on your local computer from the server is not a good 
idea. 
HOW EVER.
There are many options.
A FTP option
$handle = fopen("ftp://user:[EMAIL PROTECTED]/somefile.txt", "w");
Providing you have the ftp port open into your network/computer for ftp access.

Personally I would never do that.


-Original Message-
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Colin Guthrie
Sent: Monday, November 05, 2007 4:06 AM
To: php-general@lists.php.net
Subject: [PHP] Re: How do I specify a local file for fopen()?

Jon Westcot wrote:
> Hi all:
> 
> I've been beating my head against a brick wall trying to figure this
> out and I'm still no closer than I was two weeks ago.
> 
> How do I specify a local file on my computer to use with fopen() on
> the server?

Keep on beating it until you get the concept of client-server computing :p

There is no standard way a webserver can access information on the
client's computer. Enabling this kind of interaction would be a complete
no-no from a security perspective and it would also require that a
channel be opened *from* the server *to* the client (which is the
opposite way round - e.g. the client becomes a server and the server
becomes a client!

> I've checked and the allow_url_fopen setting is set to On.  I use the
> html  to let me browse to the file.  This,
> however, forces me to also POST the entire file to the server, which
> I DO NOT WANT it to do.  I just wanted to be able to use the 
> button to get to the file name.  But, even when I do this, the file
> name returned in the $_FILES array doesn't give me a file name that
> fopen() will actually open.

This is how you send files to the webserver. If you want the server to
access the files on the client then you have to either send them or
provide some way for the client to become a server in some capacity
through the running of a local application (or Java Applet), and then
you have to make sure you can negotiate any firewall and NAT'ed gateways
that may be inbetween!


> Do I somehow have to get the server to recognize my computer as an
> http-based address?  If so, how do I do this?  The computer that has
> the file to be opened is a Windows-based computer (running WinXP or
> Vista), and it obviously has an Internet connection.  Do I need to
> retrieve, from the server, my computer's IP address and use that, in
> whole or in part, to reference the file to be opened?  If so, how?

It's one of the ways, or you could just setup the client to do a samba
share and mount it on the server, or any number of other techniques.
Obviously this architecture only has legs in a very locked down and
standard environment - it's no good for the open internet.

> While I'm asking questions, does anyone know how to keep the file
> referenced in the  setup from actually being sent?
> All I think I really need is the NAME of the file, not its actual
> contents, since I'm hoping to use fopen() to open the file and then
> to use fgetcsv() to retrieve the contents.

The name gives you nothing, as there is no way to hook back to the
client! You're approach is fundamentally wrong.


> ANY help you all can send my way will be greatly appreciated!

Depending what you want your app to do you need to look at running
something locally on the client. One method that spring to mind would be
a Java applet that can run load up the local files and then manipulate
them accordingly, potentially speaking to webservices provided by your
server in the process.


Col

-- 
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] Looking for ways to prevent timeout

2007-11-05 Thread Nathan Nobbe
On 11/5/07, Jon Westcot <[EMAIL PROTECTED]> wrote:
>
> Hi Nathan:
>
> No, I'm not familiar with Ajax.  Where can I read up on it?  More
> important, how can I find out if Ajax is implemented on the server?  Or is
> it something I can add myself?
>


if you arent familiar w/ ajax, no worries; the main concept in my suggestion
is
sending a number of requests rather than a single request.  that way you can
execute a fraction of the queries on each request.  this will ensure that
you  dont
hit the maximum execution time.

a purely php approach would be using the header() function.  so, on each
request
where the queries are not yet complete, your script sends a header tag to
the browser
which will immediately invoke another request back on the same script.
once all the queries have been executed dont invoke the header() function,
that would
essentially be the results page.
the reason i prefer ajax over this approach is that the page will be
blanking out a lot,
basically on every request.  but it would defiantly work.

also, ajax is mainly a client side technology; where http requests are sent
to the
server without incurring a ful page refresh.  you need nothing extra on the
server.
ive been using prototype, a javascript toolkit which has some nice support
for ajax.
if you want to  check it out, heres an article on ajax using prototype:
http://www.prototypejs.org/learn/introduction-to-ajax

-nathan


Re: [PHP] Problem with input name, how can i use . (dot) in a name of a input type text?

2007-11-05 Thread Stut

Jochem Maas wrote:

Stut wrote:

Jônata Tyska Carvalho wrote:

Im having a big problem because the name of one input type text that is '
table.name' in my html, becomes 'table_name' in php, it is a kind of
bug??
=S





in PHP we have:

$_POST["table_name"] instead of $_POST["table.name"]

someone knows some way to put this to work?? i wanna send 'table.name'
and
receive in php 'table.name'!

I don't know for certain but that's likely happening because a period is
not valid in a PHP variable name. One alternative would be to use
table[name] instead. This will lead to $_POST['table']['name'].


I think Stut is correct - the period is a concatenation operator.
also there are plenty of alertnatives to the Stuts suggested 'table[name]' 
naming approach.

that said given the following code:

$f = "my.bad";
$$f = "MY BAD";
echo $f, "\n", $$f, "\n";

... I personally feel that the $_POST should just contain
'table.name' - which is not an illegal array key - most likely the reason it is 
(the var name)
transformed is due to BC, namely with register_globals set to ON php is 
required to automatically
create a variable $table.name (which is not legal).


Indeed. I think technically this would be a bug because in an ideal 
world it would only be transformed when extract'ed from the array. 
There's no reason to transform it prematurely.


-Stut

--
http://stut.net/

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



Re: [PHP] Page cannot be displayed error in IE6

2007-11-05 Thread Nathan Nobbe
On 11/5/07, tanzeem <[EMAIL PROTECTED]> wrote:
>
>
> Thanks nathan, But i  cant use 'get' since the string being submitted is
> very
> big.


i guess that is an ie6 limitation, im not sure it still exists in 7.

I tried PHP headers as referred to by another website. This only
> produced  warning message: headers already sent... etc .
>

the reason for that message is because some other spot in your application
has
sent output to the browser.  if you want to use the header() function,
typically
you will need to invoke it prior to any other output from your script.

-nathan


Re: [PHP] Looking for ways to prevent timeout

2007-11-05 Thread Daniel Brown
On 11/5/07, Jochem Maas <[EMAIL PROTECTED]> wrote:
> Jon Westcot wrote:
> > Hi Jochem:
> >
> > Thanks for the suggestion.  Not to sound more dense than I already seem,
> > but how do I do this?
>
> by calling the function somewhere near the top of your script?
>
> ignore_user_abort();
>
> How do I tell the browser that something is still
> > running?  I'm issuing a flush() after every 1000 records along with echoing
> > a textual status update.  Should I do it more frequently, say every 100
> > records?
>
> I have never trusted that method of keeping the browser from thinking the
> response is not forthcoming but it's better than nothing.
>
> >
> > I'm really struggling with this concept here, and I appreciate the help
> > that everyone is giving me!
>
> dont forget to read the manuAl AND the user comments on the pages relevant to
> the functions you are using to tackle the problem
>
> >
> > Jon
> >
> > - Original Message -
> > From: "Jochem Maas" <[EMAIL PROTECTED]>
> > To: "Jon Westcot" <[EMAIL PROTECTED]>
> > Cc: "PHP General" 
> > Sent: Sunday, November 04, 2007 7:28 PM
> > Subject: Re: [PHP] Looking for ways to prevent timeout
> >
> >
> >> Jon Westcot wrote:
> >>> Hi all:
> >>>
> >>> I'm hoping to find a solution to the problem I'm having with my
> > script timing out while inserting records into a table.
> >>> Overall, the process is pretty fast, which is impressive, but when
> > it gets to the 22,000 to 23,000 record mark, it seems to time out.  I've had
> > it get up over 26,000 so far, but nothing better than that.  And I only need
> > to process around 30,000 right now.
> >>> I've tried setting max_execution_time to 1800; no improvement.  The
> > value for max_input_time is -1, which, if I understood it correcctly, is the
> > same as saying no limit.  And I've tried calling set_time_limit() with both
> > 0 and with 360, none of which seemed to help.
> >>> Is there ANY WAY to increase the amount of time I can use when
> > running a script that will work?  I've tried everything I can find in the
> > PHP manual.
> >>> Any help you can provide will be greatly appreciated!
> >> http://php.net/ignore_user_abort will help, but nothing will stop you
> > hitting a max execution time.
> >> but my guess is your not hitting the max but rather the browser is killing
> > the connection because it's
> >> had no response fom your script and as a result apache is killing your
> > script as it thinks it's no longer
> >> needed (i.e. the browser no longer wants the response).
> >>
> >>> Jon
> >>>
> >>
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Does it absolutely need to be run via the browser?  Can it be run
from the CLI instead?  Maybe even something like this:

# PART 1 #
 0 && $i < count($arr)) {
$str .= ",";
}
$str .= $arr[$i];
}
return $str;
}

// This would have to be in an exact order if you
// want to name these variables in the next script.
exec('`which php` cli_from_web2.php '.$today.' '.arr2str($fruit),$ret);
?>


# PART 2 #



-- 
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

Give a man a fish, he'll eat for a day.  Then you'll find out he was
allergic and is hospitalized.  See?  No good deed goes unpunished

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



Re: [PHP] How to replace define in a require file with mysql?

2007-11-05 Thread Jim Lucas

Ronald Wiplinger wrote:

Jim Lucas wrote:

Ronald Wiplinger wrote:

I have a file linked with require into my program with statements like:

define("_ADDRESS","Address");
define("_CITY","City");

I would like to replace this with a mysql table with these two fields
(out of many other fields).

How can I do that?

bye

Ronald


Well, if you have all the settings in a DB already, then what I would
do is this.

SELECT param_name, param_value FROM yourTable;

then

while ( list($name, $value) = mysql_fetch_row($results_handler) ) {
define($name, $value);
}

put this in place of your existing defines and you should be good.



Thanks! Works fine!
I need now a modification for that.

Two values:
SELECT param_name, param_value1, param_value2 FROM yourTable;

IF param_value1 is empty, than it should use param_value2

How can I add this?

Thank you again.

bye

Ronald

In PHP i would do it like this.

while ( list($name, $value1, $value2) = mysql_fetch_row($results_handler) ) {
define($name, ( empty($value1) ? $value2 : $value ) );
}


--
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] mysql_fetch_array

2007-11-05 Thread Philip Thompson
On 11/3/07, Eduardo Vizcarra <[EMAIL PROTECTED]> wrote:
>
> Hi guys
>
> After doing some changes, I believe it is partially working, what I did is
> the following:
>   while($row=mysql_fetch_array($fotos))
>   {
>$fotos_mostrar[] = $row;
>   }
>   $primer_foto = reset($fotos_mostrar[0]); // This is to set the pointer
> to
> the first record
> echo $primer_foto; // This displays the first column when doing a SELECT
>
> However, my SELECT statement retrieves 2 columns from one table, how do I
> display the second column ?
>
> Thanks
> Eduardo



Since you're pulling 2 columns, why don't you use MYSQL_ASSOC option?
Example...

[code]
$query = "SELECT column1, column2 FROM table WHERE (...)";
...
while ($row = mysql_fetch_array ($fotos, MYSQL_ASSOC)) {
$fotos_mostrar['col1'][] = $row['column1'];
$fotos_mostrar['col2'][] = $row['column2'];
}
...
// To view the contents of what you just created
echo "";
print_r ($fotos_mostrar);
echo "";
[/code]

By doing it this way, you know exactly what you're storing and where.
Hopefully I didn't muddy things up! ;-)

~Philip


Re: [PHP] Looking for ways to prevent timeout

2007-11-05 Thread Jochem Maas
Nathan Nobbe wrote:
> On 11/5/07, Jon Westcot <[EMAIL PROTECTED]> wrote:
>> Hi Nathan:
>>
>> No, I'm not familiar with Ajax.  Where can I read up on it?  More
>> important, how can I find out if Ajax is implemented on the server?  Or is
>> it something I can add myself?
>>
> 

although it might sound cool - using ajax to issue multiple requests is NOT the
correct solution. your merely moving the goalposts (what happens when user 
moves off the
page just as the third ajax request is made?)

your looking to run a series of inserts whilst garanteeing that they are not 
interrupted.

Dan Brown (the nice guy on this list, not the twat that wrote the 'daVinci 
Code') suggests
a *much* better way to go- namely using a CLI script. the fun part is getting a 
button
push on an admin page to somehow initiate the CLI script.

one way of doing this could be to have a 'job' table in your database to which 
'jobs'
are inserted (e.g. 'do my 3 record import') and that your [CLI] script 
checks the
database to see if it should start a 'job' and just exit if it does not need to 
do so
... lastly in order to have the [CLI] script regularly check if it needs to do 
something you
can use cron to schedule that the script runs at regular intervals (e.g. every 
15 minutes)

many ways to skin this cat - my guess is all the decent ways of doing it will 
involve a
CLI script probably in conjunction with a cronjob.

> 
> if you arent familiar w/ ajax, no worries; the main concept in my suggestion
> is
> sending a number of requests rather than a single request.  that way you can
> execute a fraction of the queries on each request.  this will ensure that
> you  dont
> hit the maximum execution time.
> 
> a purely php approach would be using the header() function.  so, on each
> request
> where the queries are not yet complete, your script sends a header tag to
> the browser
> which will immediately invoke another request back on the same script.
> once all the queries have been executed dont invoke the header() function,
> that would
> essentially be the results page.
> the reason i prefer ajax over this approach is that the page will be
> blanking out a lot,
> basically on every request.  but it would defiantly work.
> 
> also, ajax is mainly a client side technology; where http requests are sent
> to the
> server without incurring a ful page refresh.  you need nothing extra on the
> server.
> ive been using prototype, a javascript toolkit which has some nice support
> for ajax.
> if you want to  check it out, heres an article on ajax using prototype:
> http://www.prototypejs.org/learn/introduction-to-ajax
> 
> -nathan
> 

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



Re: [PHP] Problem with input name, how can i use . (dot) in a name of a input type text?

2007-11-05 Thread Jochem Maas
Jônata Tyska Carvalho wrote:
> Well if i cant, i cant! But dont say i dont need

why not?

>  Im working with a
> framework that works in that way. Need to put the name of the column of

please name the framework - I like to know what to avoid :-)

> my database like the name of the input. And i CANNOT alter the source
> code of framework.

why not?

 Thanks for your time anyway.

you could use the auto_prepend_file to unbork the $_POST array prior to
this application running - you can set the auto_prepend_file directive in
the relevant webserver config.

with regard to things not to do, don't f'ing reply off-list (unless asked),
etiquette asks that you keep the conversation on the mailing list. if you
wAnt to call me an ass because you don't like the way I tried to help that's 
fine
but please do it in public :-)

> 
> On Nov 5, 2007 1:44 PM, Jochem Maas <[EMAIL PROTECTED]
> > wrote:
> 
> Jônata Tyska Carvalho wrote:
> > then, there is no way to do it works??? i just wanna use a name of
> input
> > like table.name  < http://table.name>, if i to
> need to write another
> > solution i know how to do it, but right now i need to use the name in
> > that way. =/
> 
> NO YOU DON'T - you need to work around the problem and make your
> code work.
> you may want 'table.name ' but alas you can't
> have it. so use some super simple
> character substitution in order to work around. easy enough if
> rather annoying.
> 
> then again unless your developing something likwe phpmyadmin or a
> custom report generation tool, then you probably shouldn't be
> [needing to]
> placing table names anywhere in output that goes to the browser ..
> it just doesn't
> seem right or necessary ... that said you may have a perfectly sound
> reason :-)
> 
> >
> > On Nov 5, 2007 11:22 AM, Jochem Maas <[EMAIL PROTECTED]
> 
> > >> wrote:
> >
> > Stut wrote:
> > > Jônata Tyska Carvalho wrote:
> > >> Im having a big problem because the name of one input type
> text
> > that is '
> > >> table.name  ' in my
> html, becomes 'table_name'
> > in php, it is a kind of
> > >> bug??
> > >> =S
> > >>
> > >> 
> > >> http://table.name>
> ">
> > >> 
> > >>
> > >> in PHP we have:
> > >>
> > >> $_POST["table_name"] instead of $_POST[" table.name
> 
> > < http://table.name>"]
> > >>
> > >> someone knows some way to put this to work?? i wanna send
> > 'table.name  '
> > >> and
> > >> receive in php ' table.name  <
> http://table.name>'!
> > >
> > > I don't know for certain but that's likely happening because a
> > period is
> > > not valid in a PHP variable name. One alternative would be
> to use
> > > table[name] instead. This will lead to $_POST['table']['name'].
> >
> > I think Stut is correct - the period is a concatenation operator.
> > also there are plenty of alertnatives to the Stuts suggested
> > 'table[name]' naming approach.
> >
> > that said given the following code:
> >
> >$f = "my.bad";
> >$$f = "MY BAD";
> >echo $f, "\n", $$f, "\n";
> >
> > ... I personally feel that the $_POST should just contain
> > 'table.name   >' - which is not an illegal array key
> > - most likely the reason it is (the var name)
> > transformed is due to BC, namely with register_globals set to
> ON php
> > is required to automatically
> > create a variable $table.name (which is not legal).
> >
> > >
> > > -Stut
> > >
> >
> >
> >
> >
> > --
> > Jônata Tyska Carvalho
> > -
> > -- Técnico em Informática pelo Colégio Técnico Industrial (CTI)
> > -- Graduando em Engenharia de Computação
> > Fundação Universidade Federal de Rio Grande (FURG)
> 
> 
> 
> 
> -- 
> Jônata Tyska Carvalho
> -
> -- Técnico em Informática pelo Colégio Técnico Industrial (CTI)
> -- Graduando em Engenharia de Computação
> Fundação Universidade Federal de Rio Grande (FURG)

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



[PHP] Strange warning: preg_match compilation warning

2007-11-05 Thread Paul Scott

Does anyone have any idea as to why the following line is generating a
warning?

} else if (preg_match('/^([0-9]{4})-([0-9]{4})? (AVOIR \)$/', $content)
=== 0) {

The warning text is as follows:

Warning: preg_match(): Compilation failed: missing ) at offset 34 in ...

Offset 34 seems to be the opening parenthesis of the preg_match function
call...(??)

Any help would be appreciated, googling simply brings up a load of
busted websites...

--Paul
-- 
Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html

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] Strange warning: preg_match compilation warning

2007-11-05 Thread Daniel Brown
On 11/5/07, Paul Scott <[EMAIL PROTECTED]> wrote:
>
> Does anyone have any idea as to why the following line is generating a
> warning?
>
> } else if (preg_match('/^([0-9]{4})-([0-9]{4})? (AVOIR \)$/', $content)
> === 0) {
>
> The warning text is as follows:
>
> Warning: preg_match(): Compilation failed: missing ) at offset 34 in ...
>
> Offset 34 seems to be the opening parenthesis of the preg_match function
> call...(??)
>
> Any help would be appreciated, googling simply brings up a load of
> busted websites...
>
> --Paul
> --
> Please avoid sending me Word or PowerPoint attachments.
> See http://www.gnu.org/philosophy/no-word-attachments.html
>
>
> 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
>

You canceled-out the final closing param with a backslash here:
(AVOIR \)

-- 
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

Give a man a fish, he'll eat for a day.  Then you'll find out he was
allergic and is hospitalized.  See?  No good deed goes unpunished

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



Re: [PHP] Problem with input name, how can i use . (dot) in a name of a input type text?

2007-11-05 Thread Jônata Tyska Carvalho
with regard to things not to do, don't f'ing reply off-list (unless asked),
etiquette asks that you keep the conversation on the mailing list. if you
wAnt to call me an ass because you don't like the way I tried to help that's
fine
but please do it in public :-)

sorry but i thought when im hitting the reply button it was replying to the
list not for the last user that replied it. reply all is the right button to
hit.


On Nov 5, 2007 2:01 PM, Jochem Maas <[EMAIL PROTECTED]> wrote:

> Jônata Tyska Carvalho wrote:
> > Well if i cant, i cant! But dont say i dont need
>
> why not?
>
> >  Im working with a
> > framework that works in that way. Need to put the name of the column of
>
> please name the framework - I like to know what to avoid :-)
>
> > my database like the name of the input. And i CANNOT alter the source
> > code of framework.
>
> why not?
>
>  Thanks for your time anyway.
>
> you could use the auto_prepend_file to unbork the $_POST array prior to
> this application running - you can set the auto_prepend_file directive in
> the relevant webserver config.
>
> with regard to things not to do, don't f'ing reply off-list (unless
> asked),
> etiquette asks that you keep the conversation on the mailing list. if you
> wAnt to call me an ass because you don't like the way I tried to help
> that's fine
> but please do it in public :-)
>
> >
> > On Nov 5, 2007 1:44 PM, Jochem Maas <[EMAIL PROTECTED]
> > > wrote:
> >
> > Jônata Tyska Carvalho wrote:
> > > then, there is no way to do it works??? i just wanna use a name of
> > input
> > > like table.name  < http://table.name>, if i to
> > need to write another
> > > solution i know how to do it, but right now i need to use the name
> in
> > > that way. =/
> >
> > NO YOU DON'T - you need to work around the problem and make your
> > code work.
> > you may want 'table.name ' but alas you can't
> > have it. so use some super simple
> > character substitution in order to work around. easy enough if
> > rather annoying.
> >
> > then again unless your developing something likwe phpmyadmin or a
> > custom report generation tool, then you probably shouldn't be
> > [needing to]
> > placing table names anywhere in output that goes to the browser ..
> > it just doesn't
> > seem right or necessary ... that said you may have a perfectly sound
> > reason :-)
> >
> > >
> > > On Nov 5, 2007 11:22 AM, Jochem Maas <[EMAIL PROTECTED]
> > 
> > > >>
> wrote:
> > >
> > > Stut wrote:
> > > > Jônata Tyska Carvalho wrote:
> > > >> Im having a big problem because the name of one input type
> > text
> > > that is '
> > > >> table.name  ' in my
> > html, becomes 'table_name'
> > > in php, it is a kind of
> > > >> bug??
> > > >> =S
> > > >>
> > > >> 
> > > >> http://table.name>
> > ">
> > > >> 
> > > >>
> > > >> in PHP we have:
> > > >>
> > > >> $_POST["table_name"] instead of $_POST[" table.name
> > 
> > > < http://table.name>"]
> > > >>
> > > >> someone knows some way to put this to work?? i wanna send
> > > 'table.name  '
> > > >> and
> > > >> receive in php ' table.name  <
> > http://table.name>'!
> > > >
> > > > I don't know for certain but that's likely happening because
> a
> > > period is
> > > > not valid in a PHP variable name. One alternative would be
> > to use
> > > > table[name] instead. This will lead to
> $_POST['table']['name'].
> > >
> > > I think Stut is correct - the period is a concatenation
> operator.
> > > also there are plenty of alertnatives to the Stuts suggested
> > > 'table[name]' naming approach.
> > >
> > > that said given the following code:
> > >
> > >$f = "my.bad";
> > >$$f = "MY BAD";
> > >echo $f, "\n", $$f, "\n";
> > >
> > > ... I personally feel that the $_POST should just contain
> > > 'table.name   > >' - which is not an illegal array key
> > > - most likely the reason it is (the var name)
> > > transformed is due to BC, namely with register_globals set to
> > ON php
> > > is required to automatically
> > > create a variable $table.name (which is not legal).
> > >
> > > >
> > > > -Stut
> > > >
> > >
> > >
> > >
> > >
> > > --
> > > Jônata Tyska Carvalho
> > > -

Re: [PHP] Strange warning: preg_match compilation warning

2007-11-05 Thread Paul Scott


On Mon, 2007-11-05 at 12:08 -0500, Daniel Brown wrote:
> You canceled-out the final closing param with a backslash here:
> (AVOIR \)
> 

Oh geez, thanks! How embarrassing... I suppose that's what you get for
coding on long haul flights...

Thanks!

--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] what is better way to write the query

2007-11-05 Thread Shafiq Rehman
Hi,

If possible, write your inserts queries in a text file and use LOAD DATA for
bulk inserts.

-- 
Keep Smiling
Shafiq Rehman (ZCE)
http://www.phpgurru.com | http://shafiq.pk
Cell: +92 300 423 9385

On 11/2/07, Andrew Ballard <[EMAIL PROTECTED]> wrote:
>
> On Nov 2, 2007 10:41 AM, afan pasalic <[EMAIL PROTECTED]> wrote:
> > ...is there any suggestion for the process of inserting up to 5K records
> at
> > the time ...
>
> Is it possible to save your data to a text file and then use one of
> MySQL's built-in import queries? (I know in some situations it isn't
> an option because the PHP server and the MySQL server are not able to
> read from a common location.)
>
> Andrew
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Keep Smiling
Shafiq Rehman (ZCE)
http://www.phpgurru.com | http://shafiq.pk
Cell: +92 300 423 9385


Re: [PHP] Looking for ways to prevent timeout

2007-11-05 Thread Nathan Nobbe
On 11/5/07, Jochem Maas <[EMAIL PROTECTED]> wrote:
>
> Nathan Nobbe wrote:
> > On 11/5/07, Jon Westcot <[EMAIL PROTECTED]> wrote:
> >> Hi Nathan:
> >>
> >> No, I'm not familiar with Ajax.  Where can I read up on it?  More
> >> important, how can I find out if Ajax is implemented on the server?  Or
> is
> >> it something I can add myself?
> >>
> >
>
> although it might sound cool - using ajax to issue multiple requests is
> NOT the
> correct solution.


correct implies there is only a single solution to the problem.  i certainly
did not suggest it
because it *sounds* cool.  the reason i suggested it, is because it is the
best solution
to receive feedback on the user interface while the queries are run.

your merely moving the goalposts (what happens when user moves off the
> page just as the third ajax request is made?)


well, if you wanted to support that scenario, a resume feature would be
pretty easy to
implement.

your looking to run a series of inserts whilst garanteeing that they are not
> interrupted.


i dont recall seeing that requirement.

Dan Brown (the nice guy on this list, not the twat that wrote the 'daVinci
> Code') suggests
> a *much* better way to go- namely using a CLI script.


an *alternative* solution, with the trade-off that notification via the u.i.
is not an option.

the fun part is getting a button
> push on an admin page to somehow initiate the CLI script.


that is nice.  its also nice that the solution i suggested provides the same
sort of button and
updated feedback on the u.i.

using a cli script is a great solution, however the only sort of
notification mechanism is one
that is sent after the queries have finished, via an email most likely.

yes, there are many ways to skin the cat; evaluate them based on the
requirements and the
constraints and choose the best one for the problem.

-nathan


[PHP] Mail function doesn't work

2007-11-05 Thread Alberto García Gómez
What could happen that my mail function isn't working. I check twice my php.ini 
conf and it's fine. I test sendmail manually and it's OK. I also try to send 
mails with sendmail stoped and started and nothing happen

Este correo ha sido enviado desde el Politécnico de Informática "Carlos Marx" 
de Matanzas.
"La gran batalla se librará en el campo de las ideas"


[PHP] More info on timeout problem

2007-11-05 Thread Jon Westcot
Hi all:

First, thanks for the multiple suggestions.  I'm pretty new at PHP 
programming, so all suggestions are great learning opportunities.

Now, some observations: I've tried placing the "ignore_user_abort(TRUE);" 
in the code.  It seems to have made little, if any, impact -- the page still 
appears to time out.  I've also tried placing "set_time_limit(0);" both before 
and after the "ignore_user_abort(TRUE);" call.  Still no improvement.

I'm now wondering if some error is occurring that, for some reason, is 
silently ending the routine.  I'm building what may be a very long SQL INSERT 
statement for each line in the CSV file that I'm reading; could I be hitting 
some upper limit for the length of the SQL code?  I'd think that an error would 
be presented in this case, but maybe I have to do something explicitly to force 
all errors to display?  Even warnings?

Another thing I've noticed is that the "timeout" (I'm not even certain the 
problem IS a timeout any longer, hence the quotation marks) doesn't happen at 
the same record every time.  That's why I thought it was a timeout problem at 
first, and assumed that the varying load on the server would account for the 
different record numbers processed.  If I were hitting some problem with the 
SQL statement, I'd expect it to stop at the same record every time.  Or is that 
misguided thinking, too?

More info: I've activated a session (have to be logged into the application 
to update the data), so is it possible that something with the session module 
could be causing the problem?  I have adjusted the session.gc_maxlifetime value 
(per an example I saw in the PHP manual comments elsewhere), but is there some 
other value I should adjust, too?

Thanks for all of your continued help and assistance!  And please don't 
argue over "best" ways to solve my problem -- ALL suggestions are welcome!  
(Even if I don't know thing one about CLI or even how to access it. )

Jon


[PHP] Can I make a process run in background?

2007-11-05 Thread Luca Paolella

Hi,

Before I start explaining my problem I'd like to say one thing: I'm  
aware that php isn't the best-suited language for what I'm trying to  
do (an IRC bot), but unfortunately by now it's the only way I have  
for various reasons;


I want the bot to run a process in background (a periodic message,  
for example) while listening for events (like a user joining a  
channel or using a certain command) and consequentially executing the  
corresponding functions, is it possible? and how?


if it can be of any help, I'm using a (pretty old) PEAR library of  
irc functions named Net_SmartIRC


Thanks,
 Luca

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



RE: [PHP] Mail function doesn't work

2007-11-05 Thread Jay Blanchard
[snip]
What could happen that my mail function isn't working. I check twice my php.ini 
conf and it's fine. I test sendmail manually and it's OK. I also try to send 
mails with sendmail stoped and started and nothing happen
[/snip]

Can we see your code?

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



Re: [PHP] Looking for ways to prevent timeout

2007-11-05 Thread Satyam
- Original Message - 
From: "Jochem Maas" <[EMAIL PROTECTED]>


Dan Brown (the nice guy on this list, not the twat that wrote the 'daVinci 
Code') suggests
a *much* better way to go- namely using a CLI script. the fun part is 
getting a button

push on an admin page to somehow initiate the CLI script.

one way of doing this could be to have a 'job' table in your database to 
which 'jobs'
are inserted (e.g. 'do my 3 record import') and that your [CLI] script 
checks the
database to see if it should start a 'job' and just exit if it does not 
need to do so
... lastly in order to have the [CLI] script regularly check if it needs 
to do something you
can use cron to schedule that the script runs at regular intervals (e.g. 
every 15 minutes)


many ways to skin this cat - my guess is all the decent ways of doing it 
will involve a

CLI script probably in conjunction with a cronjob.



if you arent familiar w/ ajax, no worries; the main concept in my 
suggestion

is
sending a number of requests rather than a single request.  that way you 
can

execute a fraction of the queries on each request.  this will ensure that
you  dont
hit the maximum execution time.



Just to comment an alternative on how to break the job. It is just something 
that happened to me once and might be useful.


My particular job could be naturally broken in several stages. Actually, it 
had to.  Though it could be solved with a huge complex SQL query with 
several joins and subqueries (which were not available), it could also be 
perfomed with the help of a few intermediate auxiliary tables.  So I had a 
query (which would have been the sub-query) inserting records into a flat 
table with no indexes.  On a second step I added the index, then there was 
another join in between this auxiliary table and another table (and this one 
was pretty complex and at that time, with no stored procedures, it required 
some processing with PHP) and the final step that produced the result.  At 
that time, before AJAX was popular, I showed the progress on an iframe on 
which I changed the "src" attribute for each successive step (poor man's 
AJAX), but it could also be done via AJAX or reloading the whole page 
instead of an iframe within it.


Some time later I tried to redo one other such process into a single query 
with subqueries and I found that using the auxiliary tables was faster.  I 
admit that my attempt was half-hearted, I wanted to either see a big 
improvement or ignore the whole business.  The improvement wasn't that big 
so I dropped it and assumed the other processes would not show any big 
improvement either.  After all, I knew the data and optimized it as much as 
possible so I can't assume the SQL optimizer could do much better than I 
had.


Satyam

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



Re: [PHP] Can I make a process run in background?

2007-11-05 Thread Paul Scott


On Mon, 2007-11-05 at 19:20 +0100, Luca Paolella wrote:

> I want the bot to run a process in background (a periodic message,  
> for example) while listening for events (like a user joining a  
> channel or using a certain command) and consequentially executing the  
> corresponding functions, is it possible? and how?
> 

You could try this archaic code I wrote a few years back:

http://www.phpclasses.org/browse/package/2837.html

or search for PHP Daemon and get some ideas there.

--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] Mail function doesn't work

2007-11-05 Thread Per Jessen
Alberto García Gómez wrote:

> What could happen that my mail function isn't working. I check twice
> my php.ini conf and it's fine. I test sendmail manually and it's OK. I
> also try to send mails with sendmail stoped and started and nothing
> happen

Does your mail-server otherwise work?  


/Per Jessen, Zürich

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



RE: [PHP] More info on timeout problem

2007-11-05 Thread Instruct ICC

> I'm now wondering if some error is occurring that, for some reason, is 
> silently ending the routine.  I'm building what may be a very long SQL INSERT 
> statement for each line in the CSV file that I'm reading; could I be hitting 
> some upper limit for the length of the SQL code?  I'd think that an error 
> would be presented in this case, but maybe I have to do something explicitly 
> to force all errors to display?  Even warnings?
> 
> Another thing I've noticed is that the "timeout" (I'm not even certain 
> the problem IS a timeout any longer, hence the quotation marks) doesn't 
> happen at the same record every time.  That's why I thought it was a timeout 
> problem at first, and assumed that the varying load on the server would 
> account for the different record numbers processed.  If I were hitting some 
> problem with the SQL statement, I'd expect it to stop at the same record 
> every time.  Or is that misguided thinking, too?

1) When you say, "doesn't happen at the same record every time" are you using 
the same dataset and speaking about the same line number?  Or are you using 
different datasets and noticing that the line number varies?  If it's the same 
dataset, it sounds like "fun" -- as in "a pain in the assets".

2) I'm writing something similar; letting a user upload a CSV file via a 
webpage, then creating an SQL query with many records.  So now I'll be watching 
your thread.  For debugging purposes, create your SQL statement and print it 
out on the webpage (or save it somewhere -- maybe a file).  Don't have your 
webpage script execute the query.  Then see if you get the complete query you 
expect.  Then copy that query into a database tool like phpmyadmin and see if 
you get errors when executing the query.

_
Peek-a-boo FREE Tricks & Treats for You!
http://www.reallivemoms.com?ocid=TXT_TAGHM&loc=us

Re: [PHP] Mail function doesn't work

2007-11-05 Thread Jim Lucas

Alberto García Gómez wrote:

What could happen that my mail function isn't working. I check twice my php.ini 
conf and it's fine. I test sendmail manually and it's OK. I also try to send 
mails with sendmail stoped and started and nothing happen

Este correo ha sido enviado desde el Politécnico de Informática "Carlos Marx" 
de Matanzas.
"La gran batalla se librará en el campo de las ideas"


is your apache process chroot'ed ?

Can PHP see the sendmail binary?

--
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] More info on timeout problem

2007-11-05 Thread Jon Westcot
Hi Instruct ICC:

> > I'm now wondering if some error is occurring that, for some reason,
is
> > silently ending the routine.  I'm building what may be a very long SQL
> > INSERT statement for each line in the CSV file that I'm reading; could
> > I be hitting some upper limit for the length of the SQL code?  I'd think
> > that an error would be presented in this case, but maybe I have to do
> > something explicitly to force all errors to display?  Even warnings?
> >
> > Another thing I've noticed is that the "timeout" (I'm not even
certain
> > the problem IS a timeout any longer, hence the quotation marks) doesn't
> > happen at the same record every time.  That's why I thought it was a
> > timeout problem at first, and assumed that the varying load on the
server
> > would account for the different record numbers processed.  If I were
> > hitting some problem with the SQL statement, I'd expect it to stop at
> > the same record every time.  Or is that misguided thinking, too?
>
> 1) When you say, "doesn't happen at the same record every time" are you
> using the same dataset and speaking about the same line number?  Or are
> you using different datasets and noticing that the line number varies?  If
it's
> the same dataset, it sounds like "fun" -- as in "a pain in the assets".

Yup, same dataset.  It took me forever to upload it, so I'm trying to
keep it there until I know it's been successfully loaded.  It's got about
30,000 records in it, and each one has 240 fields.

> 2) I'm writing something similar; letting a user upload a CSV file via a
> webpage, then creating an SQL query with many records.  So now I'll
> be watching your thread.  For debugging purposes, create your SQL
> statement and print it out on the webpage (or save it somewhere --
> maybe a file).  Don't have your webpage script execute the query.
> Then see if you get the complete query you expect.  Then copy that
> query into a database tool like phpmyadmin and see if you get errors
> when executing the query.

Sounds much like what I'm trying to do.  I have had to give up, for the
time being, on using PHP to upload the datafile; it's about 56 MB in size
and nothing I do seems to let me upload anything larger than a 2MB file. :(

How do I save the individual query statements to a file?  That may give
me a good option for checking a "log" of activity when the process fails
again.

Thanks for your suggestions!

Jon

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



RE: [PHP] More info on timeout problem

2007-11-05 Thread Instruct ICC

> Sounds much like what I'm trying to do. I have had to give up, for the
> time being, on using PHP to upload the datafile; it's about 56 MB in size
> and nothing I do seems to let me upload anything larger than a 2MB file. :(

I don't know if it's been mentioned in this thread, but 2M is a default setting 
for upload_max_filesize http://php.he.net/manual/en/ini.core.php
You may also need to adjust post_max_size and memory_limit.  My 
upload_max_filesize is at 5M,, post_max_size at 8M, and memory_limit is at 32M.

>From the docs:
post_max_size integer

Sets max size of post data allowed. This setting also affects file upload. To 
upload large files, this value must be larger than upload_max_filesize.

If memory limit is enabled by your configure script, memory_limit also affects 
file uploading. Generally speaking, memory_limit should be larger than 
post_max_size.

When an integer is used, the value is measured in bytes. You may also use 
shorthand notation as described in this FAQ.

If the size of post data is greater than post_max_size, the $_POST and $_FILES 
superglobals are empty. This can be tracked in various ways, e.g. by passing 
the $_GET variable to the script processing the data, i.e. , and then checking 
if $_GET['processed'] is set.


> How do I save the individual query statements to a file? That may give
> me a good option for checking a "log" of activity when the process fails
> again.


I'm assuming you are building an $sql variable, so you would write that to a 
file instead of executing it in a query.
Look at an example here http://php.he.net/manual/en/function.fwrite.php to 
write data to a file.

_
Peek-a-boo FREE Tricks & Treats for You!
http://www.reallivemoms.com?ocid=TXT_TAGHM&loc=us
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] More info on timeout problem

2007-11-05 Thread Kristen G. Thorson
-Original Message-
From: Instruct ICC [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 05, 2007 3:34 PM
To: php-general@lists.php.net
Subject: RE: [PHP] More info on timeout problem


> Sounds much like what I'm trying to do. I have had to give up, for the
> time being, on using PHP to upload the datafile; it's about 56 MB in size
> and nothing I do seems to let me upload anything larger than a 2MB file.
:(

I don't know if it's been mentioned in this thread, but 2M is a default
setting for upload_max_filesize http://php.he.net/manual/en/ini.core.php
You may also need to adjust post_max_size and memory_limit.  My
upload_max_filesize is at 5M,, post_max_size at 8M, and memory_limit is at
32M.

>From the docs:
post_max_size integer

Sets max size of post data allowed. This setting also affects file upload.
To upload large files, this value must be larger than upload_max_filesize.

If memory limit is enabled by your configure script, memory_limit also
affects file uploading. Generally speaking, memory_limit should be larger
than post_max_size.

When an integer is used, the value is measured in bytes. You may also use
shorthand notation as described in this FAQ.

If the size of post data is greater than post_max_size, the $_POST and
$_FILES superglobals are empty. This can be tracked in various ways, e.g. by
passing the $_GET variable to the script processing the data, i.e. , and
then checking if $_GET['processed'] is set.





I'm jumping in here late, so I haven't seen previous posts.  Another
possible place I have seen limiting post/upload sizes:

There is an Apache directive called LimitRequestSize or somesuch which will
take precedence (silently) over any PHP max post size you set.  I found this
set once before in an /conf.d/php.conf file that I eventually
found.

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



Re: [PHP] More info on timeout problem

2007-11-05 Thread Wolf
One thing to note, if you have not upped the max file size to be over what you 
are trying to load, the server will hang.

;;;
; Resource Limits ;
;;;

max_execution_time = 7200 ; Maximum execution time of each script, in 
seconds
max_input_time = 7200   ; Maximum amount of time each script may spend parsing 
request data
memory_limit = 2G  ; Maximum amount of memory a script may consume


; Maximum size of POST data that PHP will accept.
post_max_size = 8M  // CHANGE THIS!!

; Maximum allowed size for uploaded files.
upload_max_filesize = 2M  // CHANGE THIS!!

Also look in any php.ini files in apache's conf.d directory for files that set 
it back to these default limits

You'll notice, I have increased my max execution times, input times, and memory 
limit but not my upload sizes, but that is only due to the server I snagged it 
from not doing uploads.  I have another server which has a 879M upload limit 
and has no problems with large files getting to it.

Wolf

 Jon Westcot <[EMAIL PROTECTED]> wrote: 
> Hi Instruct ICC:
> 
> > > I'm now wondering if some error is occurring that, for some reason,
> is
> > > silently ending the routine.  I'm building what may be a very long SQL
> > > INSERT statement for each line in the CSV file that I'm reading; could
> > > I be hitting some upper limit for the length of the SQL code?  I'd think
> > > that an error would be presented in this case, but maybe I have to do
> > > something explicitly to force all errors to display?  Even warnings?
> > >
> > > Another thing I've noticed is that the "timeout" (I'm not even
> certain
> > > the problem IS a timeout any longer, hence the quotation marks) doesn't
> > > happen at the same record every time.  That's why I thought it was a
> > > timeout problem at first, and assumed that the varying load on the
> server
> > > would account for the different record numbers processed.  If I were
> > > hitting some problem with the SQL statement, I'd expect it to stop at
> > > the same record every time.  Or is that misguided thinking, too?
> >
> > 1) When you say, "doesn't happen at the same record every time" are you
> > using the same dataset and speaking about the same line number?  Or are
> > you using different datasets and noticing that the line number varies?  If
> it's
> > the same dataset, it sounds like "fun" -- as in "a pain in the assets".
> 
> Yup, same dataset.  It took me forever to upload it, so I'm trying to
> keep it there until I know it's been successfully loaded.  It's got about
> 30,000 records in it, and each one has 240 fields.
> 
> > 2) I'm writing something similar; letting a user upload a CSV file via a
> > webpage, then creating an SQL query with many records.  So now I'll
> > be watching your thread.  For debugging purposes, create your SQL
> > statement and print it out on the webpage (or save it somewhere --
> > maybe a file).  Don't have your webpage script execute the query.
> > Then see if you get the complete query you expect.  Then copy that
> > query into a database tool like phpmyadmin and see if you get errors
> > when executing the query.
> 
> Sounds much like what I'm trying to do.  I have had to give up, for the
> time being, on using PHP to upload the datafile; it's about 56 MB in size
> and nothing I do seems to let me upload anything larger than a 2MB file. :(
> 
> How do I save the individual query statements to a file?  That may give
> me a good option for checking a "log" of activity when the process fails
> again.
> 
> Thanks for your suggestions!
> 
> Jon
> 
> -- 
> 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] More info on timeout problem

2007-11-05 Thread Jon Westcot
Hi Wolf:

Thanks for the suggestion.  I've tried setting these in a php.ini file,
but that file seems to be constantly ignored, other than the fact that its
presence seems to cause every value to take on its default settings.
::sigh::  I am going to try and put the values into a .htaccess file
instead; at least I seem to have some control over that file.

I'm really starting to hate shared servers.

Jon


- Original Message -
From: "Wolf" <[EMAIL PROTECTED]>
To: "Jon Westcot" <[EMAIL PROTECTED]>
Cc: "PHP General" 
Sent: Monday, November 05, 2007 2:20 PM
Subject: Re: [PHP] More info on timeout problem


> One thing to note, if you have not upped the max file size to be over what
you are trying to load, the server will hang.
>
> ;;;
> ; Resource Limits ;
> ;;;
>
> max_execution_time = 7200 ; Maximum execution time of each script, in
seconds
> max_input_time = 7200   ; Maximum amount of time each script may spend
parsing request data
> memory_limit = 2G  ; Maximum amount of memory a script may consume
>
>
> ; Maximum size of POST data that PHP will accept.
> post_max_size = 8M  // CHANGE THIS!!
>
> ; Maximum allowed size for uploaded files.
> upload_max_filesize = 2M  // CHANGE THIS!!
>
> Also look in any php.ini files in apache's conf.d directory for files that
set it back to these default limits
>
> You'll notice, I have increased my max execution times, input times, and
memory limit but not my upload sizes, but that is only due to the server I
snagged it from not doing uploads.  I have another server which has a 879M
upload limit and has no problems with large files getting to it.
>
> Wolf
>
>  Jon Westcot <[EMAIL PROTECTED]> wrote:
> > Hi Instruct ICC:
> >
> > > > I'm now wondering if some error is occurring that, for some
reason,
> > is
> > > > silently ending the routine.  I'm building what may be a very long
SQL
> > > > INSERT statement for each line in the CSV file that I'm reading;
could
> > > > I be hitting some upper limit for the length of the SQL code?  I'd
think
> > > > that an error would be presented in this case, but maybe I have to
do
> > > > something explicitly to force all errors to display?  Even warnings?
> > > >
> > > > Another thing I've noticed is that the "timeout" (I'm not even
> > certain
> > > > the problem IS a timeout any longer, hence the quotation marks)
doesn't
> > > > happen at the same record every time.  That's why I thought it was a
> > > > timeout problem at first, and assumed that the varying load on the
> > server
> > > > would account for the different record numbers processed.  If I were
> > > > hitting some problem with the SQL statement, I'd expect it to stop
at
> > > > the same record every time.  Or is that misguided thinking, too?
> > >
> > > 1) When you say, "doesn't happen at the same record every time" are
you
> > > using the same dataset and speaking about the same line number?  Or
are
> > > you using different datasets and noticing that the line number varies?
If
> > it's
> > > the same dataset, it sounds like "fun" -- as in "a pain in the
assets".
> >
> > Yup, same dataset.  It took me forever to upload it, so I'm trying
to
> > keep it there until I know it's been successfully loaded.  It's got
about
> > 30,000 records in it, and each one has 240 fields.
> >
> > > 2) I'm writing something similar; letting a user upload a CSV file via
a
> > > webpage, then creating an SQL query with many records.  So now I'll
> > > be watching your thread.  For debugging purposes, create your SQL
> > > statement and print it out on the webpage (or save it somewhere --
> > > maybe a file).  Don't have your webpage script execute the query.
> > > Then see if you get the complete query you expect.  Then copy that
> > > query into a database tool like phpmyadmin and see if you get errors
> > > when executing the query.
> >
> > Sounds much like what I'm trying to do.  I have had to give up, for
the
> > time being, on using PHP to upload the datafile; it's about 56 MB in
size
> > and nothing I do seems to let me upload anything larger than a 2MB file.
:(
> >
> > How do I save the individual query statements to a file?  That may
give
> > me a good option for checking a "log" of activity when the process fails
> > again.
> >
> > Thanks for your suggestions!
> >
> > Jon
> >
> > --
> > 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] More info on timeout problem

2007-11-05 Thread Jon Westcot
Hi Instruct ICC:

> > How do I save the individual query statements to a file? That may give
> > me a good option for checking a "log" of activity when the process fails
> > again.
>
> I'm assuming you are building an $sql variable, so you would write that to
> a file instead of executing it in a query. Look at an example here
> http://php.he.net/manual/en/function.fwrite.php to write data to a file.

Thanks for the link; I should have guessed that fwrite() was the
command, but I'm starting to get so cross-eyed and synapse-tied here that my
thinking is really muzzy.

But get this -- I tried your suggestion and am writing the SQL query
text to a file and am not doing anything with updating the data in MySQL at
all.  And it still "times" out, in constantly random areas.

If it happened in the exact same place every time, I could live with
that, but it's not.  It's entirely random (or at least I haven't seen the
pattern yet), and that just makes me ill.

Jon

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



Re: [PHP] More info on timeout problem

2007-11-05 Thread Jon Westcot
Hi Kristen:

> I'm jumping in here late, so I haven't seen previous posts.  Another
> possible place I have seen limiting post/upload sizes:
>
> There is an Apache directive called LimitRequestSize or somesuch which
will
> take precedence (silently) over any PHP max post size you set.  I found
this
> set once before in an /conf.d/php.conf file that I eventually
> found.

I just conducted another test of my process, this time not even creating
the SQL INSERT string in the program, but just trying to read every record
from the input file and just writing a count of records to the file.  It
worked, much to my surprise and pleasure.  But then, when I put back the
code to build the string, it timed out again.

I'm starting to believe that I'm either using up some resource that
isn't being released, or that the directive you mentioned, LimitRequestSize,
is being trounced upon.  Any ideas on how to find out the value currently
set for this directive?  Or how I can override it?  Can I override it within
my own .htaccess file?

Thanks for the suggestion!

Jon

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



Re: [PHP] More info on timeout problem

2007-11-05 Thread Daniel Brown
On 11/5/07, Jon Westcot <[EMAIL PROTECTED]> wrote:
> I'm really starting to hate shared servers.

In general, keep in mind that a shared server is for low-level
activities.  If you're doing something that big, you may want to move
to a VPS, a smaller hosting company such as PilotPig.net, which might be able to set up an
environment to match your needs, but still cost about the same as a
shared hosting plan, or even a dedicated server.  In fact, if
you check out the banner at the top of the webpage for the CentOS
project, you'll see that a dedicated server runs about $49/mo.  Then
you have to add on cPanel/Plesk/Helm/whatever you want, and manage it,
but if you're comfortable with that, it's not that expensive.

-- 
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

Give a man a fish, he'll eat for a day.  Then you'll find out he was
allergic and is hospitalized.  See?  No good deed goes unpunished

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



Re: [PHP] Problem with input name, how can i use . (dot) in a name of a input type text?

2007-11-05 Thread Jochem Maas
Jônata Tyska Carvalho wrote:
> with regard to things not to do, don't f'ing reply off-list (unless asked),
> etiquette asks that you keep the conversation on the mailing list. if you
> wAnt to call me an ass because you don't like the way I tried to help that's
> fine
> but please do it in public :-)
> 
> sorry but i thought when im hitting the reply button it was replying to the
> list not for the last user that replied it. reply all is the right button to
> hit.

yeah. list idiosyncrasity I guess. sorry for being grouchy (another list
idiosyncrasity I guess).

> 
> 
> On Nov 5, 2007 2:01 PM, Jochem Maas <[EMAIL PROTECTED]> wrote:
> 
>> Jônata Tyska Carvalho wrote:
>>> Well if i cant, i cant! But dont say i dont need
>> why not?
>>
>>>  Im working with a
>>> framework that works in that way. Need to put the name of the column of
>> please name the framework - I like to know what to avoid :-)
>>
>>> my database like the name of the input. And i CANNOT alter the source
>>> code of framework.
>> why not?
>>
>>  Thanks for your time anyway.
>>
>> you could use the auto_prepend_file to unbork the $_POST array prior to
>> this application running - you can set the auto_prepend_file directive in
>> the relevant webserver config.
>>
>> with regard to things not to do, don't f'ing reply off-list (unless
>> asked),
>> etiquette asks that you keep the conversation on the mailing list. if you
>> wAnt to call me an ass because you don't like the way I tried to help
>> that's fine
>> but please do it in public :-)
>>
>>> On Nov 5, 2007 1:44 PM, Jochem Maas <[EMAIL PROTECTED]
>>> > wrote:
>>>
>>> Jônata Tyska Carvalho wrote:
>>> > then, there is no way to do it works??? i just wanna use a name of
>>> input
>>> > like table.name  < http://table.name>, if i to
>>> need to write another
>>> > solution i know how to do it, but right now i need to use the name
>> in
>>> > that way. =/
>>>
>>> NO YOU DON'T - you need to work around the problem and make your
>>> code work.
>>> you may want 'table.name ' but alas you can't
>>> have it. so use some super simple
>>> character substitution in order to work around. easy enough if
>>> rather annoying.
>>>
>>> then again unless your developing something likwe phpmyadmin or a
>>> custom report generation tool, then you probably shouldn't be
>>> [needing to]
>>> placing table names anywhere in output that goes to the browser ..
>>> it just doesn't
>>> seem right or necessary ... that said you may have a perfectly sound
>>> reason :-)
>>>
>>> >
>>> > On Nov 5, 2007 11:22 AM, Jochem Maas <[EMAIL PROTECTED]
>>> 
>>> > >>
>> wrote:
>>> >
>>> > Stut wrote:
>>> > > Jônata Tyska Carvalho wrote:
>>> > >> Im having a big problem because the name of one input type
>>> text
>>> > that is '
>>> > >> table.name  ' in my
>>> html, becomes 'table_name'
>>> > in php, it is a kind of
>>> > >> bug??
>>> > >> =S
>>> > >>
>>> > >> 
>>> > >> http://table.name>
>>> ">
>>> > >> 
>>> > >>
>>> > >> in PHP we have:
>>> > >>
>>> > >> $_POST["table_name"] instead of $_POST[" table.name
>>> 
>>> > < http://table.name>"]
>>> > >>
>>> > >> someone knows some way to put this to work?? i wanna send
>>> > 'table.name  '
>>> > >> and
>>> > >> receive in php ' table.name  <
>>> http://table.name>'!
>>> > >
>>> > > I don't know for certain but that's likely happening because
>> a
>>> > period is
>>> > > not valid in a PHP variable name. One alternative would be
>>> to use
>>> > > table[name] instead. This will lead to
>> $_POST['table']['name'].
>>> >
>>> > I think Stut is correct - the period is a concatenation
>> operator.
>>> > also there are plenty of alertnatives to the Stuts suggested
>>> > 'table[name]' naming approach.
>>> >
>>> > that said given the following code:
>>> >
>>> >$f = "my.bad";
>>> >$$f = "MY BAD";
>>> >echo $f, "\n", $$f, "\n";
>>> >
>>> > ... I personally feel that the $_POST should just contain
>>> > 'table.name  >> >' - which is not an illegal array key
>>> > - most likely the reason it is (the var name)
>>> > transformed is due to BC, namely with register_globals set to
>>> ON php
>>> > is required to automatically
>>> > create a variable $table.name (which is not legal).
>>> >

Re: [PHP] Looking for ways to prevent timeout

2007-11-05 Thread Jochem Maas
Nathan Nobbe wrote:
> On 11/5/07, Jochem Maas <[EMAIL PROTECTED]> wrote:

...

yes yes yes to all that, except for one thing. Im personally of
the opinion such 'import' operation should involve no human interaction
and garanteed to complete (e.g. auto resume), save for possibly
initializing a process. the way I see it you what to try to garantee the
import will be atomic in such cases.

there is nothing to stop you having a fancy UI that polls the server
to check the job table (as exampled earlier in this thread) for the status
of a job (and subsequently, possibly retrieve some processed output).

the two processes ('init & 'review and 'run job') should be independent, any
form of control (e.g. a cancellation) should happen via some sort of IPC
mechanism and should be optional apart from possibly initialization (depending
on business requirements). successful import completion should not have to
rely on the user having to press 'continue' or even stay on the page or anything
of that nature.

also consider that with regard to such tasks it's not efficient to
have some one staring at a progress bar. and annoying, after a few seconds,
for the user, regardless of how pretty.

> 
> -nathan
> 

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



Re: [PHP] More info on timeout problem

2007-11-05 Thread Jochem Maas
Jon Westcot wrote:
> Hi all:

just show us the code.

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



Re: [PHP] Close a session knowing it's ID (not the current session)

2007-11-05 Thread Jochem Maas
Richard Heyes wrote:
>  unlink('/tmp/sess_' . session_id());

unlink(session_save_path().'/'.session_id()); // no?

> ?>
> 
> You'll need to know the session_id of the session you want to close. The
> code above closes/ends the current users session, but simply substitute
> the desired session id (of course you'll need to know this in advance)
> for the call to session_id().
> 

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



[PHP] Installing php_pgsql.dll to Apache - this is unreal

2007-11-05 Thread Martin Zvarík

Hi,
  I am trying now for almost 2 hours to get this working:

I had Apache and PHP with modules installed as CGI (also tryed as module).
Now I added extension (in php.ini) php_pgsql.dll and also installed 
postgreSQL.


And it shows me error when starting apache: "module could not be found".

The path is 100% ok, I also tryed 3 different php_pgsql.dll and one 
shown different error dialog with that i need to change some settings in 
postgre (but that was probably caused because that DLL file was for PHP 
4, and I have PHP 5 - the newest version).


Please help!
Maritn

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



[PHP] gzuncompress() Not Working.

2007-11-05 Thread Casey


Hello, list!

I'm trying to translate some code from Python to PHP so it will work  
on my server.


The Python code is:
x = zlib.decompressobj()
x.decompress(blah) # blah is a 100KB string

When I try gzuncompress() on the same data (I checked), it returns a  
"Data error". I also tried gzinflate() and many user-created gzdecode 
() functions, with no luck.


After many hours of Googling and test scripts, I have found little  
information.


I think the problem could be a memory problem. When I try to  
decompress a shorter string, it works perfectly.


The data fed to the decompression function is the same and therefore  
should be valid.


When I looked at the user comments for gzuncompress(), it says that it  
might not decompress some zlib data.


Any ideas to how to fix this problem?

Thanks,
Casey

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



[PHP] More info on timeout problem, with code

2007-11-05 Thread Jon Westcot
Hi all:

As requested, here's the code:

Session.gc_maxlifetime: " . ini_get("session.gc_maxlifetime") .
"\n";  // shows 1800
echo "Max execution time: " . ini_get("max_execution_time") .
"\n";  // shows 1800
echo "Max input time: " . ini_get("max_input_time") . "\n";
// shows -1

ignore_user_abort(TRUE);
set_time_limit(0);

$query = mysql_query("TRUNCATE evall;");

echo "Results of Truncate: $query\n";

$myfile_replace = "uploads/evall.csv";
$handle = @fopen($myfile_replace, 'rb');
$save_handle = @fopen("tmp/sql_calls.txt", "wb");

$process_count = 0;
if(!$handle) {
echo "The file ($myfile_replace) could not be opened.\n";
flush();
} else {
echo "The file ($myfile_replace) opened correctly.\n";
flush();

$headings = fgetcsv($handle, 1, ",");  // Just ignore the first
row returned.
$row = 0;
while (($data = fgetcsv($handle, 1, ",")) !== FALSE) {
$row++;
$num = count($data);
$insert_query = "INSERT INTO evall VALUES(";
for ($c=0; $c < $num; $c++) {
if($c > 0) {
$insert_query .= ",";
}
$insert_query .= '"' . $data[$c] . '"';
}
$insert_query .= ");";

if(fwrite($save_handle, $row . "; " . strlen($insert_query) . ":
" . "\n") === FALSE) {
echo "The query could not be written.\n";
} else {
$process_count++;
}
if($row % 1000 == 0) {
echo "$row records processed so far\n";
flush();
}
}
echo "File import completed. $row records read; $process_count
records added.\n";
flush();
fclose($save_handle);
fclose($handle);
}

ini_set("session.gc_maxlifetime",$old_session_gc_maxlifetime);
ini_set("max_execution_time",$old_max_execution_time);
ini_set("max_input_time",$old_max_input_time);

}
?>

Version 1.9 -- The file uploading process presupposes that the user
has uploaded the EVAll.CSV
file to the "uploads" folder. If this has been done and you're
ready to process
it, click the  button.
  


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



[PHP] Chinese input character count

2007-11-05 Thread Ronald Wiplinger
I thought I did it correct to define in the header:

to display chinese characters correct. It works.

However, if you type in a form directly, than each character will be
translated to UTF-8 with a sequence of #; 
I could then count the numbers of # and had the amount of Chinese
characters.

Now I found that there are other Chinese characters in my database,
which I cannot read, but on the web they are displayed correct Chinesse.

How can I count these Chinese characters?

bye

Ronald

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



[PHP] Memory Allocation Error

2007-11-05 Thread heavyccasey
Hi!

I have a script that reads a 120 MB remote file. This raises a Memory
Allocation Error unless I use:
 ini_set('memory_limit', '130M');

I doubt this is good for my server... I tried both fopen and
file_get_contents. This used to work fine in PHP 4 until I upgraded to
PHP 5.

Any ideas?

Thanks.

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