[PHP] Upgraded system and now $_SERVER['SERVER_NAME'] is not more working

2010-12-19 Thread Michelle Konzack
Hello *,

I upgraded one of my servers from Debian/Etch to Lenny and now  the  var
$_SERVER['SERVER_NAME'] is not more working.

Did I have overseen something?

The offending code sniplet is this:

8--
T_setlocale(LC_MESSAGES, $locale);
$domain=$_SERVER['SERVER_NAME'];
T_bind_textdomain_codeset($domain, $encoding);
T_bindtextdomain($domain, LOCALE_DIR);
T_textdomain($domain);
8--

and the error messge is here:
http://vserver01.tamay-dogan.net/

Thanks, Greetings and nice Day/Evening
Michelle Konzack

-- 
# Debian GNU/Linux Consultant ##
   Development of Intranet and Embedded Systems with Debian GNU/Linux

itsyst...@tdnet France EURL   itsyst...@tdnet UG (limited liability)
Owner Michelle KonzackOwner Michelle Konzack

Apt. 917 (homeoffice)
50, rue de Soultz Kinzigstraße 17
67100 Strasbourg/France   77694 Kehl/Germany
Tel: +33-6-61925193 mobil Tel: +49-177-9351947 mobil
Tel: +33-9-52705884 fix

http://www.itsystems.tamay-dogan.net/  http://www.flexray4linux.org/
http://www.debian.tamay-dogan.net/ http://www.can4linux.org/

Jabber linux4miche...@jabber.ccc.de

Linux-User #280138 with the Linux Counter, http://counter.li.org/


signature.pgp
Description: Digital signature


[PHP] All records not displaying...

2010-12-19 Thread Gary
I have an issue that the first record in a query is not being displayed.  It
seems that the first row in alphabetical order is not being brought to the
screen.

I have run the query in the DB and it displays the correct result, so it has 
to be in the php.

I have a MySQL DB that lists beers.  I have a column for 'type' of beer
(imported, domestic, craft, light). The queries:

$result = MySQL_query(SELECT * FROM beer WHERE type = 'imported' AND stock
= 'YES' ORDER by beername );

When I run the query

if (mysql_num_rows($result) == !'0') {
$row = mysql_fetch_array($result);

  echo 'h3Imported Beers/h3';
  echo 'table width=100% border=0 cellspacing=1 cellpadding=1
id=tableone summary=

  thBeer/th
  thMaker/th
  thType/th
  thSingles/th
  th6-Packs/th
  thCans/th
  thBottles/th
  thDraft/th
  thSize/th
  thDescription/th';

  while ($row = mysql_fetch_array($result)) {

 echo 'tr td' . $row['beername'].'/td';
 echo 'td' . $row['manu'] . '/td';
 echo 'td' . $row['type'] . '/td';
 echo 'td width=40' . $row['singles'] . '/td';
 echo 'td width=20' . $row['six'] . '/td';
 echo 'td width=40' . $row['can'] . '/td';
 echo 'td width=20' . $row['bottles'] . '/td';
 echo 'td width=40' . $row['tap'] . '/td';
 echo 'td' . $row['size'] . '/td';
 echo 'td' . $row['descrip'] . '/td';
'/tr';
}
 echo '/tablebr /';

}

All but the first row in alphabetical order are displayed properly.

Can anyone tell me where I am going wrong?
-- 
Gary

BTW, I do have a bonus question that is about javascript in this same file, 
so if anyone want to take a stab at that, I'll be happy to post it.






__ Information from ESET Smart Security, version of virus signature 
database 5715 (20101219) __

The message was checked by ESET Smart Security.

http://www.eset.com





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



[PHP] Problem with Include

2010-12-19 Thread Bill Guion
In an effort to clean up some code, I tried taking four lines out of 
6 or 7 programs and putting them into an include file. The file 
structure is


Root
  data
clubs.php
  include
fmt.inc

Originally, clubs.php had the following code:

?PHP
$file_name= basename($_SERVER['PHP_SELF']);
$last_modified = filemtime($file_name);
print(This page last modified );
print(date(m/j/y, $last_modified));

?

This code works - on the web page I get

This page last modified 12/18/2010

which is correct.

So then I did the following:
Create an include file, fmt.inc with the following code:

$file_name= basename($_SERVER['PHP_SELF']);
$last_modified = filemtime($file_name);
print(This page last modified );
print(date(m/j/y, $last_modified));

and then in the original file, I have

?PHP
include ../include/fmt.inc;
?

