php-windows Digest 17 Apr 2001 20:39:39 -0000 Issue 549

Topics (messages 6780 through 6799):

hello
        6780 by: RJ

[Apache/1.3.19 (Win32) PHP/4.0.5RC1] gd
        6781 by: Christian Ribeaud

Xitami Config
        6782 by: Sean
        6784 by: Byrne, Gerald [euler:eti-lon]
        6785 by: Phil Driscoll
        6787 by: PHPWIN
        6796 by: Byrne, Gerald [euler:eti-lon]

How to write to a mapped drive with Anonymous Access turned off?
        6783 by: Paul Wieland

reading an image into a string
        6786 by: Ben Cairns
        6794 by: Mike Flynn

IIS5 PHP Fails
        6788 by: Shannon
        6792 by: Frank M. Kromann
        6793 by: Phil Driscoll
        6795 by: Panya Worawichawong
        6797 by: Joe Brown

mssql and php4
        6789 by: Kelvin Luck
        6790 by: Tomasz Abramowicz
        6791 by: Frank M. Kromann

eregi in an IF statement....
        6798 by: Asendorf, John

write into mysql DB
        6799 by: fipo2001

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]


----------------------------------------------------------------------


subscribe





Hi,

I downloaded and installed the php package including a lot of extensions
like pdf and gd from www.mm4.de.
I read the following article
(http://www.phpbuilder.com/columns/rasmus19990124.php3) and tried the
code (s. below). It did not work. I get an empty gif image and I do not
understand what I have missed. I did the following:
- I copy all extensions in the c:\winnt\system32 directory
- I modified the php.ini file and only set following extensions:
php_gd_gif.dll (without php_gd.dll because I got error messages telling
that some functions was twice loaded), php_pdf.dll (for pdf, works
wunderfull)
- I put ARIAL.TTF in a web subdirectory: fonts
I would be very grateful if someone could help me.

christian
------------------------------ code -------------------------------
Header("Content-type: image/gif");
$font = "fonts/ARIAL.TTF";
echo imageloadfont($font);
if(!isset($s)) $s=11;
$size = imagettfbbox($s,0,"$font",$text);
$dx = abs($size[2]-$size[0]);
$dy = abs($size[5]-$size[3]);
$xpad=9;
$ypad=9;
$im = imagecreate($dx+$xpad,$dy+$ypad);
$blue = ImageColorAllocate($im, 0x2c,0x6D,0xAF);
$black = ImageColorAllocate($im, 0,0,0);
$white = ImageColorAllocate($im, 255,255,255);
ImageRectangle($im,0,0,$dx+$xpad-1,$dy+$ypad-1,$black);
ImageRectangle($im,0,0,$dx+$xpad,$dy+$ypad,$white);
ImageTTFText($im, $s, 0, (int)($xpad/2)+1, $dy+(int)($ypad/2), $black,
"$font", $text);
ImageTTFText($im, $s, 0, (int)($xpad/2), $dy+(int)($ypad/2)-1, $white,
"$font", $text);
ImageGif($im);
ImageDestroy($im);
------------------------------ code -------------------------------





Hiya
   anyone know how to configure php with Xitami on win98?
Cheers




Sean,

This is nice and easy.  Here's the instructions copied from the Xitami FAQ.

20: How do I add support for PHP3? 
To install PHP3 support, add an entry to the [Filter] section of the config
files, e.g. 
[Filter]
  .php=c:\php3\php3.exe


The config file is defaults.cfg found in your Xitami folder (eg.
C:Xitami\defaults.cfg).

Further info can be found in the xitam.cfg folder.

So much easier than Micorsot PWS.

  Ged.

> -----Original Message-----
> From: Sean [SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, April 17, 2001 6:32 AM
> To:   [EMAIL PROTECTED]
> Subject:      [PHP-WIN] Xitami Config
> 
> Hiya
>    anyone know how to configure php with Xitami on win98?
> Cheers




...or easier still, run the php installer and it will configure xitami for
you.
--
Phil Driscoll
Dial Solutions
+44 (0)113 294 5112
http://www.dialsolutions.com
http://www.dtonline.org







> CHeers guys , Idone that already but it doesn't seem to work, I use some
> othe directory and php4, it couldn't be the reason? I've got php running
on
> other servers, just want to  see how easy is easy...
>
>It hasn't got anything to do with changing the way scripts are called now
> issit?
>
>
> ----- Original Message -----
> From: "Byrne, Gerald [euler:eti-lon]" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, April 17, 2001 9:32 PM
> Subject: RE: [PHP-WIN] Xitami Config
>
>
> > Sean,
> >
> > This is nice and easy.  Here's the instructions copied from the Xitami
> FAQ.
> >
> > 20: How do I add support for PHP3?
> > To install PHP3 support, add an entry to the [Filter] section of the
> config
> > files, e.g.
> > [Filter]
> >   .php=c:\php3\php3.exe
> >
> >
> > The config file is defaults.cfg found in your Xitami folder (eg.
> > C:Xitami\defaults.cfg).
> >
> > Further info can be found in the xitam.cfg folder.
> >
> > So much easier than Micorsot PWS.
> >
> >   Ged.
> >
> > > -----Original Message-----
> > > From: Sean [SMTP:[EMAIL PROTECTED]]
> > > Sent: Tuesday, April 17, 2001 6:32 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: [PHP-WIN] Xitami Config
> > >
> > > Hiya
> > >    anyone know how to configure php with Xitami on win98?
> > > Cheers
> >
>




Could you answer me some questions:

what folder is PHP.exe installed in?
What folder is xitami installed in?
How does the [filter] section in default.cfg read?
How does the [filter] section in xitami.cfg read?

I'm the problem should be discernable from these questions.

  Ged.


> -----Original Message-----
> From: PHPWIN [SMTP:[EMAIL PROTECTED]]
> Sent: Tuesday, April 17, 2001 9:36 AM
> To:   [EMAIL PROTECTED]
> Subject:      Fw: [PHP-WIN] Xitami Config
> 
> 
> 
> > CHeers guys , Idone that already but it doesn't seem to work, I use some
> > othe directory and php4, it couldn't be the reason? I've got php running
> on
> > other servers, just want to  see how easy is easy...
> >
> >It hasn't got anything to do with changing the way scripts are called now
> > issit?
> >
> >
> > ----- Original Message -----
> > From: "Byrne, Gerald [euler:eti-lon]" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Tuesday, April 17, 2001 9:32 PM
> > Subject: RE: [PHP-WIN] Xitami Config
> >
> >
> > > Sean,
> > >
> > > This is nice and easy.  Here's the instructions copied from the Xitami
> > FAQ.
> > >
> > > 20: How do I add support for PHP3?
> > > To install PHP3 support, add an entry to the [Filter] section of the
> > config
> > > files, e.g.
> > > [Filter]
> > >   .php=c:\php3\php3.exe
> > >
> > >
> > > The config file is defaults.cfg found in your Xitami folder (eg.
> > > C:Xitami\defaults.cfg).
> > >
> > > Further info can be found in the xitam.cfg folder.
> > >
> > > So much easier than Micorsot PWS.
> > >
> > >   Ged.
> > >
> > > > -----Original Message-----
> > > > From: Sean [SMTP:[EMAIL PROTECTED]]
> > > > Sent: Tuesday, April 17, 2001 6:32 AM
> > > > To: [EMAIL PROTECTED]
> > > > Subject: [PHP-WIN] Xitami Config
> > > >
> > > > Hiya
> > > >    anyone know how to configure php with Xitami on win98?
> > > > Cheers
> > >
> >
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]




Is it possible to have a script write to a mapped drive when Anonymous
Access is turned off in IIS? I'm trying to get a script on the web server
to move an http-uploaded file to a directory on the file server. I need to
have Anonymous Access turned off so the $REMOTE_USER environment variable
is present.
Thanks in advance for any help.

-Paul Wieland





I need to open an image and convert its binary type to hex,

what I need to do is a bin2hex on the binary info of the image, sounds simple 
enough. Although, I can get php to open the image and read the (binary) 
contents into a string, can someone help me.

Thanks.


-- Ben Cairns - Head Of Technical Operations
intasept.COM
Tel: 01332 365333
Fax: 01332 346010
E-Mail: [EMAIL PROTECTED]
Web: http://www.intasept.com

"MAKING sense of
the INFORMATION
TECHNOLOGY age
@ WORK......"





Hi Ben,

I think you need to clarify this.  An image is composed of all kinds of 
data, depending on the type of image it is.  Things like header 
information, version #, color palettes, and other info related to the image 
but not actually part of the image itself are included in the binary file 
along with the image data itself.  You can't just "convert" the image 
portion of an image file to hex without knowing something about the 
internal layout of the binary data.

I assume what you mean here is if you have an image all of one color you'd 
like to get the hex code for that color.  So, as I said above, it's not so 
easy as just going in and picking a pixel and getting its color.  You have 
to know something about the image format's image representation.

Otherwise, I suspect that the GD library may have a function to get the 
color of a particular pixel whose location (x,y) you specify, though I 
don't know the function's name off-hand.  You might want to look thru the 
GD documentation.

At 04:09 PM 4/17/01 +0100, you wrote:
>I need to open an image and convert its binary type to hex,
>
>what I need to do is a bin2hex on the binary info of the image, sounds simple
>enough. Although, I can get php to open the image and read the (binary)
>contents into a string, can someone help me.
>
>Thanks.

            -=- Mike Flynn - Burlington, VT -=-
[EMAIL PROTECTED]  http://www.mikeflynn.net/  * Give blood *
  Born to see two thousand years
  Of man's effect upon the planet          [Killing Joke]
  Extinction seems to be a plausible risk





Windows 2000 Pro
In installed the IIS5 version of PHP 4 according to the installation
directions.  However, PHP content pages return a 500 error when executed.

I copied the required DLLs into the the windows/system32 diretory.  I have
started and stopped (using the full start and stop method).

When I access the page hello.php, I get a 500 error.  Any hints?







You do not need to have any PHP files in winnt\system32.

On my system I have all php files in c:\php4 and I have php.ini in c:\winnt.

I have created script mappings connecting the .php extension with c:\php4\php.exe or 
c:\php4\php4isapi.dll

This way it is easy to update and maintain, and I can even have different versions of 
php4 (CGI)installed on the same system (ie in php-4.0.5)

- Frank

> Windows 2000 Pro
> In installed the IIS5 version of PHP 4 according to the installation
> directions.  However, PHP content pages return a 500 error when executed.
> 
> I copied the required DLLs into the the windows/system32 diretory.  I have
> started and stopped (using the full start and stop method).
> 
> When I access the page hello.php, I get a 500 error.  Any hints?
> 
> 
> 
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 
> 







>When I access the page hello.php, I get a 500 error.  Any hints?
Change your installation from isapi to cgi (change scriptmap from
php4isapi.dll to php.exe and remove php from your list of isapi filters.

Cheers
--
Phil Driscoll
Dial Solutions
+44 (0)113 294 5112
http://www.dialsolutions.com
http://www.dtonline.org





also, it's always a good idea to do <? phpinfo(); ?> before
you do any other scripts.

-panya

-----Original Message-----
From: Frank M. Kromann [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 17, 2001 10:57 PM
To: Shannon
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-WIN] IIS5 PHP Fails


You do not need to have any PHP files in winnt\system32.

On my system I have all php files in c:\php4 and I have
php.ini in c:\winnt.

I have created script mappings connecting the .php extension
with c:\php4\php.exe or c:\php4\php4isapi.dll

This way it is easy to update and maintain, and I can even
have different versions of php4 (CGI)installed on the same
system (ie in php-4.0.5)

- Frank

> Windows 2000 Pro
> In installed the IIS5 version of PHP 4 according to the
installation
> directions.  However, PHP content pages return a 500 error
when executed.
>
> I copied the required DLLs into the the windows/system32
diretory.  I have
> started and stopped (using the full start and stop
method).
>
> When I access the page hello.php, I get a 500 error.  Any
hints?
>
>
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail:
[EMAIL PROTECTED]
> For additional commands, e-mail:
[EMAIL PROTECTED]
> To contact the list administrators, e-mail:
[EMAIL PROTECTED]
>
>
>




--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail:
[EMAIL PROTECTED]
For additional commands, e-mail:
[EMAIL PROTECTED]
To contact the list administrators, e-mail:
[EMAIL PROTECTED]






Or better yet, download and install Apache!

I got bit w/iis4 and shutdown startup not working <reboot>...

Am now using php4apache.dll instead of the cgi on a production server now.

>8^O

""Phil Driscoll"" <[EMAIL PROTECTED]> wrote in message
009001c0c76a$3a4d2910$0c01a8c0@philsntserver">news:009001c0c76a$3a4d2910$0c01a8c0@philsntserver...
> >When I access the page hello.php, I get a 500 error.  Any hints?
> Change your installation from isapi to cgi (change scriptmap from
> php4isapi.dll to php.exe and remove php from your list of isapi filters.
>
> Cheers
> --
> Phil Driscoll
> Dial Solutions
> +44 (0)113 294 5112
> http://www.dialsolutions.com
> http://www.dtonline.org
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>






Hi,
I am just starting out with php and have managed to get it running OK on my
machine (Win2K) and connecting to an MSSQL 7 database on another machine (on
my LAN). However, it seems to run really slowly when accessing the database.
It takes around 6 seconds for my simple page to appear... At first I thought
that it was because I was running IIS so I tried installing Apache and using
that. It is no quicker.
Pages that don't contain connections to the database appear much faster. I
am using the mssql functions. So for example my script might look something
like this:

$connection = mssql_pconnect($databaseServer, $databaseUsername,
$databasePassword) or die("ERROR CONNECTING TO DATABASE");
$database = mssql_select_db($databaseName);
$getArticles = mssql_query($getArticlesSQL) or die("ERROR EXECUTING SQL");
while($getArticlesResult = mssql_fetch_row($getArticles){
    $articleID = $getArticlesResult[0];
    $date = $getArticlesResult[1];
    $title = $getArticlesResult[2];
    $introText = $getArticlesResult[3];
    echo $articleID . $date . $title . $introText . "<br>
}

Is there a faster way to do this? As far as I can see in the docs this is
the most efficient way to get a result set and loop through it. Or are the
connections to a MSSQL database just slow from PHP?
Thanks in advance for any help anyone can give me,
Kelvin.





hihi, mssql = sux
check out www.mysql.com
(or you maybe a really big bubu in your DB structure)


> Hi,
> I am just starting out with php and have managed to get it running OK on
my
> machine (Win2K) and connecting to an MSSQL 7 database on another machine
(on
> my LAN). However, it seems to run really slowly when accessing the
database.
> It takes around 6 seconds for my simple page to appear... At first I
thought
> that it was because I was running IIS so I tried installing Apache and
using
> that. It is no quicker.
> Pages that don't contain connections to the database appear much faster. I
> am using the mssql functions. So for example my script might look
something
> like this:
>
> $connection = mssql_pconnect($databaseServer, $databaseUsername,
> $databasePassword) or die("ERROR CONNECTING TO DATABASE");
> $database = mssql_select_db($databaseName);
> $getArticles = mssql_query($getArticlesSQL) or die("ERROR EXECUTING SQL");
> while($getArticlesResult = mssql_fetch_row($getArticles){
>     $articleID = $getArticlesResult[0];
>     $date = $getArticlesResult[1];
>     $title = $getArticlesResult[2];
>     $introText = $getArticlesResult[3];
>     echo $articleID . $date . $title . $introText . "<br>
> }
>
> Is there a faster way to do this? As far as I can see in the docs this is
> the most efficient way to get a result set and loop through it. Or are the
> connections to a MSSQL database just slow from PHP?
> Thanks in advance for any help anyone can give me,
> Kelvin.
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>





MSSQL is actually as fast (or faster) as mysql on the same hardware, but I guess you 
can compare the two and get the results you want. On the other hand that is not the 
issue !

When you are configuring MSSQL systems with server and client on two different 
computers you should consider using TCP/IP as the communication protocol. You do this 
by selecting TCP/IP as the default protocol in the "Client Network Utility" or by 
adding a new client configuration using TCP/IP in the same tool.

Another performence problem could also be DNS. You could configure the sytem to use a 
fixed IP address (you do that in "Client Network Utility" too)

- Frank

> hihi, mssql = sux
> check out www.mysql.com
> (or you maybe a really big bubu in your DB structure)
> 
> 
> > Hi,
> > I am just starting out with php and have managed to get it running OK on
> my
> > machine (Win2K) and connecting to an MSSQL 7 database on another machine
> (on
> > my LAN). However, it seems to run really slowly when accessing the
> database.
> > It takes around 6 seconds for my simple page to appear... At first I
> thought
> > that it was because I was running IIS so I tried installing Apache and
> using
> > that. It is no quicker.
> > Pages that don't contain connections to the database appear much faster. I
> > am using the mssql functions. So for example my script might look
> something
> > like this:
> >
> > $connection = mssql_pconnect($databaseServer, $databaseUsername,
> > $databasePassword) or die("ERROR CONNECTING TO DATABASE");
> > $database = mssql_select_db($databaseName);
> > $getArticles = mssql_query($getArticlesSQL) or die("ERROR EXECUTING SQL");
> > while($getArticlesResult = mssql_fetch_row($getArticles){
> >     $articleID = $getArticlesResult[0];
> >     $date = $getArticlesResult[1];
> >     $title = $getArticlesResult[2];
> >     $introText = $getArticlesResult[3];
> >     echo $articleID . $date . $title . $introText . "<br>
> > }
> >
> > Is there a faster way to do this? As far as I can see in the docs this is
> > the most efficient way to get a result set and loop through it. Or are the
> > connections to a MSSQL database just slow from PHP?
> > Thanks in advance for any help anyone can give me,
> > Kelvin.
> >
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
> 
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 
> 
> 







I'm attempting to fix a little flaw that I have.

I have a legacy database which has a mix of 10 and 7 digit phone numbers in
it.

I first designed the function format_phone with this (under the assumption
of 10 digit phone numbers):

function format_phone ( $phone ) {

    $phone = eregi_replace ( "([0-9]{3,3})([0-9]{3,3})([0-9]{4,4})", "(\\1)
\\2-\\3" , $phone );
    return $phone;
}


It worked just fine...

But when I switched to the code below, it doesn't work with any of the
numbers, they all come back as not recognized.


if ( eregi ( "([0-9]{3,3})([0-9]{3,3})([0-9]{4,4}))" , $phone , $edit ) ) {
//10 digits
   $phone = "(" . $edit[1] . ") " . $edit[2] . "-" . $edit[3];
}
        
elseif ( eregi ( "([0-9]{3,3})([0-9]{4,4}))" , $phone , $edit ) ) {
//7 digits
   $phone = $edit[1] . "-" . $edit[2];
}

else { echo "phone not recognized"; }


Any suggestions?

John
        

---------------------
John Asendorf - [EMAIL PROTECTED]
Web Applications Developer
http://www.lcounty.com - NEW FEATURES ADDED DAILY!
Licking County, Ohio, USA
740-349-3631
Aliquando et insanire iucundum est





I need to write in mysql database from an e-mail form in php format.

This is the table in my MySql db:

CREATE TABLE contact (
   cod int(11) NOT NULL auto_increment,
   Firstname varchar(50) NOT NULL,
   Lastname varchar(50) NOT NULL,
   Email varchar(50) NOT NULL,
   subject varchar(50) NOT NULL,
   Memo text NOT NULL,
   PRIMARY KEY (cod),
);

Could you tell me the PHP code for to write into it from my action-form PHP
file ?
Thanks a lot
Jon




Reply via email to