php-general Digest 19 Dec 2008 12:32:06 -0000 Issue 5854

Topics (messages 284810 through 284825):

Re: utf8 php howto?
        284810 by: Daniel Kolbo
        284818 by: Per Jessen

SimpleXML - issue with getting data out of the object returned
        284811 by: Dan Joseph
        284812 by: German Geek
        284813 by: Dan Joseph

If programming languages were religions
        284814 by: Michael Kubler

Re: CLI in background on windows
        284815 by: Ondrej Kulaty
        284816 by: Daniel Kolbo
        284817 by: Jason
        284819 by: Fanda

imagick raises error
        284820 by: vuthecuong
        284821 by: Jochem Maas

HTTP Error 500 - IsapiModule
        284822 by: Gary Maddock-Greene
        284823 by: David Robley
        284824 by: Stut

Re: IE8 and HTML5
        284825 by: Mark Weaver

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
Daniel Kolbo wrote:
Hello,

I have a text file encoded in utf-8.
i am using fopen/fgets/echo etc..

how do i display these utf8 characters from the file on the web?

I have tried different combinations of
header("Content-Type: text/html; charset=iso-8859-1");
header("Content-Type: text/html; charset=utf-8")
and
utf8_decode/utf8_encode functions

I can't seem to get the characters from the file to display as non-giberish on the web.

if i set the charset=utf8, and type the unique characters in directly to my document (hard coded) and save the document as utf8, then the characters display properly on the web.

examples:
1) save file as utf-8, web produces correct characters
<?php
header("Content-Type: text/html; charset=utf-8");
?>
<HTML><BODY>
[type special characters here using russian keyboard layout]
</BODY></HTML>

2) save file as ASCI, web produces [giberish]
<?php
header("Content-Type: text/html; charset=iso-8859-1");
?>
<HTML><BODY>
<?php
echo utf8_decode(fgets($handle));
?>
</BODY></HTML>

3) save file as utf-8, web produces [giberish]
<?php
header("Content-Type: text/html; charset=utf-8");
?>
<HTML><BODY>
<?php
echo fgets($handle));
?>
</BODY></HTML>

Thanks for your help,
dK


found a solution:

save the .php file as ASCII
<?php
header("Content-Type: text/html; charset=utf-8");
?>
<HTML><BODY>
<?php
$line_buff = fgets($handle));
echo echo mb_convert_encoding($line_buff, 'HTML-ENTITIES','UTF-8');
?>
</BODY></HTML>

thanks,
dK

--- End Message ---
--- Begin Message ---
Daniel Kolbo wrote:

> Hello,
> 
> I have a text file encoded in utf-8.
> i am using fopen/fgets/echo etc..
> 
> how do i display these utf8 characters from the file on the web?
> 

header("Content-Type: text/html; charset=utf-8")
readfile(your-utf8-file);


/Per Jessen, Zürich


--- End Message ---
--- Begin Message ---
Hi,

I have a basic XML document that I am grabbing with simplexml_load_string(),
here is the print_r:

SimpleXMLElement Object
(
    [Package] => SimpleXMLElement Object
        (
            [PackageID] => 804
            [PackageName] => Silver
            [BandwidthGB] => 20
            [WebStorageMB] => 5120
            [DBStorageMB] => 250
            [POPMailBoxes] => 50
            [WebStorageUnits] => 5
            [BandwidthUnits] => 1
            [DBStorageUnits] => 1
            [POPUnits] => 5
            [DomainHeaders] => 50
            [DBType] => MSSQL
            [OSType] => Windows
            [Enabled] => True
        )

    [Count] => 1
)

When I try and access $x->Package->PackageID I don't get 804, I get:

SimpleXMLElement Object
        (
            [0] => 804
        )

Could someone tell me how I just get the value 804 out of there?

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.

"Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life."

--- End Message ---
--- Begin Message ---
Tim-Hinnerk Heuer

http://www.ihostnz.com


On Fri, Dec 19, 2008 at 3:50 PM, Dan Joseph <dmjos...@gmail.com> wrote:

> Hi,
>
> I have a basic XML document that I am grabbing with
> simplexml_load_string(),
> here is the print_r:
>
> SimpleXMLElement Object
> (
>    [Package] => SimpleXMLElement Object
>        (
>            [PackageID] => 804
>            [PackageName] => Silver
>            [BandwidthGB] => 20
>            [WebStorageMB] => 5120
>            [DBStorageMB] => 250
>            [POPMailBoxes] => 50
>            [WebStorageUnits] => 5
>            [BandwidthUnits] => 1
>            [DBStorageUnits] => 1
>            [POPUnits] => 5
>            [DomainHeaders] => 50
>            [DBType] => MSSQL
>            [OSType] => Windows
>            [Enabled] => True
>        )
>
>    [Count] => 1
> )
>
> When I try and access $x->Package->PackageID I don't get 804, I get:
>
> SimpleXMLElement Object
>        (
>            [0] => 804
>        )
>
Had that problem before:
$val = (string) $x->Package->PackageID;
or
$val = (int) $x->Package->PackageID;

