[PHP] MySQL connector installation/upgrade problems

2007-10-22 Thread David Zentgraf

Hi,

I'm trying to upgrade a server running CentOS 3 to an up-to-date  
MySQL 5 installation + PHP4. I installed the MySQL 5 package, server  
and client, via RPMs and they work fine, the client tells me it's  
version 5.0.45. I went on to recompile PHP 4.4.7 --with-mysql, but  
it's still using MySQL client libraries version 3.23.58. I'm kind of  
at a loss where it takes these versions from or how I can get it to  
use the newer libraries.


Any hints would be greatly appreciated.

Chrs,
Dav

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



RE: [PHP] problem with foreach

2007-10-22 Thread Robert Cummings
On Mon, 2007-10-22 at 19:59 -0400, Bastien Koert wrote:
> I am sure that I am late to the party, but am sure that
> double or single quotes at least are needed around the
> attribute values to make this work

Late to the party and completely off the mark taboot. Don't need quotes
at all. It's bad practice to omit them, but it works fine.

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



RE: [PHP] problem with foreach

2007-10-22 Thread Bastien Koert

I am sure that I am late to the party, but am sure that double or single quotes 
at least are needed around the attribute values to make this work


Civil Rights


bastien





> Date: Mon, 22 Oct 2007 12:20:55 
-0500> From: [EMAIL PROTECTED]> CC: php-general@lists.php.net> Subject: Re: 
[PHP] problem with foreach Robert Cummings wrote:>> On Mon, 2007-10-22 at 
18:07 +0100, Stut wrote:> Adam Williams wrote:>>> I have an html page 
with checkboxes:  Modern Mississippi Civil Rights 
MilitaryHistory  and mailform2.php containing: echo "you 
selected: "; /* line 81 */ foreach ($_POST[option] as $a) { echo 
"$a"; } but I'm getting the error: you selected: 
*Warning*: Invalid argument supplied for foreach() in 
*/var/www/sites/mdah-test/museum/mmhsurvey/mailform2.php* on line *81* 
I googled some checkbox/foreach pages on google, but I don't see where I'm 
going wrong. I'm running php 5.2.5 on Apache 2.2.4 on Fedora Linux. Any 
help?>>> Turn notices on. You will then get lots of notices about the use 
of an>>> undefined constant "option".>> You should be using 
$_POST['option'] instead - notice the quotes.>> Your HTML should really 
have double quotes around the attributes but>>> that's beyond the scope of this 
list.>>> He's still going to get an invalid argument warning though since 
PHP>> will automatically convert the unquoted key to a string and then look 
up>> the value. The problem is that the value doesn't exist or is not an>> 
array as expected. Cheers,>> Rob. Yeah, thats the problem I'm having 
for some reason. When I do:>> print_r($_POST['option']);>> it prints nothing.>> 
--> PHP General Mailing List (http://www.php.net/)> To unsubscribe, visit: 
http://www.php.net/unsub.php>

_
Are you ready for Windows Live Messenger Beta 8.5 ? Get the latest for free 
today!
http://entertainment.sympatico.msn.ca/WindowsLiveMessenger
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Php generated html email

2007-10-22 Thread Jay Blanchard
[snip]
How can I create a html email directly from a web page via Php?
The page will include tables, background colors and pictures within the 
tables. The received email should be readable without Internet 
connection (pictures, must be sent with the email)
[/snip]

Google is your friend...
http://www.google.com/search?hl=en&safe=off&sa=X&oi=spell&resnum=0&ct=re
sult&cd=1&q=html+email+with+PHP&spell=1

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



[PHP] Php generated html email

2007-10-22 Thread Ronald Wiplinger

How can I create a html email directly from a web page via Php?
The page will include tables, background colors and pictures within the 
tables. The received email should be readable without Internet 
connection (pictures, must be sent with the email)



bye

Ronald

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



[PHP] Thoughts on multiple servers

2007-10-22 Thread Ronald Wiplinger
At current stage I have two servers installed, whereby the first one 
does all, but the second is a database server.


I need to install on different location a server pair, which should work 
together, fail-fall-over, ...


The idea is to have in the dns for the servers:

abc.example.com <== general term
tw.abc.example.com<== redirected to, if the user is closer to Taiwan
de.abc.example.com<== redirected to, if the user is closer to Germany

abc will be in my office (10Mbps), tw.abc & de.abc are server 
co-location with each 150 Mbps.


The database server is connected to the web server via second Ethernet 
port and a private IP (192.168.x.x) via cross over cable.
The other ethernet port of the web server is connected to the Internet 
(either through another ADSL, like at my office) or to like the web 
server directly to the Internet HUB.
The mySQL servers should be set-up as a cluster server and should work 
together within a VPN.


Questions:
1. Any hints on above configuration?
2. Has anybody experience with a cluster mysql?
3. How to get the web servers working with the closest connection 
(according to the users IP) ?
4. How do I get info about the users IP (within the web server) to 
provide startup settings, like Time zone & so time of the user, 
language, country, ... ?
5. How to make it fail-fall-over if one of the server (web and/or 
database server!) is not working?


Thanks for you input!

bye

Ronald

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



RE: [PHP] Is it possible to restart Windows Apache (service) on a PHP script?

2007-10-22 Thread Daevid Vincent
DOH!. I'm sorry I didn't read the fact that this was on Windows. My bad...

Um. Out of curiosity, why would you run LAMP as WAMP? It just seems so
wrong. Not to start an OS religion war, I use XP all day long, but I would
never use it as my dedicated web server -- that's why God invented
Unix/Linux. Best tool for the job and all that stuff...  You're just asking
for all kinds of headaches and limitations (such as the one you're
encountering now) by using the back of a screwdriver to hammer a nail
IYKWIM. You'll poke your eye out! :)

> -Original Message-
> From: Daevid Vincent [mailto:[EMAIL PROTECTED] 
> Sent: Monday, October 22, 2007 1:26 PM
> To: php-general@lists.php.net
> Subject: RE: [PHP] Is it possible to restart Windows Apache 
> (service) on a PHP script?
> 
> What we do is setup 'sudo' to run certain commands (or a 
> shell/ruby script
> for example), then have PHP/Apache exec() the script via sudo 
> (or use a DBUS
> call to a 'root' enabled ruby daemon), which then restarts apache or
> whatever we want.
> 
> Be VERY careful with the way you do this or you can give 
> crackers all kinds
> of ways to cause you pain.
> 
> 
> For example:
> 
> [EMAIL PROTECTED]:/etc# cat /etc/sudoers
> Cmnd_Alias CHMOD = /bin/chmod
> Cmnd_Alias REBOOT = /sbin/reboot, /sbin/shutdown
> 
> rootALL=(ALL) ALL
> www-dataALL=NOPASSWD: /bin/date, /sbin/hwclock,
> REBOOT,  /usr/bin/dpkg, 
> /usr/sbin/chpasswd,
> /usr/bin/passwd, /usr/sbin/srvwatch,
> /usr/sbin/srvtalk
> 
> Then in the PHP web page:
> 
> exec("/usr/bin/sudo /sbin/reboot");
> 
> 
> D.Vin
> 
> "Voice or no voice, the people can alway be brought to the 
> bidding of the
> leaders. This is easy. All you have to do is tell them that 
> they are being
> attacked, and denounce the pacifists for a lack of patriotism 
> and exposing
> the country to danger. It works the same in every country." --Hermann
> Goering, Hitler's Reich Marshall at the Nuremberg Trials After WWII
> 
> Sound like G.W.Bush?
> 
> 
> 

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



RE: [PHP] Is it possible to restart Windows Apache (service) on a PHP script?

2007-10-22 Thread Daevid Vincent
What we do is setup 'sudo' to run certain commands (or a shell/ruby script
for example), then have PHP/Apache exec() the script via sudo (or use a DBUS
call to a 'root' enabled ruby daemon), which then restarts apache or
whatever we want.

Be VERY careful with the way you do this or you can give crackers all kinds
of ways to cause you pain.


For example:

[EMAIL PROTECTED]:/etc# cat /etc/sudoers
Cmnd_Alias CHMOD = /bin/chmod
Cmnd_Alias REBOOT = /sbin/reboot, /sbin/shutdown

rootALL=(ALL) ALL
www-dataALL=NOPASSWD: /bin/date, /sbin/hwclock,
REBOOT,  /usr/bin/dpkg, /usr/sbin/chpasswd,
/usr/bin/passwd, /usr/sbin/srvwatch,
/usr/sbin/srvtalk

Then in the PHP web page:

exec("/usr/bin/sudo /sbin/reboot");


D.Vin

"Voice or no voice, the people can alway be brought to the bidding of the
leaders. This is easy. All you have to do is tell them that they are being
attacked, and denounce the pacifists for a lack of patriotism and exposing
the country to danger. It works the same in every country." --Hermann
Goering, Hitler's Reich Marshall at the Nuremberg Trials After WWII

Sound like G.W.Bush?




Re: [PHP] problem with foreach

2007-10-22 Thread Greg Donald
On 10/22/07, Nathan Hawks <[EMAIL PROTECTED]> wrote:
> Also, AFAIK, PHP has always thrown a warning or notice if you use
> foreach() on a non-associative array.

PHP arrays are always associative:

> cat array.php
#!/usr/bin/env php
 ./array.php
Array
(
  [0] => 1
  [1] => 2
  [2] => 3
)
Array
(
  [0] => a
  [1] => b
  [2] => c
)
Array
(
  [0] => 1
  [1] => 2
  [2] => x
)


> That doesn't mean it won't work,
> but the strict standard is apparently:
>
> foreach ($assoc as $key => $val)
>
> not
>
> foreach ($indexed as $item)

What strict standard?  The manual shows either use being legal:

http://php.net/foreach

> However, as we all know, the latter still works fine.
>
> Despite the warning/notice you see, the code is probably still working
> as expected (any other problems aside).  If you like to keep error

What warning/notice?  What other problems?

> reporting on, you can just use an @ to suppress that error.

Errors should be handled not suppressed.


--
Greg Donald
http://destiney.com/

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



Re: [PHP] problem with foreach

2007-10-22 Thread Nathan Hawks
Also, AFAIK, PHP has always thrown a warning or notice if you use
foreach() on a non-associative array.  That doesn't mean it won't work,
but the strict standard is apparently:

foreach ($assoc as $key => $val)

not

foreach ($indexed as $item)

However, as we all know, the latter still works fine.

Despite the warning/notice you see, the code is probably still working
as expected (any other problems aside).  If you like to keep error
reporting on, you can just use an @ to suppress that error.

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



Re: [PHP] problem with foreach

2007-10-22 Thread Philip Thompson
On 10/22/07, Adam Williams <[EMAIL PROTECTED]> wrote:
>
> I have an html page with checkboxes:
>
> 
> Modern
> Mississippi


Change to: ...

Someone mentioned this earlier, but I thought I'd reiterate. I'm not sure
how the browser will deal with *arrays* that aren't quoted. It's very good
practice to explicitly tell what is what - don't let the browser interpret
as it wants to. (Side note: the / at the ends are for XHTML - they're
optional if only using HTML.)

~Philip


Re: [PHP] problem with foreach

2007-10-22 Thread Stut

Robert Cummings wrote:

On Mon, 2007-10-22 at 18:07 +0100, Stut wrote:

Adam Williams wrote:

I have an html page with checkboxes:


Modern 
Mississippi

Civil Rights
MilitaryHistory



and mailform2.php containing:

echo "you selected: ";
/* line 81 */ foreach ($_POST[option] as $a)
   {
   echo "$a";
   }

but I'm getting the error:

you selected:

*Warning*: Invalid argument supplied for foreach() in 
*/var/www/sites/mdah-test/museum/mmhsurvey/mailform2.php* on line *81*


I googled some checkbox/foreach pages on google, but I don't see where 
I'm going wrong.  I'm running php 5.2.5 on Apache 2.2.4 on Fedora 
Linux.  Any help?
Turn notices on. You will then get lots of notices about the use of an 
undefined constant "option".


You should be using $_POST['option'] instead - notice the quotes.

Your HTML should really have double quotes around the attributes but 
that's beyond the scope of this list.


He's still going to get an invalid argument warning though since PHP
will automatically convert the unquoted key to a string and then look up
the value. The problem is that the value doesn't exist or is not an
array as expected.


Good point. Has the OP checked any of the boxes? If not then that array 
will not exist in $_POST.


-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 foreach

2007-10-22 Thread Ludovic André

Adam Williams a écrit :

I have an html page with checkboxes:
[...]
but I'm getting the error:

you selected:

*Warning*: Invalid argument supplied for foreach() in 
*/var/www/sites/mdah-test/museum/mmhsurvey/mailform2.php* on line *81*


I googled some checkbox/foreach pages on google, but I don't see where 
I'm going wrong.  I'm running php 5.2.5 on Apache 2.2.4 on Fedora 
Linux.  Any help?


Simple question: did you check any of the boxes before submitting? If 
not, then it's the reason of this error...  The array does not appear in 
the posted variables as a not-checked checkbox is not submitted along.
But all the other comments of this thread are to be taken into account 
as well ( $_POST['option'], trying to print_r($_POST), ...)


Ludovic André

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



Re: [PHP] problem with foreach

2007-10-22 Thread Robert Cummings
On Mon, 2007-10-22 at 12:20 -0500, Adam Williams wrote:
> 
> Yeah, thats the problem I'm having for some reason.  When I do:
> 
> print_r($_POST['option']);
> 
> it prints nothing.

It's usually more informative to see everything that was posted so you
might have more of an idea what may have went wrong:

print_r( $_POST );

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



RE: [PHP] problem with foreach

2007-10-22 Thread Jay Blanchard
[snip]
print_r($_POST['option']);

it prints nothing.
[/snip]

Try resetting the array first, you may be at the end of the array;

reset($_POST);
print_r($_POST);

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



Re: [PHP] problem with foreach

2007-10-22 Thread Adam Williams



Robert Cummings wrote:

On Mon, 2007-10-22 at 18:07 +0100, Stut wrote:
  

Adam Williams wrote:


I have an html page with checkboxes:


Modern 
Mississippi

Civil Rights
MilitaryHistory



and mailform2.php containing:

echo "you selected: ";
/* line 81 */ foreach ($_POST[option] as $a)
   {
   echo "$a";
   }

but I'm getting the error:

you selected:

*Warning*: Invalid argument supplied for foreach() in 
*/var/www/sites/mdah-test/museum/mmhsurvey/mailform2.php* on line *81*


I googled some checkbox/foreach pages on google, but I don't see where 
I'm going wrong.  I'm running php 5.2.5 on Apache 2.2.4 on Fedora 
Linux.  Any help?
  
Turn notices on. You will then get lots of notices about the use of an 
undefined constant "option".


You should be using $_POST['option'] instead - notice the quotes.

Your HTML should really have double quotes around the attributes but 
that's beyond the scope of this list.



He's still going to get an invalid argument warning though since PHP
will automatically convert the unquoted key to a string and then look up
the value. The problem is that the value doesn't exist or is not an
array as expected.

Cheers,
Rob.
  


Yeah, thats the problem I'm having for some reason.  When I do:

print_r($_POST['option']);

it prints nothing.

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



Re: [PHP] problem with foreach

2007-10-22 Thread Robert Cummings
On Mon, 2007-10-22 at 18:07 +0100, Stut wrote:
> Adam Williams wrote:
> > I have an html page with checkboxes:
> > 
> > 
> > Modern 
> > Mississippi
> > Civil Rights
> > MilitaryHistory
> > 
> > 
> > and mailform2.php containing:
> > 
> > echo "you selected: ";
> > /* line 81 */ foreach ($_POST[option] as $a)
> >{
> >echo "$a";
> >}
> > 
> > but I'm getting the error:
> > 
> > you selected:
> > 
> > *Warning*: Invalid argument supplied for foreach() in 
> > */var/www/sites/mdah-test/museum/mmhsurvey/mailform2.php* on line *81*
> > 
> > I googled some checkbox/foreach pages on google, but I don't see where 
> > I'm going wrong.  I'm running php 5.2.5 on Apache 2.2.4 on Fedora 
> > Linux.  Any help?
> 
> Turn notices on. You will then get lots of notices about the use of an 
> undefined constant "option".
> 
> You should be using $_POST['option'] instead - notice the quotes.
> 
> Your HTML should really have double quotes around the attributes but 
> that's beyond the scope of this list.

He's still going to get an invalid argument warning though since PHP
will automatically convert the unquoted key to a string and then look up
the value. The problem is that the value doesn't exist or is not an
array as expected.

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



Re: [PHP] problem with foreach

2007-10-22 Thread Andrew Ballard
On 10/22/07, Adam Williams <[EMAIL PROTECTED]> wrote:
> I have an html page with checkboxes:
>
> 
> Modern
> Mississippi
> Civil Rights
> MilitaryHistory
> 
>
> and mailform2.php containing:
>
> echo "you selected: ";
> /* line 81 */ foreach ($_POST[option] as $a)
> {
> echo "$a";
> }
>
> but I'm getting the error:
>
> you selected:
>
> *Warning*: Invalid argument supplied for foreach() in
> */var/www/sites/mdah-test/museum/mmhsurvey/mailform2.php* on line *81*
>
> I googled some checkbox/foreach pages on google, but I don't see where
> I'm going wrong.  I'm running php 5.2.5 on Apache 2.2.4 on Fedora
> Linux.  Any help?

A couple changes:

echo "you selected: ";

// Check to see that the value exists. If no options are checked, this
will be false.
if (array_key_exists('option', $_POST)) {
// include the quotes as already mentioned
foreach ($_POST['option'] as $a)
{
echo $a;
}
} else {
   echo 'nothing';
}

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



Re: [PHP] problem with foreach

2007-10-22 Thread Stut

Adam Williams wrote:

I have an html page with checkboxes:


Modern 
Mississippi

Civil Rights
MilitaryHistory



and mailform2.php containing:

echo "you selected: ";
/* line 81 */ foreach ($_POST[option] as $a)
   {
   echo "$a";
   }

but I'm getting the error:

you selected:

*Warning*: Invalid argument supplied for foreach() in 
*/var/www/sites/mdah-test/museum/mmhsurvey/mailform2.php* on line *81*


I googled some checkbox/foreach pages on google, but I don't see where 
I'm going wrong.  I'm running php 5.2.5 on Apache 2.2.4 on Fedora 
Linux.  Any help?


Turn notices on. You will then get lots of notices about the use of an 
undefined constant "option".


You should be using $_POST['option'] instead - notice the quotes.

Your HTML should really have double quotes around the attributes but 
that's beyond the scope of this list.


-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 foreach

2007-10-22 Thread Jason Pruim


On Oct 22, 2007, at 1:01 PM, Adam Williams wrote:


I have an html page with checkboxes:


Modern Mississippi
Civil  
Rights
MilitaryHistory



and mailform2.php containing:

echo "you selected: ";
/* line 81 */ foreach ($_POST[option] as $a)
   {
   echo "$a";
   }

but I'm getting the error:

you selected:

*Warning*: Invalid argument supplied for foreach() in */var/www/ 
sites/mdah-test/museum/mmhsurvey/mailform2.php* on line *81*


I googled some checkbox/foreach pages on google, but I don't see  
where I'm going wrong.  I'm running php 5.2.5 on Apache 2.2.4 on  
Fedora Linux.  Any help?


Not sure if this would help or not but when ever I've done anything  
with $_POST variables or other array variables I have to specify it  
like $_POST['option'] notice the ' in around the word 'option'


Hope it helps!


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]

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



[PHP] problem with foreach

2007-10-22 Thread Adam Williams

I have an html page with checkboxes:


Modern 
Mississippi

Civil Rights
MilitaryHistory



and mailform2.php containing:

echo "you selected: ";
/* line 81 */ foreach ($_POST[option] as $a)
   {
   echo "$a";
   }

but I'm getting the error:

you selected:

*Warning*: Invalid argument supplied for foreach() in 
*/var/www/sites/mdah-test/museum/mmhsurvey/mailform2.php* on line *81*


I googled some checkbox/foreach pages on google, but I don't see where 
I'm going wrong.  I'm running php 5.2.5 on Apache 2.2.4 on Fedora 
Linux.  Any help?


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



[PHP] TLS transport for Windows

2007-10-22 Thread Matt Arnilo S. Baluyos (Mailing Lists)
Hi all,

I'm looking for a PHP environment for Windows (like XAMPP), that
already has TLS transport built-in.

Would anyone know of something like it? If not, any pointers on how to
get TLS transport for a PHP Windows environment?

Thanks,
Matt

-- 
Stand before it and there is no beginning.
Follow it and there is no end.
Stay with the ancient Tao,
Move with the present.

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



Re: [PHP] Securing PHP

2007-10-22 Thread Greg Donald
On 10/22/07, Philip Thompson <[EMAIL PROTECTED]> wrote:
> One resource: http://phpsec.org/

I find it very helpful to look at the actual exploits and understand
why they work:

http://www.securityfocus.com/swsearch?metaname=alldoc&query=php


-- 
Greg Donald
http://destiney.com/

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



Re: [PHP] Securing PHP

2007-10-22 Thread Philip Thompson
On 10/20/07, Grant <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> You've all likely heard this before"I was hacked..." , "Had register
> globals on..." etc etc.
>
> Well, this is true of me as well.
>
> Does anyone know of a site that would help a semi professional lock down
> php, i.e.
>
> Perhaps how to install phpsuexec,
>
> Jail users to only have the ability to read/write to thier own files and
> directories,
>
> php.ini directives that have simiar affect as mentioned above.
>
> Any help appreciated.
>
> -Grant



One resource: http://phpsec.org/

~Philip


[PHP] php suexec

2007-10-22 Thread Grant
Hi again all,

Has anyone on this had succees setting up php to use suexec?

If I am reading things right, it appears that php must be run as CGI and 
then it will use the built in (Apache2) suexec wrapper in the same fassion 
as perl does.

If the above is correct I am looking for a primer on how to set this all up.

TIA,

-Grant 

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



Re: [PHP] running Batch process using php

2007-10-22 Thread Ashley M. Kirchner

Javed Khan wrote:

Hello Everone,
 
I want to run a script in php which should execute at particular condition and if the condition is true then it will send out emails to the recipients.

Can anyone suggest how can I achieve this.
 
Thanx,
 
Javed
  


   Without spending a whole lot of brain cells at the moment, I'd say 
run it through a cron task (or 'at' task if you're on a Win32 platform).



--
W | It's not a bug - it's an undocumented feature.
 +
 Ashley M. Kirchner    .   303.442.6410 x130
 IT Director / SysAdmin / Websmith . 800.441.3873 x130
 Photo Craft Imaging   . 3550 Arapahoe Ave. #6
 http://www.pcraft.com . .  ..   Boulder, CO 80303, U.S.A. 


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



[PHP] running Batch process using php

2007-10-22 Thread Javed Khan
Hello Everone,
 
I want to run a script in php which should execute at particular condition and 
if the condition is true then it will send out emails to the recipients.
Can anyone suggest how can I achieve this.
 
Thanx,
 
Javed
_
Explore the seven wonders of the world
http://search.msn.com/results.aspx?q=7+wonders+world&mkt=en-US&form=QBRE

Re: [PHP] Is it possible to restart Windows Apache (service) on a PHP script?

2007-10-22 Thread Peter Ford
You could try using exec to set up an "AT" job with a short delay which will
then run 'net apache restart' - I'm not a total windows guru so I can't give you
the exact recipe...

Something like exec('AT 12:00 "net apache restart"');

Check the documentation on the AT command...

One possible extra advantage is that you could cancel the 'AT' job during the
delay period if you clicked restart by accident :)

Louie Miranda wrote:
> Thanks for your suggestions.
> 
> But, both did not worked.
> 
> Louie
> 
> On 10/19/07, Philip Thompson <[EMAIL PROTECTED]> wrote:
>> On 10/19/07, Robert Degen <[EMAIL PROTECTED]> wrote:
>>> Why don't you try a
>>>
>>>   passthru('net apache restart')
>>>
>>> perhabs another parameter order, but I think It won't work.
>>> Stopping it might work, but restarting...
>>>
>>>
>>>
>>> On Fr, Okt 19, 2007 at 04:32:45 +0800, Louie Miranda wrote:
 Is it possible to restart Windows Apache (service) on a PHP script?

 i have installed PHP/Apache on a Windows machine. Added the ext
>>> windows32
 service.
 But could not find any how to or information online.

 Please help!

 --
 Louie Miranda ([EMAIL PROTECTED])
>> This reminds me of the time I was remoting into a machine (using Altiris,
>> I
>> think) to do some work on it. I then needed to restart it... so I did.
>> Well,
>> class, what happens when you turn off Mr. Computer?
>>
>> Not saying that this is the same thing...  b/c if you push a "restart"
>> command, then it *should* come back up. =/ Sorry, I don't know the exact
>> command, but consider using exec().
>>
>> Good Luck,
>> ~Philip
>>
>> PS... Yay, it's Friday!
>>
> 
> 
> 

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



Re: [PHP] Re: Unsetting a header

2007-10-22 Thread Richard Heyes

Freyjkell wrote:

D Richard Heyes wrote:
Does anyone know of a way to unset a header? I have an Expires: header 
that I believe Apache is setting, and I don't want it. Thanks.


Do you really need to remove this header?


I do.

--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



[PHP] Re: Proposal of DOM non-standard method: DOMDocument::loadCharacterEntitiesFromDtd($path)

2007-10-22 Thread Rob

Freyjkell wrote:

DOMDocument::loadCharacterEntitiesFromDtd($path);

I like to load character entities (not whole document type definition).

When I try to do that by creating my own DTD with only character
entities, and setting resolveExternals to true, then DTD parser
complains that it didn't occur root definition.

The proposed method, if called before DOMDocument::load/loadXML(), would
get character entities from DTD (and its modules) and apply them during
parsing XML. If called multiply, or if XML contains a DTD reference,
entities put before would be overwritten.

// I sent this post to php.xml.dev, but I didn't get reply for long time.

A day or two is not a long time and some things are not cut and dry, 
requiring a little time to think about it. If you want to override the 
DTD, you should look at using catalogs or create a custom stream handler 
to alter the XML document as it is parsed.


Rob

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



[PHP] Re: Proposal of DOM boolean property: DOMDocument::omitXMLDeclaration

2007-10-22 Thread Rob

Freyjkell wrote:

(bool) DOMDocument::omitXMLDeclaration;

Does not need a comment. Implemented in XSLT.

// I sent this post to php.xml.dev, but I didn't get reply for long time.


parser option LIBXML_NOXMLDECL or if no DTD just save the root element.

Rob

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



[PHP] Proposal of DOM non-standard method: DOMDocument::loadCharacterEntitiesFromDtd($path)

2007-10-22 Thread Freyjkell

DOMDocument::loadCharacterEntitiesFromDtd($path);

I like to load character entities (not whole document type definition).

When I try to do that by creating my own DTD with only character
entities, and setting resolveExternals to true, then DTD parser
complains that it didn't occur root definition.

The proposed method, if called before DOMDocument::load/loadXML(), would
get character entities from DTD (and its modules) and apply them during
parsing XML. If called multiply, or if XML contains a DTD reference,
entities put before would be overwritten.

// I sent this post to php.xml.dev, but I didn't get reply for long time.

--
Freyjkell

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



[PHP] Proposal of DOM boolean property: DOMDocument::omitXMLDeclaration

2007-10-22 Thread Freyjkell

(bool) DOMDocument::omitXMLDeclaration;

Does not need a comment. Implemented in XSLT.

// I sent this post to php.xml.dev, but I didn't get reply for long time.

--
Freyjkell

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



[PHP] Re: Different size of file on server and on output

2007-10-22 Thread Colin Guthrie
M. Sokolewicz wrote:
> Pavel Janda wrote:
>> Hello to everybody,
>>
>> I have this problem with downloading files via PHP. For illustration -
>> I am using this fragment of code:
>>
>> >
>> header("Content-type: $contenttype; name=\"$outputfilename\"");
>> header("Content-disposition: form-data;
>> filename=\"$outputfilename\"");
>>
>> $fp=fopen($filename,'r');
>> while (!FEof($fp)):
>> $filedata.=fread($fp,8192);
>> endwhile;
>> fclose($fp);
>> echo $filedata;
>>
>> ?>
>>
>> The problem is, that the file on server has 16857 bytes and saved file
>> has 16858. In another case downloaded file has everytime 1 byte more
>> than the original file on server.
>>
>> When I put JPEG or ZIP forexample to output, there is no problem with
>> opening file like this. Bud when I am trying .docx (Office2007 file
>> format) it occures mistake during opening this file in MSOffice...
>>
>> Can anybody helps me with this problem? Why is the file size
>> increasing one byte? Whitch byte it is?
>>
>> Thanks a lot!
>> Pavel
> 
> Probably that whitespace after your last ?>
> What I would recommend is to just leave off the last ?>, it's not
> required and by not adding it you won't see those annoying problems with
> whitespaces causing corrupt data.

I agree.

Also a much simpler way of outputting a file that doesn't use up memory,
is just to replace:

 $fp=fopen($filename,'r');
 while (!FEof($fp)):
 $filedata.=fread($fp,8192);
 endwhile;
 fclose($fp);
 echo $filedata;


With:
 readfile($filename);


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

Col.

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



[PHP] Re: Unsetting a header

2007-10-22 Thread Freyjkell

D Richard Heyes wrote:
Does anyone know of a way to unset a header? I have an Expires: header 
that I believe Apache is setting, and I don't want it. Thanks.


Do you really need to remove this header?

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



[PHP] Re: Different size of file on server and on output

2007-10-22 Thread Pavel Janda
Thanks a lot. However there wasn't any visible whitespace in code, 
leaving of ?> helped... I haven't known, that it is not required :o).


Thank you very much again!
Pavel

M. Sokolewicz napsal(a):

Pavel Janda wrote:

Hello to everybody,

I have this problem with downloading files via PHP. For illustration - 
I am using this fragment of code:


header("Content-disposition: form-data; 
filename=\"$outputfilename\"");


$fp=fopen($filename,'r');
while (!FEof($fp)):
$filedata.=fread($fp,8192);
endwhile;
fclose($fp);
echo $filedata;

?>

The problem is, that the file on server has 16857 bytes and saved file 
has 16858. In another case downloaded file has everytime 1 byte more 
than the original file on server.


When I put JPEG or ZIP forexample to output, there is no problem with 
opening file like this. Bud when I am trying .docx (Office2007 file 
format) it occures mistake during opening this file in MSOffice...


Can anybody helps me with this problem? Why is the file size 
increasing one byte? Whitch byte it is?


Thanks a lot!
Pavel


Probably that whitespace after your last ?>
What I would recommend is to just leave off the last ?>, it's not 
required and by not adding it you won't see those annoying problems with 
whitespaces causing corrupt data.


- Tul


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



[PHP] Re: Different size of file on server and on output

2007-10-22 Thread M. Sokolewicz

Pavel Janda wrote:

Hello to everybody,

I have this problem with downloading files via PHP. For illustration - I 
am using this fragment of code:




The problem is, that the file on server has 16857 bytes and saved file 
has 16858. In another case downloaded file has everytime 1 byte more 
than the original file on server.


When I put JPEG or ZIP forexample to output, there is no problem with 
opening file like this. Bud when I am trying .docx (Office2007 file 
format) it occures mistake during opening this file in MSOffice...


Can anybody helps me with this problem? Why is the file size increasing 
one byte? Whitch byte it is?


Thanks a lot!
Pavel


Probably that whitespace after your last ?>
What I would recommend is to just leave off the last ?>, it's not 
required and by not adding it you won't see those annoying problems with 
whitespaces causing corrupt data.


- Tul

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



[PHP] Different size of file on server and on output

2007-10-22 Thread Pavel Janda

Hello to everybody,

I have this problem with downloading files via PHP. For illustration - I 
am using this fragment of code:




The problem is, that the file on server has 16857 bytes and saved file 
has 16858. In another case downloaded file has everytime 1 byte more 
than the original file on server.


When I put JPEG or ZIP forexample to output, there is no problem with 
opening file like this. Bud when I am trying .docx (Office2007 file 
format) it occures mistake during opening this file in MSOffice...


Can anybody helps me with this problem? Why is the file size increasing 
one byte? Whitch byte it is?


Thanks a lot!
Pavel

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



Re: [PHP] Unsetting a header

2007-10-22 Thread Richard Heyes

Richard Heyes wrote:
FWIW, I found what was setting the cache headers - sessions. I may be 
able to use session_cache_limiter(). Not Sure.


Further, I found this to be what I needed:

session_cache_limiter('private_no_expire');

Cheers.

--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Unsetting a header

2007-10-22 Thread Richard Heyes
FWIW, I found what was setting the cache headers - sessions. I may be 
able to use session_cache_limiter(). Not Sure.


--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Unsetting a header

2007-10-22 Thread Richard Heyes
Sorry, I didn't articulate what I meant very well. What I meant was that 
you know the churn rate of your pages, so put in sensible expiry headers 
based on that info.


Unfortunately I can't foresee when the pages are changed (it won't be me 
who changes them).


