php-general Digest 15 Sep 2007 04:23:03 -0000 Issue 5019
Topics (messages 262111 through 262132):
Re: PHP 5.2.3 - Segmentation fault (core dumped)
262111 by: Per Jessen
262112 by: Jay Blanchard
262114 by: T.Lensselink
262115 by: Per Jessen
262116 by: Per Jessen
262117 by: Per Jessen
262118 by: Jay Blanchard
262119 by: Per Jessen
262120 by: Jay Blanchard
Try to find a solution, when restart Apache with PHP Script
262113 by: Rodolfo De Nadai
Re: blocking exec() silently
262121 by: Instruct ICC
262122 by: Instruct ICC
262123 by: Zoltán Németh
262124 by: Samuel Vogel
262125 by: Nathan Nobbe
Re: my paging task with PHP does not work. It uses cookie.
262126 by: mike
262127 by: Zoltán Németh
About MYSQL/PHP Shopping Cart's Product Quantity Change Input Forms
262128 by: Ji H. Park
262129 by: Gavin M. Roy
262130 by: Warren Vail
262131 by: brian
$ SERVER["REQUEST URI"] includes domain unexpectedly
262132 by: junk.realtechtalk.com
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Jay Blanchard wrote:
> [snip]
> You are right. It segfaults only if the virtual() call comes before
> creating the XSLTProcessor instance.
> [/snip]
>
> I cannot replicate the problem on Linux.
>
So you get the XSLT error messages instead? That's what you should be
seeing.
See also http://bugs.php.net/bug.php?id=42666
/Per Jessen, Zürich
--- End Message ---
--- Begin Message ---
> [snip]
> You are right. It segfaults only if the virtual() call comes before
> creating the XSLTProcessor instance.
> [/snip]
>
> I cannot replicate the problem on Linux.
>
So you get the XSLT error messages instead? That's what you should be
seeing.
{/snip]
Yep, no segfault. I do not have a windows box handy for testing.
--- End Message ---
--- Begin Message ---
On Fri, 14 Sep 2007 08:10:56 -0500, "Jay Blanchard" <[EMAIL PROTECTED]>
wrote:
> [snip]
> You are right. It segfaults only if the virtual() call comes before
> creating the XSLTProcessor instance.
> [/snip]
>
> I cannot replicate the problem on Linux.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
In one of the other messages i stated the script works fine on linux.
But PHP on windows seems to have a problem with virtual(). Even without
creating an instance of the XSLProcessor class.
But dropping virtual() for include() or require() solves the problem.
--- End Message ---
--- Begin Message ---
T.Lensselink wrote:
> In one of the other messages i stated the script works fine on linux.
> But PHP on windows seems to have a problem with virtual(). Even
> without creating an instance of the XSLProcessor class.
>
> But dropping virtual() for include() or require() solves the problem.
Getting rid of the symptoms is easy, solving the problem is not.
include/require are not replacements for virtual(). virtual() creates
an apache sub-request which I need for content-negotiation.
/Per Jessen, Zürich
--- End Message ---
--- Begin Message ---
Jay Blanchard wrote:
> [snip]
> A core dump or an strace or some debug output at the right time will
> have 99% of the information you need - provided you understand how to
> read it.
> I submit there is generally no need to reproduce a problem in order to
> diagnose it. To fix it, yes, it will undoubtedly help if you can
> reproduce it, but once you've diagnosed it, reproducing it is a
> lot easier.
> [/snip]
>
> Wouldn't it be nice to have 100% of the information? That last 1% may
> be the code that caused the problem.
It would be nice, yes. In my previous professional life, I would
probably have asked the customer to set a SLIP trap to provide that
extra info. That trap would be triggered/detriggered given the right
set of circumstances and could give me either a systems trace, maybe a
stand-alone dump or something else to assist me in locating the
problem.
Right now I'm trying to debug what I think is a race condition in spamd
(spamassassin) when it reloads the config. Reproducing is out of the
question except by chance. To help me debug, I now run an strace every
time the daemon is sighup'ed. It might be another couple of months
before it happens again.
> [snip]
> What's the purpose of a core dump if it does not provide the key
> information for solving a problem? If I still have to isolate and
> reproduce the issue in user code, there seems to be very little need
> for the core dump, right?
> [/snip]
>
> Not so. A core dump, as you stated before, gives you most of the
> information. Having the code that appeared to have caused the problem
> is definitely welcomed. It helps to see what was occurring when the
> segfault happened. Would you not agree?
Oh, definitely. The complete code should always be available to you,
but that's not the same as being able to reproduce the problem.
/Per Jessen, Zürich
--- End Message ---
--- Begin Message ---
Jay Blanchard wrote:
>> [snip]
>> You are right. It segfaults only if the virtual() call comes before
>> creating the XSLTProcessor instance.
>> [/snip]
>>
>> I cannot replicate the problem on Linux.
>>
>
> So you get the XSLT error messages instead? That's what you should be
> seeing.
> {/snip]
>
> Yep, no segfault. I do not have a windows box handy for testing.
I'm on Linux too, so never mind Windows for the moment.
So what's the difference between our two environments? Try putting
something in the problem-include file to verify that virtual is doing
what it's supposed to.
/Per Jessen, Zürich
--- End Message ---
--- Begin Message ---
[snip]
I'm on Linux too, so never mind Windows for the moment.
So what's the difference between our two environments? Try putting
something in the problem-include file to verify that virtual is doing
what it's supposed to.
[/snip]
That worked fine. I am sure that there are many differences in our
environments. We are running Suse Linux, PHP 5.2.1, Apache 2.2.4.
--- End Message ---
--- Begin Message ---
Jay Blanchard wrote:
> [snip]
> I'm on Linux too, so never mind Windows for the moment.
> So what's the difference between our two environments? Try putting
> something in the problem-include file to verify that virtual is doing
> what it's supposed to.
> [/snip]
>
> That worked fine. I am sure that there are many differences in our
> environments. We are running Suse Linux, PHP 5.2.1, Apache 2.2.4.
That's close though - my workstation is openSUSE 10.2, PHP 5.2.4, Apache
2.2.4.
/Per Jessen, Zürich
--- End Message ---
--- Begin Message ---
[snip]
> That worked fine. I am sure that there are many differences in our
> environments. We are running Suse Linux, PHP 5.2.1, Apache 2.2.4.
That's close though - my workstation is openSUSE 10.2, PHP 5.2.4, Apache
2.2.4.
[/snip]
As this installation is on a development box it has nearly every
extension known loaded, if you have the same then we are nearly
duplicates. I am unsure of the differences in PHP 5.2.1 and 5.2.4 but I
would not think that it would touch virtual().
--- End Message ---
--- Begin Message ---
Hi all...
I'm facing a serious problem with my application. I have a script write
in PHP that starts in Internet Explorer, this script keep on running
until a varible value change on my MySQL database.
The problem is that when i restart Apache, the process child initalized
isn't kill... then the apache can't be start because the script is use
the port 80.
To solve my problem, without change anything, the best would be that
when i execute the script, it run on other port than the default 80...
so this way apache could start...
The is a way to redirect through php, so the script run on a diferent
port?? Like change some line, or add on php.ini files?? or even in
programming??
thanks ... for any info
--
* Rodolfo De Nadai *
* Analista de Sistema Jr. - Desenvolvimento *
*Informática de Municípios Associados S.A.*
Seu governo mais inteligente
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> -
www.ima.sp.gov.br <http://www.ima.sp.gov.br/>
Fone: (19) 3739-6000 / Ramal: 1307
--- End Message ---
--- Begin Message ---
> Instruct ICC schrieb:
> > I was going to mention
> > http://php.he.net/manual/en/features.safe-mode.functions.php and ask
> > you if you need any of those functions, but I prefer Nathan's answer.
> > You may be able to set the error reporting in conjunction with
> > disable_functions and be done.
> Date: Thu, 13 Sep 2007 20:30:52 +0200
> From: [EMAIL PROTECTED]
> Hey,
>
> Thanks for the replies!
> safe-mode is not an option unfortunately!
> But changing the Error reporting, is the first thing I wanted to do, but
> when I asked if this was possible on this list, somebody replied, that
> it this is not possible!
>
> Could you point me to a way, how I can achieve, that the "this function
> is disabled" error, without suppressing other error messages?
>
> Regards,
> Samy
I just tested what I had in mind. And it worked. When I added phpinfo to
disable_functions in php.ini and attempted to use it in a script, it was
displayed as a warning. So I modifed error_reporting in php.ini to not show
warnings and I believe I achieved the results you want. However, in a
production environment, I think you should disable all error reporting to not
tip your hand to a hacker. I haven't verified this today, but I remember a
situation where the PHP script would not display errors (or notices or warnings
or ... whatever messages) in the web page, yet the message would still appeared
in the Apache logs.
I just changed php.ini to:
disable_functions = "phpinfo"
...
error_reporting = E_ALL & ~E_WARNING
http://php.net/manual/en/features.safe-mode.php
http://php.net/manual/en/function.error-reporting.php
http://php.net/manual/en/features.safe-mode.functions.php
Ahh, read this in php.ini:
; Print out errors (as a part of the output). For production web sites,
; you're strongly encouraged to turn this feature off, and use error logging
; instead (see below). Keeping display_errors enabled on a production web site
; may reveal security information to end users, such as file paths on your Web
; server, your database schema or other information.
Also Samy,
I saw something like this in someone's signature line on this list:
Because it destroys the context or flow of the discussion.
>Why should I not "TOP-POST"?
_________________________________________________________________
Can you find the hidden words? Take a break and play Seekadoo!
http://club.live.com/seekadoo.aspx?icid=seek_wlmailtextlink
--- End Message ---
--- Begin Message ---
> From: [EMAIL PROTECTED]
> Actually in this example, there is an error handling function provided
> in the comments.
I'm commenting again because I want to stress the distinctions between errors
E_ERROR, warnings E_WARNING, *USER* and other "messages/notices/etc.":
http://php.net/manual/en/ref.errorfunc.php#errorfunc.constants
http://php.net/manual/en/function.trigger-error.php
It may help you better design what you want on or off (and also versus logged
somewhere else as I mentioned in my last post).
_________________________________________________________________
Capture your memories in an online journal!
http://www.reallivemoms.com?ocid=TXT_TAGHM&loc=us
--- End Message ---
--- Begin Message ---
2007. 09. 14, péntek keltezéssel 08.31-kor Instruct ICC ezt írta:
> > Instruct ICC schrieb:
> > > I was going to mention
> > > http://php.he.net/manual/en/features.safe-mode.functions.php and ask
> > > you if you need any of those functions, but I prefer Nathan's answer.
> > > You may be able to set the error reporting in conjunction with
> > > disable_functions and be done.
>
> > Date: Thu, 13 Sep 2007 20:30:52 +0200
> > From: [EMAIL PROTECTED]
> > Hey,
> >
> > Thanks for the replies!
> > safe-mode is not an option unfortunately!
> > But changing the Error reporting, is the first thing I wanted to do, but
> > when I asked if this was possible on this list, somebody replied, that
> > it this is not possible!
> >
> > Could you point me to a way, how I can achieve, that the "this function
> > is disabled" error, without suppressing other error messages?
> >
> > Regards,
> > Samy
>
> I just tested what I had in mind. And it worked. When I added phpinfo to
> disable_functions in php.ini and attempted to use it in a script, it was
> displayed as a warning. So I modifed error_reporting in php.ini to not show
> warnings and I believe I achieved the results you want. However, in a
> production environment, I think you should disable all error reporting to not
> tip your hand to a hacker. I haven't verified this today, but I remember a
> situation where the PHP script would not display errors (or notices or
> warnings or ... whatever messages) in the web page, yet the message would
> still appeared in the Apache logs.
>
> I just changed php.ini to:
> disable_functions = "phpinfo"
> ...
> error_reporting = E_ALL & ~E_WARNING
a better solution would be
error_reporting = E_ALL
display_errors = off
log_errors = on
this sends all error messages to the apache log, as you mentioned above.
see:
http://hu2.php.net/manual/en/ref.errorfunc.php
http://hu2.php.net/manual/en/ref.errorfunc.php#ini.display-errors
greets
Zoltán Németh
>
> http://php.net/manual/en/features.safe-mode.php
> http://php.net/manual/en/function.error-reporting.php
> http://php.net/manual/en/features.safe-mode.functions.php
>
> Ahh, read this in php.ini:
> ; Print out errors (as a part of the output). For production web sites,
> ; you're strongly encouraged to turn this feature off, and use error logging
> ; instead (see below). Keeping display_errors enabled on a production web
> site
> ; may reveal security information to end users, such as file paths on your Web
> ; server, your database schema or other information.
>
>
> Also Samy,
> I saw something like this in someone's signature line on this list:
>
>
> Because it destroys the context or flow of the discussion.
>
> >Why should I not "TOP-POST"?
>
> _________________________________________________________________
> Can you find the hidden words? Take a break and play Seekadoo!
> http://club.live.com/seekadoo.aspx?icid=seek_wlmailtextlink
--- End Message ---
--- Begin Message ---
Actually I can not do that.
The point of my question was, that I'm running kilu.de, a German
Freehosting service. But many of our users can not cope with the error
messages, occurring from the disabled_functions!
I can't log to the error log, because the errors need to be displayed to
our users.
Regards,
Samy
a better solution would be
error_reporting = E_ALL
display_errors = off
log_errors = on
this sends all error messages to the apache log, as you mentioned above.
see:
http://hu2.php.net/manual/en/ref.errorfunc.php
http://hu2.php.net/manual/en/ref.errorfunc.php#ini.display-errors
greets
Zoltán Németh
--- End Message ---
--- Begin Message ---
shared hosting environments are interesting; ive sometimes wondered how i
might configure the environment
in such a scenario.
after revoking access to the exec() command you could allow the errors to be
sent to the browser
and recommend to users override the stock error handler as mentioned before
to suppress output of particular
error types (such as warnings [from calling exec() for example]).
that is a cumbersome solution at best.
it would be nice if there was a way to redirect output to an error log that
was dynamically selected based upon
the particular user in the shared hosing environment. that way the clients
could easily decide if they wanted the
logging to go to the browser or to a file, and each client would have an
isolated file for error logging.
im not sure on the implementation details, but i believe youd do good to
research .htaccess files and php.ini
(assuming youre running apache as the webserver).
here<http://www.karakas-online.de/EN-Book/change-php-parameters.html>is
the first article that came up in a google search.
thats how 1and1 does it, via .htaccess
-nathan
On 9/14/07, Samuel Vogel <[EMAIL PROTECTED]> wrote:
>
> Actually I can not do that.
> The point of my question was, that I'm running kilu.de, a German
> Freehosting service. But many of our users can not cope with the error
> messages, occurring from the disabled_functions!
>
> I can't log to the error log, because the errors need to be displayed to
> our users.
>
> Regards,
> Samy
>
> > a better solution would be
> >
> > error_reporting = E_ALL
> > display_errors = off
> > log_errors = on
> >
> > this sends all error messages to the apache log, as you mentioned above.
> >
> > see:
> > http://hu2.php.net/manual/en/ref.errorfunc.php
> > http://hu2.php.net/manual/en/ref.errorfunc.php#ini.display-errors
> >
> > greets
> > Zoltán Németh
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
except i think innodb does not have a full row count stored.
anyway the design was meant for a simple one function call. it's
worked great for small and data loads.
On 9/14/07, Arvids Godjuks <[EMAIL PROTECTED]> wrote:
> Don't use SQL_CALC_FOUND ROWS on simple queries, when you have to run a
> simple query on one or two (with join) tables with a simple WHERE. Especialy
> if tables are big. I found out that single SELECT COUNT(id) FROM table is
> far more faster when query has simple WHERE conditions. I use
> SQL_CALC_FOUND_ROWS only with a rather complex queries - that
> SQL_CALC_FOUND_ROWS doesn't affect query execution at all (well, it affects
> ofcourse, but affect is so small, you can't see it).
--- End Message ---
--- Begin Message ---
2007. 09. 14, péntek keltezéssel 10.50-kor mike ezt írta:
> except i think innodb does not have a full row count stored.
of course not, but SQL_CALC_FOUND_ROWS does not use that. it is working
like it selects the rows and counts them. and in the case of complex
queries (where you use more than one table) you could not make use of
that stored value anyway.
greets
Zoltán Németh
>
> anyway the design was meant for a simple one function call. it's
> worked great for small and data loads.
>
> On 9/14/07, Arvids Godjuks <[EMAIL PROTECTED]> wrote:
> > Don't use SQL_CALC_FOUND ROWS on simple queries, when you have to run a
> > simple query on one or two (with join) tables with a simple WHERE. Especialy
> > if tables are big. I found out that single SELECT COUNT(id) FROM table is
> > far more faster when query has simple WHERE conditions. I use
> > SQL_CALC_FOUND_ROWS only with a rather complex queries - that
> > SQL_CALC_FOUND_ROWS doesn't affect query execution at all (well, it affects
> > ofcourse, but affect is so small, you can't see it).
>
--- End Message ---
--- Begin Message ---
*The question: "How would you have multiple text input forms (on
shopping cart page) with different inputted data (product quantities)
submitted for querying the database (for changing the quantity of
multiple products in the shopping cart at the same time)?**"*
*Here is an ideal example to clarify the matter:*
When a customer wants to change quantities of multiple products all at
once in the shopping cart, all the quantities has to be changed at the
same time just by clicking a button called (e.g. Update Quantity).
*Issue*: Currently I have update quantity buttons for each product,
which isn't convenient.
I would appreciate any tips, techniques, comments, or reference to any
website regarding this issue at your repository, thanks!
--- End Message ---
--- Begin Message ---
Name all your input boxes the same thing, and include a similar level hidden
input:
<input type="hidden" name="sku[]" value="abc123" />
<input type="text" name="qty[]" value="1" />
<input type="hidden" name="sku[]" value="abc321" />
<input type="text" name="qty[]" value="2" />
on your POST
$_POST['sku'] && $_POST['qty'] will be arrays, and the ordering will be the
same so you can be sure of what index position/sku the qty is for.
On 9/14/07, Ji H. Park <[EMAIL PROTECTED]> wrote:
>
> *The question: "How would you have multiple text input forms (on
> shopping cart page) with different inputted data (product quantities)
> submitted for querying the database (for changing the quantity of
> multiple products in the shopping cart at the same time)?**"*
>
> *Here is an ideal example to clarify the matter:*
> When a customer wants to change quantities of multiple products all at
> once in the shopping cart, all the quantities has to be changed at the
> same time just by clicking a button called (e.g. Update Quantity).
>
> *Issue*: Currently I have update quantity buttons for each product,
> which isn't convenient.
>
> I would appreciate any tips, techniques, comments, or reference to any
> website regarding this issue at your repository, thanks!
>
--- End Message ---
--- Begin Message ---
> *The question: "How would you have multiple text input forms (on
> shopping cart page) with different inputted data (product quantities)
> submitted for querying the database (for changing the quantity of
> multiple products in the shopping cart at the same time)?**"*
easy, you can cause multiple text fields on the form with php compatible
array names. Say you have a list of line items from your cart table and
the record ids (artificial keys of the cart table could be used in the
index). Here is a sample couple of text fields;
<input type="text" name="quantity[5]" value="1">
<input type="text" name="quantity[14]" value="3">
<input type="text" name="quantity[8]" value="1">
the number 5, 14, and 8 represent the keys of the rows from your cart
table and when you pull the value from the post array after the user
submits the form, of course in addition to the quantities you should
show things like product descriptions and such on the same line as the
quantity text box.
$qtyupdates = $_POST["quantity"];
$qtyupdates above becomes an array with 3 rows in it and the recordd ids
are stored in the index.
A simple foreach loop
Foreach($qtyupdates as $idx => $qty) {
$query = "update cart_table set itemqty = ".$qty
." where cart_lineid = ".$idx;
mysql_query.... you get the rest
}
your form now becomes a list of line items with quantities in text boxes
for each item, and a single submit button allows you to apply all
changes at once.
Hope this is clear enough,
Warren Vail
Vail Systems Technology
http://www.vailtech.net
--- End Message ---
--- Begin Message ---
Ji H. Park wrote:
*The question: "How would you have multiple text input forms (on
shopping cart page) with different inputted data (product quantities)
submitted for querying the database (for changing the quantity of
multiple products in the shopping cart at the same time)?**"*
*Here is an ideal example to clarify the matter:*
When a customer wants to change quantities of multiple products all at
once in the shopping cart, all the quantities has to be changed at the
same time just by clicking a button called (e.g. Update Quantity).
*Issue*: Currently I have update quantity buttons for each product,
which isn't convenient.
I would appreciate any tips, techniques, comments, or reference to any
website regarding this issue at your repository, thanks!
Don't provide a button at all. Place the quantity for each item in a
text input field so that it may be edited by the user before submission.
I'm guessing that your page may presently be showing the details of the
item(s) as, say, a regular HTML table, with hidden form fields for the
data. But, instead of having the quantity hidden, place it in a normal
field. This way, any, all, or none of the quantities may be updated in
one POST.
Or, if your cart resides solely in $_SESSION, you may still provide the
quantity fields and update later.
brian
--- End Message ---
--- Begin Message ---
In my old server running Apache 1.3 and PHP 4 this code will return just the
URI as expected:
$_SERVER["REQUEST_URI"] = "/some-html-file.html"
In my new server with Apache 2 & PHP 4 this code returns the domain:
$_SERVER["REQUEST_URI"] = "/full-domain-name.com/some-html-file.html"
Does anyone know a way to change things so the code will not return the
domain name and whether this is because of PHP or Apache that I'm
suddenly getting the full domain name?
--- End Message ---