On my web page, I then get

$file_name= basename($_SERVER['PHP_SELF']);$last_modified = 
filemtime($file_name);print(This page last modified ); 
print(date(m/j/y, $last_modified));


(all on one line).

I would really like to understand why the include construct doesn't 
give the same results as the original?


 -= Bill =-

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



Re: [PHP] All records not displaying...

2010-12-19 Thread Tamara Temple


On Dec 19, 2010, at 9:46 AM, Gary wrote:

I have an issue that the first record in a query is not being  
displayed.  It
seems that the first row in alphabetical order is not being brought  
to the

screen.

I have run the query in the DB and it displays the correct result,  
so it has

to be in the php.

I have a MySQL DB that lists beers.  I have a column for 'type' of  
beer

(imported, domestic, craft, light). The queries:

$result = MySQL_query(SELECT * FROM beer WHERE type = 'imported'  
AND stock

= 'YES' ORDER by beername );

When I run the query

if (mysql_num_rows($result) == !'0') {
   $row = mysql_fetch_array($result);

 echo 'h3Imported Beers/h3';
 echo 'table width=100% border=0 cellspacing=1 cellpadding=1
id=tableone summary=

 thBeer/th
 thMaker/th
 thType/th
 thSingles/th
 th6-Packs/th
 thCans/th
 thBottles/th
 thDraft/th
 thSize/th
 thDescription/th';

 while ($row = mysql_fetch_array($result)) {

echo 'tr td' . $row['beername'].'/td';
echo 'td' . $row['manu'] . '/td';
echo 'td' . $row['type'] . '/td';
echo 'td width=40' . $row['singles'] . '/td';
echo 'td width=20' . $row['six'] . '/td';
echo 'td width=40' . $row['can'] . '/td';
echo 'td width=20' . $row['bottles'] . '/td';
echo 'td width=40' . $row['tap'] . '/td';
echo 'td' . $row['size'] . '/td';
echo 'td' . $row['descrip'] . '/td';
'/tr';
   }
echo '/tablebr /';

}

All but the first row in alphabetical order are displayed properly.

Can anyone tell me where I am going wrong?
--
Gary

BTW, I do have a bonus question that is about javascript in this  
same file,

so if anyone want to take a stab at that, I'll be happy to post it.



This code will totally eliminate the first row of data.


if (mysql_num_rows($result) == !'0') {
   $row = mysql_fetch_array($result);


Fetches the first row, but is not output. Because:


 while ($row = mysql_fetch_array($result)) {


Fetches the second row before you do any output of the data.

Eliminate the first fetch_array and you're code should work fine.

BTW, if you put the td attributes 'width=n' in the preceding th  
tags, you won't have to output them for each row. You should also put  
the units those numbers are associated with.




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



Re: [PHP] HTML id attribute and arrays

2010-12-19 Thread Martin C

How should I follow the HTML specification while having the passed
parameters automatically converted to arrays in PHP?


The name attribute, not the id attribute, is used as the key when
submitting form values.

The name and id attributes do not have to be the same.


Thank you, I thought it should be the same (for same reason, maybe 
compatibility between XHTML and HTML). But could not find anything on 
the net which states this. So my memories might be corrupted :)


Based on first tests, it works (but have not checked the W3C validator yet).

Thanks,

Martin

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



Re: [PHP] HTML id attribute and arrays

2010-12-19 Thread Martin C

How should I follow the HTML specification while having the passed
parameters automatically converted to arrays in PHP?


The name attribute, not the id attribute, is used as the key when
submitting form values.

The name and id attributes do not have to be the same.


Thank you, I thought it should be the same (for same reason, maybe 
compatibility between XHTML and HTML). But could not find anything on 
the net which states this. So my memories might be corrupted :)


Based on first tests, it works (but have not checked the W3C validator yet).

Thanks,

Martin

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



Re: [PHP] Problem with Include

2010-12-19 Thread Govinda

$file_name= basename($_SERVER['PHP_SELF']);
$last_modified = filemtime($file_name);
print(This page last modified );
print(date(m/j/y, $last_modified));



you need to wrap the contents ^^^ of the include file with ? 
php   ?



Govinda


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



Re: [PHP] Problem with Include

2010-12-19 Thread Tamara Temple


On Dec 19, 2010, at 10:43 AM, Bill Guion wrote:

In an effort to clean up some code, I tried taking four lines out of  
6 or 7 programs and putting them into an include file. The file  
structure is


Root
 data
   clubs.php
 include
   fmt.inc

