Re: [PHP] Connection Handling - unreliable at best?

2011-02-20 Thread James Green
Hm.

Commented out the line  re-tested. Absolutely no change whatsoever :(
Even made it false.

I'm really hoping I've been an idiot on this one. Makes no sense
otherwise but this is where I am.

Hope to hear further suggestions.

James

On 20 February 2011 03:05, Daniel Brown danbr...@php.net wrote:
 On Fri, Feb 18, 2011 at 10:21, James Green james.mk.gr...@gmail.com wrote:
 Been reading through
 http://uk.php.net/manual/en/features.connection-handling.php and
 trying to implement a solution using it. So far the documented
 behaviour rarely occurs.

 This code is a minimal test case: http://codepad.org/GqNlcWiM

 I run this behind Apache 2.2 with PHP 5.3 on Linux. The in-line
 comments explain the problem. I load in the browser and hit stop
 pretty much immediately but PHP does not get signalled that the user
 has aborted and continues.

 From memory of having to restart apache after hitting long-running
 scripts in the past, I don't ever believe I've had a script terminate
 on a user abort. And I've never switched the behaviour from default.

 I read several people explain this behaviour would only ever work in
 writing back to the client and to flush the buffer, which is included
 in the test case. I've also removed any compression from within
 Apache.

 Can anyone explain what I've seeing? I've tried this using Lighttpd/Windows 
 too.

    Look at line #4.  You're telling PHP that you don't give a damn if
 someone tries to quit, you're going to continue anyway.  You storm
 trooper, you.

    If PHP is instructed to ignore the user's (futile) attempts to
 abort, why should it try to gentlemanly and politely respect a
 shutdown function?  Essentially, you're damning it to zombiehood.

 --
 /Daniel P. Brown
 Network Infrastructure Manager
 Documentation, Webmaster Teams
 http://www.php.net/


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



Re: [PHP] Protocol on handling empty checkbox values

2002-08-16 Thread James Green

On Fri, 2002-08-16 at 19:24, David Yee wrote:
 Hi all.  For a universal form script I'm writing I want to store a 'Y' in a
 table field if a checkbox is checked and an 'N' if it's not.  The problem is
 that when the form is posted if the checkbox is not checked the checkbox
 variable is not passed.  E.g.
 
 form method=POST action=submit.php
 input type=checkbox name=my_checkbox_var value=Y
 /form
 
 If the checkbox is checked, I get $_POST['my_checkbox_var'] == 'Y', but if
 not $_POST['my_checkbox_var'] is not even set.  So what I've been doing is
 putting the variable names of the checkbox fields into an array, serializing
 it, and then pass the string as a hidden input on the form.  Then in the
 page that handles the POST I unserialize the array to determine if checkbox
 fields were passed and then handle accordingly.  But I'm wondering is there
 a better way (or at least a standard way) of doing this?

I'll assume here that you're dynamically building the table and thus the
checkboxes, which is why you cannot know whether a checkbox exists on
the form or not.

If this is true, I would get a variable $loop, set it to 0, then on
outputting every checkbox, append this value to the checkbox's name.
Then you have predicatable checkbox names.

When you have finished drawing the checkboxes, note in a hidden input
field the $loop value so you know what maximum possible checkbox number
is.

On receiveing the POST, do a for loop, and perform an if
(isset($_POST[checkbox_number_$loop])) then you know if it's set or
not.

I think that just about covers it. Apologies if I have
misread/misinterpreted what you have asked.

James Green





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




RE: [PHP] HTML issue... spaces in between images

2002-08-13 Thread James Green

On Tue, 2002-08-13 at 02:29, Matt Babineau wrote:
 TABLE
   TR
 TDIMG SRC=/images/image.gif/TD
 TDIMG SRC=/images/image.gif/TD
 TDIMG SRC=/images/image.gif/TD
 TDIMG SRC=/images/image.gif/TD
   /TR
 /TABLE

Which leads to other mysterious gaps (that are again part of the HTML
spec), the fix is provided here:

http://developer.netscape.com/evangelism/docs/articles/img-table/

James




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




Re: [PHP] include require directive

2002-08-13 Thread James Green

On Tue, 2002-08-13 at 02:55, Huy wrote:
 But I do...
 
 If I left out the require statement all is well.. or I copy the whole
 content of the included file.. it works fine. The problem is the require
 statement.

Check the file for whitespace, anything outside ?..?php or
spaces/blank lines above your first ?php in any of your files.

James.



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




Re: [PHP] N6: PHP files can't show source

2002-08-13 Thread James Green

On Tue, 2002-08-13 at 05:04, Jean-Christian Imbeault wrote:
 I'm using Netscape 6.2 and whenever I load one of my .php files I can't 
 get Netscape to show source. I don't have that problem with IE.
 
 Can anyone tell me how to configure Netscape so that I can view the HTML 
 output of my PHP files?

You may be seeing a problem that affected Mozilla prior to 1.0 release.
When it got a page as a result of a POST it wouldn't cache the result to
disk, which is where the View Source got it's data from. Something like
this may be affecting you.

Try it with Netscape 7 or Mozilla 1.0.

James




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




Re: [PHP] Re: controls list menu

2002-08-13 Thread James Green

On Tue, 2002-08-13 at 11:35, Peter Bottenberg wrote:
 Hy,
 
 Save this script as select.php
 
 ?PHP

- $action = $_POST[action];

 if (!isset($action))
 {
   $action = select;
 }

[ snip rest ]

Sorry, but the PHP irc channel is full of people asking why form
variables can't be seen by PHP for this reason.

James




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




Re: [PHP] Strip PHP tags

2002-08-12 Thread James Green

On Mon, 2002-08-12 at 18:35, Remy Dufour wrote:
 Hi all,
 
 Is there an easy way to remove ?php...? tag from a string ?
 Ive got this script and i want it to output only html...
 I know i can do this with regular expression but i wonder if there are some
 native function to do the job.

http://uk.php.net/manual/en/function.strip-tags.php

James



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




Re: [PHP] include require directive

2002-08-12 Thread James Green

On Mon, 2002-08-12 at 22:14, Huy wrote:
 If I use either the include or require statement, PHP will generate some
 lines in the browser. For example, I want the first line is Hello There..
 echo (Hello There); but the line happens to be the third line after some
 blank lines. So how do I turn that off??

http://uk.php.net/manual/en/function.include.php

Enclose your included scripts in ?php ... ?

James



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




Re: [PHP] Evaluating server date ranges?

2002-08-12 Thread James Green

On Mon, 2002-08-12 at 10:41, Joe in Minneapolis wrote:
 What's the best way to evaluate the server date to see if it's within a 
 specified date range?

Hm I'd [gm]mktime() both boundary dates, then turn all three dates into
unix timestamps and check the server date is within the two integer
boundaries.

http://www.php.net/manual/en/function.gmmktime.php

James




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




[PHP] Multiple layout strategy, advice saught!

2002-03-14 Thread James Green

Hi all,

We have a unix server with apache and php on it. We have a set of client
site that all share the same codebase. Our problem is that we end up with
multiple URL layouts for essentially the same thing. Let me explain.

Say we have clients x, y, and z. These buy template sites from us, and
access that as http://some.ip.add.ress/x/, /y/, and /z/. Inside these are a
number of urls such as /en/england/foo/bar/cat1/1.php and
/en/england/foo/bar/cat2/1.php, where all */foo/* urls need to be handled by
the /foo.php script via AliasMatch.

This by itself is not so difficult, however we also have a significant
number of client with their own domain names that need to be mapped directly
to their sitename.

Thus we end up with at two sets of AliasMatches:

AliasMatch ^/(.*)/(.*)/(.*)/foo/(.*) /www/shared/foo.php
for the templated sites where the (.*) correspond to sitename, language, and
country, and
AliasMatch ^/(.*)/(.*)/foo/(.*) /www/shared/foo.php
for domain-based sites.

Has anyone done anything similar? What did you end up doing? Any suggestions
about how to proceed? I'm thinking it'll be necessary to figure out from
foo.php whether we are in a /sitename/ or not and proceed to build urls from
there.

Thoughts gratefully appreciated. Help! :)

--
James Green
Developer
Stealthnet.co.uk


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




[PHP] configure problem: --with-mysql=/what exactly?

2001-11-19 Thread James Green

Hi all,

I have Debian Sid, I have Apache installed by source, and am trying to
install the source of PHP4.0.6. For reasons I won't go into, I cannot
use the Debian packages of Apache or PHP.

The problem is when I come to configure PHP with mysql support. I have
MySQL debs installed: mysql-server, mysql-client, libmysqlclient10-dev.
I can see the mysql libs in /usr/lib/, and the headers in
/usr/include/mysql/.

I have tried the following, each time removing config.cache beforehand:

--with-mysql=/usr
--with-mysql=/usr/include
--with-mysql=/usr/include/mysql
--with-mysql=/usr/lib

According to a friend with mysql Debs installed it should be the first,
yet PHP tells me each time it's using the bundled MySQL version and to
be careful of running it with other mysql-using modules.

Any ideas why configure doesn't pick up my local MySQL installation? It
certainly picks up the currect socket path.

Many thanks,

James Green



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




Re: [PHP] Multiviews and GET requests no longer working?

2001-11-17 Thread James Green

On Fri, 2001-11-16 at 17:49, James Green wrote:
 If I call foo?id=1, not only is the id variable not set,
 _SERVER[QUERY_STRING] isn't either. Cookies and session variables work
 fine, it's just variables passed via GET. If I turn off Multiviews, the
 variables come through fine, but it means calling foo.php.

Solved. There's a bug in Apache-1.3.22 which causes this. I'm
downgrading to 1.3.20 now.

jg



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




Re: [PHP] Multiviews and GET requests no longer working?

2001-11-17 Thread James Green

On Fri, 2001-11-16 at 17:49, James Green wrote:
 If I call foo?id=1, not only is the id variable not set,
 _SERVER[QUERY_STRING] isn't either. Cookies and session variables work
 fine, it's just variables passed via GET. If I turn off Multiviews, the
 variables come through fine, but it means calling foo.php.

Solved. There's a bug in Apache-1.3.22 which causes this. I'm
downgrading to 1.3.20 now.

jg



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




[PHP] Multiviews and GET requests no longer working?

2001-11-16 Thread James Green

Hi all,

So a few weeks back on my Debian Sid box I had everything running
nicely, PHP4, Apache 1.3, and had it such that Multiviews were turned
on, and I could call /foo?id=1 and the file foo.php would register the
variable id as having a value of 1.

I dist-upgraded last weekend (now PHP-4.1.0-RC2), and now it's stopped
working.

If I call foo?id=1, not only is the id variable not set,
_SERVER[QUERY_STRING] isn't either. Cookies and session variables work
fine, it's just variables passed via GET. If I turn off Multiviews, the
variables come through fine, but it means calling foo.php.

This has completely floored me. I don't want to re-write the site with
references to URLs with file extensions -- I deliberately don't want
users to see file extensions.

Anyone had similar problems? Anyone have any ideas what to try? I have
register_globals = On in the php.ini file, nothing in the php.ini or
httpd.conf files appears to have changed.

I'm at a loss. Please help!

Thanks,
James Green



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




Re: [PHP] quick friday query

2001-11-16 Thread James Green

On Fri, 2001-11-16 at 17:49, Caspar Kennerdale wrote:
 I am writing files to my server using
 
 $fp = fopen(myfile.txt, w);
 
 this all works. However in the php manual it says that by using the w
 switch that php will create the file if it doesn exist
 
 However this does not seem to work
 
 I can only write to a file that already exists and has CHMOD 777
 
 Is this a school boy error or do I need my server re configured?

Sounds like the webserver doesn't have permission to write into that
directory. Permissions 777 lets anyone write to the file, so there's a
good chance I'm right.

jg



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