But the better way to solve it is to edit the Apache configuration to 
stop it putting the headers in in the first place. Why can't you do that?


I could. I just don't know how to unset a header.


--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Unsetting a header

2007-10-22 Thread Stut

Richard Heyes wrote:
I'm well-aware of what the headers are for, but you can construct 
expiry headers that match the last-modified header.


If I do that the Expiry: header will be in the past and the page will be 
considered expired.


Sorry, I didn't articulate what I meant very well. What I meant was that 
you know the churn rate of your pages, so put in sensible expiry headers 
based on that info.


But the better way to solve it is to edit the Apache configuration to 
stop it putting the headers in in the first place. Why can't you do that?


-Stut

--
http://stut.net/

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



Re: [PHP] Unsetting a header

2007-10-22 Thread Richard Heyes
I'm well-aware of what the headers are for, but you can construct expiry 
headers that match the last-modified header.


If I do that the Expiry: header will be in the past and the page will be 
considered expired.


--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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



Re: [PHP] Unsetting a header

2007-10-22 Thread Stut

Richard Heyes wrote:
Maybe I'm being dense, but why not set it to what you want it to be? 
Clearing it is leaving the decision up to the browser which will not 
necessarily have the effect you want for all users.


Incidentally, it might not be possible if Apache is setting it. Not 
sure if PHP has the ability to override headers being sent by Apache.