Originally, clubs.php had the following code:

?PHP
$file_name= basename($_SERVER['PHP_SELF']);
$last_modified = filemtime($file_name);
print(This page last modified );
print(date(m/j/y, $last_modified));

?

This code works - on the web page I get

This page last modified 12/18/2010

which is correct.

So then I did the following:
Create an include file, fmt.inc with the following code:

$file_name= basename($_SERVER['PHP_SELF']);
$last_modified = filemtime($file_name);
print(This page last modified );
print(date(m/j/y, $last_modified));

and then in the original file, I have

?PHP
include ../include/fmt.inc;
?

On my web page, I then get

$file_name= basename($_SERVER['PHP_SELF']);$last_modified =  
filemtime($file_name);print(This page last modified );  
print(date(m/j/y, $last_modified));


(all on one line).

I would really like to understand why the include construct doesn't  
give the same results as the original?


-= Bill =-

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



Whenever you see PHP code emitted to the web page, it means it wasn't  
wrapped in ?php..?. If your include file above is complete, it's  
missing these tags.



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



Re: [PHP] All records not displaying...

2010-12-19 Thread a...@ashleysheridan.co.uk
I'm not sure what this line us all about:

if (mysql_num_rows($result) == !'0')

You're basically saying; if the number of rows is equal to the not of the 
string 0, what I think you may want in this case is just != 0.

The next line is causing your problem though. You're grabbing the first row 
with that $row= line, and not doing anything with it. Take that out and it 
should be ok.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Gary gp...@paulgdesigns.com
Date: Sun, Dec 19, 2010 15:46
Subject: [PHP] All records not displaying...
To: php-general@lists.php.net

I have an issue that the first record in a query is not being displayed.  It
seems that the first row in alphabetical order is not being brought to the
screen.

I have run the query in the DB and it displays the correct result, so it has 
to be in the php.

I have a MySQL DB that lists beers.  I have a column for 'type' of beer
(imported, domestic, craft, light). The queries:

$result = MySQL_query(SELECT * FROM beer WHERE type = 'imported' AND stock
= 'YES' ORDER by beername );

When I run the query

if (mysql_num_rows($result) == !'0') {
$row = mysql_fetch_array($result);

  echo 'h3Imported Beers/h3';
  echo 'table width=100% border=0 cellspacing=1 cellpadding=1
id=tableone summary=

  thBeer/th
  thMaker/th
  thType/th
  thSingles/th
  th6-Packs/th
  thCans/th
  thBottles/th
  thDraft/th
  thSize/th
  thDescription/th';

  while ($row = mysql_fetch_array($result)) {

 echo 'tr td' . $row['beername'].'/td';
 echo 'td' . $row['manu'] . '/td';
 echo 'td' . $row['type'] . '/td';
 echo 'td width=40' . $row['singles'] . '/td';
 echo 'td width=20' . $row['six'] . '/td';
 echo 'td width=40' . $row['can'] . '/td';
 echo 'td width=20' . $row['bottles'] . '/td';
 echo 'td width=40' . $row['tap'] . '/td';
 echo 'td' . $row['size'] . '/td';
 echo 'td' . $row['descrip'] . '/td';
'/tr';
}
 echo '/tablebr /';

}

All but the first row in alphabetical order are displayed properly.

Can anyone tell me where I am going wrong?
-- 
Gary

BTW, I do have a bonus question that is about javascript in this same file, 
so if anyone want to take a stab at that, I'll be happy to post it.






__ Information from ESET Smart Security, version of virus signature 
database 5715 (20101219) __

The message was checked by ESET Smart Security.

http://www.eset.com





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



Re: [PHP] HTML id attribute and arrays

2010-12-19 Thread Benjamin Hawkes-Lewis
On Sun, Dec 19, 2010 at 4:57 PM, Martin C m...@seznam.cz wrote:
 The name and id attributes do not have to be the same.

 Thank you, I thought it should be the same (for same reason, maybe
 compatibility between XHTML and HTML). But could not find anything on the
 net which states this. So my memories might be corrupted :)

You're probably thinking of:

http://www.w3.org/TR/html401/struct/links.html#h-12.2.3

The id and name attributes share the same name space. This means that
they cannot both define an anchor with the same name in the same
document. It is permissible to use both attributes to specify an
element's unique identifier for the following elements: A, APPLET,
FORM, FRAME, IFRAME, IMG, and MAP. When both attributes are used on a
single element, their values must be identical.