or whatever type you want. ;)

>
> Could someone tell me how I just get the value 804 out of there?
>
> --
> -Dan Joseph
>
> www.canishosting.com - Plans start @ $1.99/month.
>
> "Build a man a fire, and he will be warm for the rest of the day.
> Light a man on fire, and will be warm for the rest of his life."
>

--- End Message ---
--- Begin Message ---
On Thu, Dec 18, 2008 at 10:01 PM, German Geek <geek...@gmail.com> wrote:

> $val = (string) $x->Package->PackageID;
> or
> $val = (int) $x->Package->PackageID;
>
>
Ha... I would have never figured that out...  Thank you to you both!  That
did the trick.

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.

"Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life."

--- End Message ---
--- Begin Message ---
I thought it was interesting enough.

http://www.aegisub.net/2008/12/if-programming-languages-were-religions.html

--

Michael Kubler
*G*rey *P*hoenix *P*roductions <http://www.greyphoenix.biz>


--- End Message ---
--- Begin Message ---
What about to try run it as service? I don't know exactly how to do that but 
service programs run in background on my Win XP

""Fanda"" <d...@sidak.net> pí¹e v diskusním pøíspìvku 
news:7d.3d.09584.c2f7a...@pb1.pair.com...
> Hi,
> I am looking for some method, how to run php cli script on background in 
> windows. It should be started by windows task manager.
>
> Do you have any idea?
> Thans, Fanda
> 



--- End Message ---
--- Begin Message ---

Ondrej Kulaty wrote:
What about to try run it as service? I don't know exactly how to do that but service programs run in background on my Win XP

""Fanda"" <d...@sidak.net> pí¹e v diskusním pøíspìvku news:7d.3d.09584.c2f7a...@pb1.pair.com...
Hi,
I am looking for some method, how to run php cli script on background in windows. It should be started by windows task manager.

Do you have any idea?
Thans, Fanda


Just did a quick search:
http://www.tacktech.com/display.cfm?ttid=197
looking at other services, they have parameters so you could probably do this with php.exe
pretty cool idea...hmm...what can i do with this.
note: start->run:services.msc will open your services manager
hTh
dK

--- End Message ---
--- Begin Message ---
At 16:49 18/12/2008, you wrote:
Hi,
I am looking for some method, how to run php cli script on background in
windows. It should be started by windows task manager.

Run php-win.exe rather than php.exe, this will prevent the console window from opening whilst the task is running.

Schedule as normal using the Task Scheduler. We have several such tasks on our 2K3 SP2 server running this way. Should you need to debug, change the php-win.exe back to php.exe to see the console output.


Example commandlines:

d:\php\php-win.exe d:\phpcli\phpinfo.php

This will result in no output.

d:\php\php.exe d:\phpcli\phpinfo.php

Will result in a console window appearing and the phpinfo(); output printed, then the window will close.

HTH
J
--- End Message ---
--- Begin Message ---
"Jason" <networkad...@emarket2.com> píse v diskusním príspevku 
news:70.f5.09584.8465b...@pb1.pair.com...
> At 16:49 18/12/2008, you wrote:
>>Hi,
>>I am looking for some method, how to run php cli script on background in
>>windows. It should be started by windows task manager.
> 
> Run php-win.exe rather than php.exe, this will prevent the console 
> window from opening whilst the task is running.
> 
> Schedule as normal using the Task Scheduler. We have several such 
> tasks on our 2K3 SP2 server running this way. Should you need to 
> debug, change the php-win.exe back to php.exe to see the console output.
> 
> 
> Example commandlines:
> 
> d:\php\php-win.exe d:\phpcli\phpinfo.php
> 
> This will result in no output.
> 
> d:\php\php.exe d:\phpcli\phpinfo.php
> 
> Will result in a console window appearing and the phpinfo(); output 
> printed, then the window will close.
> 
> HTH
> J 
>

This looks it works. Great! That is what I was looking for. Thank you very much.

--- End Message ---
--- Begin Message ---
Hi,
Currently I'm reading below page:
http://www.imagemagick.org/Usage/api/#php
When I tried imagick example of it, php raised error about function :
Imagick::readimage() .
Fatal error: Non-static method Imagick::readimage() cannot be called
statically in /usr/local/www/apache22/data/php/im/imagick_hello.php on line
2