The two have different effects. The Expires: header proclaims that the 
page is good for x hours/minutes/days etc. Whereas the browser can use 
the Last-Modified header to figure the staleness for itself. If its 
newer than the copy it has, it needs to download the newer copy.


I'm well-aware of what the headers are for, but you can construct expiry 
headers that match the last-modified header. As I said I'm fairly 
certain you will not be able in PHP to remove a header added by Apache. 
Given that you can't get rid of it your best option is to set it to a 
value that will minimise its effect.


Why can't you modify the Apache configuration to prevent it from adding 
this header? If not in httpd.conf then in a .htaccess file. If your host 
won't let you do that, switch to someone who will.


-Stut

--
http://stut.net/

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



Re: [PHP] Unsetting a header

2007-10-22 Thread Richard Heyes
Maybe I'm being dense, but why not set it to what you want it to be? 
Clearing it is leaving the decision up to the browser which will not 
necessarily have the effect you want for all users.


Incidentally, it might not be possible if Apache is setting it. Not sure 
if PHP has the ability to override headers being sent by Apache.


The two have different effects. The Expires: header proclaims that the 
page is good for x hours/minutes/days etc. Whereas the browser can use 
the Last-Modified header to figure the staleness for itself. If its 
newer than the copy it has, it needs to download the newer copy.


--
Richard Heyes
+44 (0)800 0213 172
http://www.websupportsolutions.co.uk

Knowledge Base and HelpDesk software
that can cut the cost of online support

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