php-general Digest 18 Jan 2011 15:29:04 -0000 Issue 7139
Topics (messages 310826 through 310836):
Re: PHP Error logging
310826 by: Daniel Brown
how to avoid using temporary?
310827 by: I am on the top of the world! Borlange University
310830 by: Tommy Pham
Re: Validate Domain Name by Regular Express
310828 by: WalkinRaven
310829 by: WalkinRaven
Re: permission problem www-data
310831 by: Moses
310832 by: [email protected]
310833 by: Moses
310834 by: [email protected]
310836 by: Donovan Brooke
Re: A bad design decision or pure genius?
310835 by: Jay Blanchard
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 ---
On Mon, Jan 17, 2011 at 19:33, Jimmy Stewpot <[email protected]> wrote:
> Hello,
>
> I currently have a strange issue where we are seeing 'random errors' being
> displayed to end users. What I find most interesting is that in the php.ini
> file we have the following error settings.
>
> error_reporting = E_ALL & ~E_NOTICE
> display_errors = Off
> display_startup_errors = Off
> log_errors = On
> log_errors_max_len = 1024
> ignore_repeated_errors = Off
> track_errors = Off
>
> I thought that if we had dislay_errors = Off then end users should never see
> errors displayed on the web page. However at apparently random times we do
> still see errors being reported, its not consistent at all. To give a better
> idea of the problem we have 8 web servers, they all run an identical copy of
> the site which is stored on a common netapp nfs filer. At apparently random
> times we see that 1 out of 8 servers will reported strange errors like 'use
> of undefined constant' or 'Undefined variable'. What's most strange about
> these errors is that if the code was faulty wouldn't we expect to see the
> errors on all web servers? and secondly wouldn't we expect to see the errors
> constantly rather than at apparently random intervals?
>
> The php.ini files have a modify time of mid 2010 and yet this problem has
> only started in the last few weeks. Has anyone else experienced similar
> problems in the past and if so what was the root cause?
Sounds like someone added either ini_set('display_errors','On') in
the script being called or an include, added a local php.ini file to
the directory (or a parent directory), or added a php_flag to
.htaccess in the directory (or a parent). Try checking into those
possibilities.
--
</Daniel P. Brown>
Network Infrastructure Manager
Documentation, Webmaster Teams
http://www.php.net/
--- End Message ---
--- Begin Message ---
heres my sql query:
EXPLAIN SELECT t1.szs_guige,SUM(t1.szs_shuliang) FROM szs_ck_ruku_items
t1,szs_ck_ruku t2 WHERE t1.szs_rukubianhao = t2.szs_rukubianhao AND
t2.szs_date>'2010-10-23' GROUP BY t1.szs_guige ORDER BY null
result:
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range PRIMARY,date date 3 \N 177 Using where; Using index; Using
temporary
1 SIMPLE t1 ref PRIMARY PRIMARY 32 szs_jihuadan.t2.szs_rukubianhao 4
table structure below:
CREATE TABLE `szs_ck_ruku` (
`szs_rukubianhao` varchar(10) NOT NULL,
`szs_kuhao` varchar(10) NOT NULL,
`szs_kuwei` varchar(10) NOT NULL,
`szs_xianghao` varchar(4) NOT NULL,
`szs_caozuoyuan` varchar(10) NOT NULL,
`szs_date` date NOT NULL,
PRIMARY KEY (`szs_rukubianhao`,`szs_kuhao`,`szs_kuwei`),
KEY `date` (`szs_date`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
CREATE TABLE `szs_ck_ruku_items` (
`szs_rukubianhao` varchar(10) NOT NULL,
`szs_kuhao` varchar(10) NOT NULL,
`szs_kuwei` varchar(10) NOT NULL,
`szs_shengchanhao` varchar(50) NOT NULL,
`szs_guige` varchar(100) NOT NULL,
`szs_tuhao` varchar(100) NOT NULL,
`szs_shuliang` int(8) NOT NULL,
`szs_beizhu` text NOT NULL,
PRIMARY KEY
(`szs_rukubianhao`,`szs_kuhao`,`szs_kuwei`,`szs_shengchanhao`,`szs_guige`,`szs_tuhao`),
KEY `GG` (`szs_guige`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
how to avoid using temporary? i am confuzed......
thanks
--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: I am on the top of the world! Borlange University
> [mailto:[email protected]]
> Sent: Monday, January 17, 2011 11:33 PM
> To: [email protected]
> Subject: [PHP] how to avoid using temporary?
>
> heres my sql query:
> EXPLAIN SELECT t1.szs_guige,SUM(t1.szs_shuliang) FROM szs_ck_ruku_items
> t1,szs_ck_ruku t2 WHERE t1.szs_rukubianhao = t2.szs_rukubianhao AND
> t2.szs_date>'2010-10-23' GROUP BY t1.szs_guige ORDER BY null
>
<snip>
This is PHP list. Not a SQL list/discussion. Try asking the forum relating
to the DBMS you're using.
Regards,
Tommy
--- End Message ---
--- Begin Message ---
On 01/08/2011 04:55 PM, WalkinRaven wrote:
PHP 5.3 PCRE
Regular Express to match domain names format according to RFC 1034 -
DOMAIN NAMES - CONCEPTS AND FACILITIES
/^
(
[a-z] |
[a-z] (?:[a-z]|[0-9]) |
[a-z] (?:[a-z]|[0-9]|\-){1,61} (?:[a-z]|[0-9]) ) # One label
(?:\.(?1))*+ # More labels
\.? # Root domain name
$/iDx
This rule matches only <label> and <label>. but not <label>.<label>...
I don't know what wrong with it.
Thank you.
Thank you all, and I think I've found the problem: If you don't use
'Recursive Reference' feature, all will work well.
Detail:
http://ndss.walkinraven.name/2011/01/bug-related-to-recursive-reference-in.html
--- End Message ---
--- Begin Message ---
On 01/08/2011 04:55 PM, WalkinRaven wrote:
PHP 5.3 PCRE
Regular Express to match domain names format according to RFC 1034 -
DOMAIN NAMES - CONCEPTS AND FACILITIES
/^
(
[a-z] |
[a-z] (?:[a-z]|[0-9]) |
[a-z] (?:[a-z]|[0-9]|\-){1,61} (?:[a-z]|[0-9]) ) # One label
(?:\.(?1))*+ # More labels
\.? # Root domain name
$/iDx
This rule matches only <label> and <label>. but not <label>.<label>...
I don't know what wrong with it.
Thank you.
Thank you all, and I think I've found the problem: If you don't use
'Recursive Reference' feature, all will work well.
Detail:
http://ndss.walkinraven.name/2011/01/bug-related-to-recursive-reference-in.html
--- End Message ---
--- Begin Message ---
Hi Everyone,
I am creating a file in PHP script which takes a value from a form and
writes it
to a file. However, i don't have the mode permission for the file instead it
is owned
by www-data.What can i do to ensure that the file is owned by me.
drwxr-xr-x 2 www-data www-data 4096 2011-01-17 22:01 18757170111.0
-rw-r--r-- 1 www-data www-data 40 2011-01-17 23:39 32238.hydro
Thanks.
--- End Message ---
--- Begin Message ---
you could use the chown method in php, which should do what you need.
Thanks,
Ash
http://www.ashleysheridan.co.uk
----- Reply message -----
From: "Moses" <[email protected]>
Date: Tue, Jan 18, 2011 09:44
Subject: [PHP] [PHP]: permission problem www-data
To: <[email protected]>
Hi Everyone,
I am creating a file in PHP script which takes a value from a form and
writes it
to a file. However, i don't have the mode permission for the file instead it
is owned
by www-data.What can i do to ensure that the file is owned by me.
drwxr-xr-x 2 www-data www-data 4096 2011-01-17 22:01 18757170111.0
-rw-r--r-- 1 www-data www-data 40 2011-01-17 23:39 32238.hydro
Thanks.
--- End Message ---
--- Begin Message ---
Hi Ash,
I have tried to use chown but i am getting the error
Warning: chown() [function.chown]: Operation not permitted
I would like to know why the apache(www-data) owns the file rather than
the user (me).
Thanks.
On Tue, Jan 18, 2011 at 11:53 AM, [email protected] <
[email protected]> wrote:
> you could use the chown method in php, which should do what you need.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
> ----- Reply message -----
> From: "Moses" <[email protected]>
> Date: Tue, Jan 18, 2011 09:44
> Subject: [PHP] [PHP]: permission problem www-data
> To: <[email protected]>
>
>
> Hi Everyone,
>
> I am creating a file in PHP script which takes a value from a form and
> writes it
> to a file. However, i don't have the mode permission for the file instead
> it
> is owned
> by www-data.What can i do to ensure that the file is owned by me.
>
>
> drwxr-xr-x 2 www-data www-data 4096 2011-01-17 22:01 18757170111.0
> -rw-r--r-- 1 www-data www-data 40 2011-01-17 23:39 32238.hydro
>
> Thanks.
>
>
>
--- End Message ---
--- Begin Message ---
Because the web server is what runs php as a module, and the web server has its
own user for security reasons. You could try chmod but that is generally a last
resort.
Thanks,
Ash
http://www.ashleysheridan.co.uk
----- Reply message -----
From: "Moses" <[email protected]>
Date: Tue, Jan 18, 2011 10:17
Subject: [PHP] [PHP]: permission problem www-data
To: "[email protected]" <[email protected]>
Cc: <[email protected]>
--- End Message ---
--- Begin Message ---
Moses wrote:
Hi Everyone,
I am creating a file in PHP script which takes a value from a form and
writes it
to a file. However, i don't have the mode permission for the file instead it
is owned
by www-data.What can i do to ensure that the file is owned by me.
drwxr-xr-x 2 www-data www-data 4096 2011-01-17 22:01 18757170111.0
-rw-r--r-- 1 www-data www-data 40 2011-01-17 23:39 32238.hydro
Thanks.
Hi Moses, I think the answer to your question lies in more info from
you. I assume that you want your user account to have permission? Why?
What are you doing with the file?
Donovan
--
D Brooke
--- End Message ---
--- Begin Message ---
[snip]
>> I have a application that I'm working on that uses google maps to
>> display interactive maps (using javascript) on the website.
[/snip]
Have a look here;
http://speckyboy.com/2010/02/03/10-jquery-plugins-for-easier-google-map-
installation/
jQuery can take some of the pain out of working with Google maps.
--- End Message ---