I don't know what is the cause. How can I solve this?
I'm running latest IM 6.4.7 with imagick 2.2.1, php 5.2.8 in Freebsd 7.0,
all built from ports.
Thanks and regards,
below is whole example of above site:

<?php
$handle = imagick_readimage( getcwd() . "image.jpg" );
if ( imagick_iserror( $handle ) ) {
$reason = imagick_failedreason( $handle ) ;
$description = imagick_faileddescription( $handle ) ;

print "Handle Read failed!<BR>\n";
print "Reason: $reason<BR>\n";
print "Description: $description<BR>\n";
exit ;
}
header( "Content-type: " . imagick_getmimetype( $handle ) );
print imagick_image2blob( $handle );
?> 
-- 
View this message in context: 
http://www.nabble.com/imagick-raises-error-tp21088873p21088873.html
Sent from the PHP - General mailing list archive at Nabble.com.


--- End Message ---
--- Begin Message ---
vuthecuong schreef:
> Hi,
> Currently I'm reading below page:
> http://www.imagemagick.org/Usage/api/#php
> When I tried imagick example of it, php raised error about function :
> Imagick::readimage() .
> Fatal error: Non-static method Imagick::readimage() cannot be called
> statically in /usr/local/www/apache22/data/php/im/imagick_hello.php on line
> 2

it looks like there was a functional interface as well as an OO interface
for imagick ... the functions themselves seem to live on but the underlying
extension only seems to work via OO interface.

the docs only describe an OO interface for imagick extension:

        http://php.net/manual/en/book.imagick.php


see the user notes on this page for an example on how to use the OO
interface:

        http://php.net/manual/en/function.imagick-readimage.php


> I don't know what is the cause. How can I solve this?
> I'm running latest IM 6.4.7 with imagick 2.2.1, php 5.2.8 in Freebsd 7.0,
> all built from ports.
> Thanks and regards,
> below is whole example of above site:
> 
> <?php
> $handle = imagick_readimage( getcwd() . "image.jpg" );
> if ( imagick_iserror( $handle ) ) {
> $reason = imagick_failedreason( $handle ) ;
> $description = imagick_faileddescription( $handle ) ;
> 
> print "Handle Read failed!<BR>\n";
> print "Reason: $reason<BR>\n";
> print "Description: $description<BR>\n";
> exit ;
> }
> header( "Content-type: " . imagick_getmimetype( $handle ) );
> print imagick_image2blob( $handle );
> ?> 


--- End Message ---
--- Begin Message --- Hi, Don't know if this is the right group but I am having real problems trying to connect to my MySQL db with php. I am trying to create a search form. I can connect and display in my browser a simple call to a db record but when I try to execute my search script I get a 500 Internal Server error: IsapiModule / ExecuterequestHandler. I'm stumped! Any help please or pointers. Thanks Gary
--- End Message ---
--- Begin Message ---
Gary Maddock-Greene wrote:

> Hi, Don't know if this is the right group but I am having real problems
> trying to connect to my MySQL db with php. I am trying to create a search
> form. I can connect and display in my browser a simple call to a db record
> but when I try to execute my search script I get a 500 Internal Server
> error: IsapiModule / ExecuterequestHandler. I'm stumped! Any help please
> or pointers. Thanks Gary

The first thing when you get a 500 error, which is a server error not php,
is to check the server error log.


Cheers
-- 
David Robley

The best defense against logic is stupidity.
Today is Pungenday, the 61st day of The Aftermath in the YOLD 3174. 


--- End Message ---
--- Begin Message ---
2008/12/19 David Robley <robl...@aapt.net.au>:
> Gary Maddock-Greene wrote:
>
>> Hi, Don't know if this is the right group but I am having real problems
>> trying to connect to my MySQL db with php. I am trying to create a search
>> form. I can connect and display in my browser a simple call to a db record
>> but when I try to execute my search script I get a 500 Internal Server
>> error: IsapiModule / ExecuterequestHandler. I'm stumped! Any help please
>> or pointers. Thanks Gary
>
> The first thing when you get a 500 error, which is a server error not php,
> is to check the server error log.

I might be wrong but I think syntax errors can cause a 500 status when
using ISAPI.

-Stuart

-- 
http://stut.net/

--- End Message ---
--- Begin Message ---
Richard Heyes wrote:
I have less issues
with Chrome and its beta

Not thrashing my HDD is also kinda basic, but Chrome 0.2 was more than
happy to do that.


Thrashing? That's not a bug... it's a feature and that thrashing was chrome indexing (read harvesting information) your hard drive.

Mark

--- End Message ---

Reply via email to