Confusing, the name attribute on a form field (input, textarea,
select, etc) is different to the name attribute on a a or form
element, so this rule does not apply to it.

--
Benjamin Hawkes-Lewis

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



Re: [PHP] Problem with Include

2010-12-19 Thread a...@ashleysheridan.co.uk
Is your server even set up to recognise .inc files as php? You can't just put 
any old extension on and expect the server to know what to do with it.

Thanks,
Ash
http://www.ashleysheridan.co.uk

- Reply message -
From: Tamara Temple tamouse.li...@gmail.com
Date: Sun, Dec 19, 2010 17:07
Subject: [PHP] Problem with Include
To: Bill Guion bgu...@comcast.net
Cc: php-general@lists.php.net



On Dec 19, 2010, at 10:43 AM, Bill Guion wrote:

 In an effort to clean up some code, I tried taking four lines out of  
 6 or 7 programs and putting them into an include file. The file  
 structure is

 Root
  data
clubs.php
  include
fmt.inc

 Originally, clubs.php had the following code:

 ?PHP
 $file_name= basename($_SERVER['PHP_SELF']);
 $last_modified = filemtime($file_name);
 print(This page last modified );
 print(date(m/j/y, $last_modified));

 ?

 This code works - on the web page I get

 This page last modified 12/18/2010

 which is correct.

 So then I did the following:
 Create an include file, fmt.inc with the following code:

 $file_name= basename($_SERVER['PHP_SELF']);
 $last_modified = filemtime($file_name);
 print(This page last modified );
 print(date(m/j/y, $last_modified));

 and then in the original file, I have

 ?PHP
 include ../include/fmt.inc;
 ?

 On my web page, I then get

 $file_name= basename($_SERVER['PHP_SELF']);$last_modified =  
 filemtime($file_name);print(This page last modified );  
 print(date(m/j/y, $last_modified));

 (all on one line).

 I would really like to understand why the include construct doesn't  
 give the same results as the original?

 -= Bill =-

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


Whenever you see PHP code emitted to the web page, it means it wasn't  
wrapped in ?php..?. If your include file above is complete, it's  
missing these tags.


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



[PHP] Performance Improvement on Calling C++ executable from PHP

2010-12-19 Thread shiplu
Hello Everybody,

I am developing a php application that interfaces with an external
executable binary. The program is written in C++.
I open the program (say a.out) using proc_open. Write some command at
its stdin and fetch data stdout. Then close the program.

The timing of only a.out is
real 490ms
usr 160ms
sys 290ms

When I invoke it using proc_open in php-cli, the timing becomes
real 530ms
usr 50ms
sys 450ms

Look closely, the cpu time and the real elapsed time increases. I run
the php version from command line. As an apache handler this will
surly take more time.

My question is, how can I improve invoking this a.out? Is there any
best practice?

The command is something like
$ ./a.out --option value --option value  script.txt

The program a.out can not be converted in php unless I write an
extension. But this will need a lot of effort to write it in PHP.

Some of my ideas are,
1. Create a standalone multi-threaded server that calls a.out and php
calls that server.
2. Call a.out as a CGI and convert it that way.

Any ideas?

-- 
Shiplu Mokadd.im
My talks, http://talk.cmyweb.net

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



[PHP] Problem with Include

2010-12-19 Thread Bill Guion
Many, many thanks to Tamara, Govinda, and Ashley. Adding the php tags 
?php  ? to the include file solved the problem.


 -= Bill =-

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



[PHP] Performance Improvement on Calling C++ executable from PHP

2010-12-19 Thread Shiplu
===
Recently I  my this php-general doesn't accept my mail for some
reason. So I send it again from anther email
===


Hello Everybody,

I am developing a php application that interfaces with an external
executable binary. The program is written in C++.
I open the program (say a.out) using proc_open. Write some command at
its stdin and fetch data stdout. Then close the program.

The timing of only a.out is
real 490ms
usr 160ms
sys 290ms

When I invoke it using proc_open in php-cli, the timing becomes
real 530ms
usr 50ms
sys 450ms

Look closely, the cpu time and the real elapsed time increases. I run
the php version from command line. As an apache handler this will
surly take more time.

My question is, how can I improve invoking this a.out? Is there any
best practice?

The command is something like
$ ./a.out --option value --option value  script.txt

The program a.out can not be converted in php unless I write an
extension. But this will need a lot of effort to write it in PHP.

Some of my ideas are,
1. Create a standalone multi-threaded server that calls a.out and php
calls that server.
2. Call a.out as a CGI and convert it that way.

Any ideas?


-- 
Shiplu Mokadd.im

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



Re: [PHP] HTML id attribute and arrays

2010-12-19 Thread Martin C

The name and id attributes do not have to be the same.


Thank you, I thought it should be the same


You're probably thinking of:
http://www.w3.org/TR/html401/struct/links.html#h-12.2.3

The id and name attributes share the same name space. This means that
they cannot both define an anchor with the same name in the same
document. It is permissible to use both attributes to specify an
element's unique identifier for the following elements: A, APPLET,
FORM, FRAME, IFRAME, IMG, and MAP. When both attributes are used on a
single element, their values must be identical.

Confusing, the name attribute on a form field (input, textarea,
select, etc) is different to the name attribute on a a or form
element, so this rule does not apply to it.


Thank you, Benjamin, for clarification. This sounds like the source of 
my (bogus) feeling.


Martin

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



Re: [PHP] All records not displaying...

2010-12-19 Thread Gary

Tamara Temple tamouse.li...@gmail.com wrote in message 
news:c6993909-dd90-4f52-bf6b-ab888c281...@gmail.com...

 On Dec 19, 2010, at 9:46 AM, Gary wrote:

 I have an issue that the first record in a query is not being  displayed. 
 It
 seems that the first row in alphabetical order is not being brought  to 
 the
 screen.

 I have run the query in the DB and it displays the correct result,  so it 
 has
 to be in the php.

 I have a MySQL DB that lists beers.  I have a column for 'type' of  beer
 (imported, domestic, craft, light). The queries:

 $result = MySQL_query(SELECT * FROM beer WHERE type = 'imported'  AND 
 stock
 = 'YES' ORDER by beername );

 When I run the query

 if (mysql_num_rows($result) == !'0') {
$row = mysql_fetch_array($result);

  echo 'h3Imported Beers/h3';
  echo 'table width=100% border=0 cellspacing=1 cellpadding=1
 id=tableone summary=

  thBeer/th
  thMaker/th
  thType/th
  thSingles/th
  th6-Packs/th
  thCans/th
  thBottles/th
  thDraft/th
  thSize/th
  thDescription/th';

  while ($row = mysql_fetch_array($result)) {

 echo 'tr td' . $row['beername'].'/td';
 echo 'td' . $row['manu'] . '/td';
 echo 'td' . $row['type'] . '/td';
 echo 'td width=40' . $row['singles'] . '/td';
 echo 'td width=20' . $row['six'] . '/td';
 echo 'td width=40' . $row['can'] . '/td';
 echo 'td width=20' . $row['bottles'] . '/td';
 echo 'td width=40' . $row['tap'] . '/td';
 echo 'td' . $row['size'] . '/td';
 echo 'td' . $row['descrip'] . '/td';
 '/tr';
}
 echo '/tablebr /';

 }

 All but the first row in alphabetical order are displayed properly.

 Can anyone tell me where I am going wrong?
 -- 
 Gary

 BTW, I do have a bonus question that is about javascript in this  same 
 file,
 so if anyone want to take a stab at that, I'll be happy to post it.


 This code will totally eliminate the first row of data.

 if (mysql_num_rows($result) == !'0') {
$row = mysql_fetch_array($result);

 Fetches the first row, but is not output. Because:

  while ($row = mysql_fetch_array($result)) {

 Fetches the second row before you do any output of the data.

 Eliminate the first fetch_array and you're code should work fine.

 BTW, if you put the td attributes 'width=n' in the preceding th 
 tags, you won't have to output them for each row. You should also put  the 
 units those numbers are associated with.


Tamara

Thank you for your help and thank you for the explaination.  I removed the 
line and it works fine.  I dont remember where or why I had that line in 
there, it is code that I have recycled for a while now.

Gary 



__ Information from ESET Smart Security, version of virus signature 
database 5716 (20101219) __

The message was checked by ESET Smart Security.

http://www.eset.com





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



Re: [PHP] Problem with Include

2010-12-19 Thread Simcha Younger
On Sun, 19 Dec 2010 17:41:20 +
a...@ashleysheridan.co.uk a...@ashleysheridan.co.uk wrote:

 Is your server even set up to recognise .inc files as php? You can't just put 
 any old extension on and expect the server to know what to do with it.
 
 Thanks,
 Ash
 http://www.ashleysheridan.co.uk

Since it is being included by PHP, and not served by Apache, the extension is 
not important.


-- 
Simcha Younger sim...@syounger.com

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