php-windows Digest 17 Jun 2008 15:58:51 -0000 Issue 3485

Topics (messages 28925 through 28928):

Re: mime_content_type remote file
        28925 by: Brereton, Stephen
        28926 by: charles.wroth.exeter.ox.ac.uk
        28927 by: Joris Willekens

PHP and MSSQL Connection on IIS 5.1
        28928 by: Wei, Alice J.

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
Personally, I've always coded the spaces into underscores and made sure
the file is saved as that.


-----Original Message-----
From: Joris Willekens [mailto:[EMAIL PROTECTED]
Sent: 05 June 2008 13:04
To: [EMAIL PROTECTED]
Subject: Re: [PHP-WIN] mime_content_type remote file


There is no problem when there are no spaces in the name.
I can't prevent spaces in the filename, is there a workaround?

""Brereton, Stephen"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

How about a file without any spaces in the name?

-----Original Message-----
From: Joris Willekens [mailto:[EMAIL PROTECTED]
Sent: 04 June 2008 15:30
To: [EMAIL PROTECTED]
Subject: Re: [PHP-WIN] mime_content_type remote file


Yes, but with the same result

""Brereton, Stephen"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

A 404 error only ever means the remote file cannot be found. Being as
you're swapping out the encoded spaces, I'd be inclined to start with
that as the possible cause - did you try the script with the encoding
still in place?

-----Original Message-----
From: Joris Willekens [mailto:[EMAIL PROTECTED]
Sent: 04 June 2008 13:18
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] mime_content_type remote file


Hello

I am using following to determine the mime_type of a remote file

 $filename = str_replace("%20", " ",$_GET["image"]);
 echo "Filetype: ". mime_content_type($filename) .
"\n\n\n\n\n\n\n<bR><br><br>";

When I view the link in browser, it's show ok. When i run the script, I
get following message:

Warning: mime_content_type(REMOTEURL/AMD AM2 X2.JPG)
[function.mime-content-type]: failed to open stream: HTTP request
failed! HTTP/1.1 404 Not Found

The remote file is on a Unix server, I know it's case sensitive.

Best Regards
Joris Willekens


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


* * * * * * * * * * * *
Help protect the environment - please don't print this email unless you
really need to.
* * * * * * * * * * * *

This communication is from City of York Council.

The information contained within, and in any attachment(s), is
confidential and legally privileged. It is for the exclusive use of the
intended recipient(s). If you are not the intended recipient(s), please
note that any form of distribution, copying or use of this
communication, or the information within, is strictly prohibited and may
be unlawful. Equally, you must not disclose all, or part, of its
contents to any other person.

If you have received this communication in error, please return it
immediately to the sender, then delete and destroy any copies of it.

City of York Council disclaims any liability for action taken in
reliance on the content of this communication.


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


* * * * * * * * * * * *
Help protect the environment - please don't print this email unless you
really need to.
* * * * * * * * * * * *

This communication is from City of York Council.

The information contained within, and in any attachment(s), is
confidential
and legally privileged. It is for the exclusive use of the intended
recipient(s). If you are not the intended recipient(s), please note that
any
form of distribution, copying or use of this communication, or the
information within, is strictly prohibited and may be unlawful. Equally,
you
must not disclose all, or part, of its contents to any other person.

If you have received this communication in error, please return it
immediately to the sender, then delete and destroy any copies of it.

City of York Council disclaims any liability for action taken in
reliance on
the content of this communication.


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


* * * * * * * * * * * *
Help protect the environment - please don't print this email unless you really 
need to.
* * * * * * * * * * * *

This communication is from City of York Council.

The information contained within, and in any attachment(s), is confidential and 
legally privileged. It is for the exclusive use of the intended recipient(s). 
If you are not the intended recipient(s), please note that any form of 
distribution, copying or use of this communication, or the information within, 
is strictly prohibited and may be unlawful. Equally, you must not disclose all, 
or part, of its contents to any other person.

If you have received this communication in error, please return it immediately 
to the sender, then delete and destroy any copies of it.

City of York Council disclaims any liability for action taken in reliance on 
the content of this communication.

--- End Message ---
--- Begin Message ---
I had trouble with spaces in pathnames.  I got round it by surrounding the 
whole pathname with quotes - an old Windows trick:

$s = "'" . $PHP_SELF . "'";  #surround with quotes to allow for spaces in 
pathname
   echo "<hr><br>
         <form action=$s method=post>" .        #use quotes
[ ...etc ]

Not sure if it applies in your case, but if not maybe it'll give you an idea.


On 5 Jun 2008 at 14:04, Joris Willekens wrote:

> There is no problem when there are no spaces in the name.
> I can't prevent spaces in the filename, is there a workaround?
> 
> ""Brereton, Stephen"" <[EMAIL PROTECTED]> wrote in message 
> news:[EMAIL PROTECTED]
> 
> How about a file without any spaces in the name?
> 
> -----Original Message-----
> From: Joris Willekens [mailto:[EMAIL PROTECTED]
> Sent: 04 June 2008 15:30
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-WIN] mime_content_type remote file
> 
> 
> Yes, but with the same result
> 
> ""Brereton, Stephen"" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> 
> A 404 error only ever means the remote file cannot be found. Being as
> you're swapping out the encoded spaces, I'd be inclined to start with
> that as the possible cause - did you try the script with the encoding
> still in place?
> 
> -----Original Message-----
> From: Joris Willekens [mailto:[EMAIL PROTECTED]
> Sent: 04 June 2008 13:18
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] mime_content_type remote file
> 
> 
> Hello
> 
> I am using following to determine the mime_type of a remote file
> 
>  $filename = str_replace("%20", " ",$_GET["image"]);
>  echo "Filetype: ". mime_content_type($filename) .
> "\n\n\n\n\n\n\n<bR><br><br>";
> 
> When I view the link in browser, it's show ok. When i run the script, I
> get following message:
> 
> Warning: mime_content_type(REMOTEURL/AMD AM2 X2.JPG)
> [function.mime-content-type]: failed to open stream: HTTP request
> failed! HTTP/1.1 404 Not Found
> 
> The remote file is on a Unix server, I know it's case sensitive.
> 
> Best Regards
> Joris Willekens
> 
> 
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> * * * * * * * * * * * *
> Help protect the environment - please don't print this email unless you
> really need to.
> * * * * * * * * * * * *
> 
> This communication is from City of York Council.
> 
> The information contained within, and in any attachment(s), is
> confidential
> and legally privileged. It is for the exclusive use of the intended
> recipient(s). If you are not the intended recipient(s), please note that
> any
> form of distribution, copying or use of this communication, or the
> information within, is strictly prohibited and may be unlawful. Equally,
> you
> must not disclose all, or part, of its contents to any other person.
> 
> If you have received this communication in error, please return it
> immediately to the sender, then delete and destroy any copies of it.
> 
> City of York Council disclaims any liability for action taken in
> reliance on
> the content of this communication.
> 
> 
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> * * * * * * * * * * * *
> Help protect the environment - please don't print this email unless you 
> really need to.
> * * * * * * * * * * * *
> 
> This communication is from City of York Council.
> 
> The information contained within, and in any attachment(s), is confidential 
> and legally privileged. It is for the exclusive use of the intended 
> recipient(s). If you are not the intended recipient(s), please note that any 
> form of distribution, copying or use of this communication, or the 
> information within, is strictly prohibited and may be unlawful. Equally, you 
> must not disclose all, or part, of its contents to any other person.
> 
> If you have received this communication in error, please return it 
> immediately to the sender, then delete and destroy any copies of it.
> 
> City of York Council disclaims any liability for action taken in reliance on 
> the content of this communication. 
> 
> 



--- End Message ---
--- Begin Message ---
Tx for the replies, I fixed the problem:

solution:
USE --> $filename = str_replace(" ", "%20",$_GET["image"]);
NOT --> $filename = str_replace("%20", " ",$_GET["image"]);

Best Regards


<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
I had trouble with spaces in pathnames.  I got round it by surrounding the
whole pathname with quotes - an old Windows trick:

$s = "'" . $PHP_SELF . "'";  #surround with quotes to allow for spaces in
pathname
  echo "<hr><br>
        <form action=$s method=post>" . #use quotes
[ ...etc ]

Not sure if it applies in your case, but if not maybe it'll give you an idea.


On 5 Jun 2008 at 14:04, Joris Willekens wrote:

There is no problem when there are no spaces in the name.
I can't prevent spaces in the filename, is there a workaround?

""Brereton, Stephen"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

How about a file without any spaces in the name?

-----Original Message-----
From: Joris Willekens [mailto:[EMAIL PROTECTED]
Sent: 04 June 2008 15:30
To: [EMAIL PROTECTED]
Subject: Re: [PHP-WIN] mime_content_type remote file


Yes, but with the same result

""Brereton, Stephen"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

A 404 error only ever means the remote file cannot be found. Being as
you're swapping out the encoded spaces, I'd be inclined to start with
that as the possible cause - did you try the script with the encoding
still in place?

-----Original Message-----
From: Joris Willekens [mailto:[EMAIL PROTECTED]
Sent: 04 June 2008 13:18
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] mime_content_type remote file


Hello

I am using following to determine the mime_type of a remote file

 $filename = str_replace("%20", " ",$_GET["image"]);
 echo "Filetype: ". mime_content_type($filename) .
"\n\n\n\n\n\n\n<bR><br><br>";

When I view the link in browser, it's show ok. When i run the script, I
get following message:

Warning: mime_content_type(REMOTEURL/AMD AM2 X2.JPG)
[function.mime-content-type]: failed to open stream: HTTP request
failed! HTTP/1.1 404 Not Found

The remote file is on a Unix server, I know it's case sensitive.

Best Regards
Joris Willekens


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


* * * * * * * * * * * *
Help protect the environment - please don't print this email unless you
really need to.
* * * * * * * * * * * *

This communication is from City of York Council.

The information contained within, and in any attachment(s), is
confidential
and legally privileged. It is for the exclusive use of the intended
recipient(s). If you are not the intended recipient(s), please note that
any
form of distribution, copying or use of this communication, or the
information within, is strictly prohibited and may be unlawful. Equally,
you
must not disclose all, or part, of its contents to any other person.

If you have received this communication in error, please return it
immediately to the sender, then delete and destroy any copies of it.

City of York Council disclaims any liability for action taken in
reliance on
the content of this communication.


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


* * * * * * * * * * * *
Help protect the environment - please don't print this email unless you
really need to.
* * * * * * * * * * * *

This communication is from City of York Council.

The information contained within, and in any attachment(s), is confidential
and legally privileged. It is for the exclusive use of the intended
recipient(s). If you are not the intended recipient(s), please note that any
form of distribution, copying or use of this communication, or the
information within, is strictly prohibited and may be unlawful. Equally, you
must not disclose all, or part, of its contents to any other person.

If you have received this communication in error, please return it
immediately to the sender, then delete and destroy any copies of it.

City of York Council disclaims any liability for action taken in reliance on
the content of this communication.






--- End Message ---
--- Begin Message ---
Hi, Guys:

  This is my first time running PHP 5.2 on a IIS 5.1 Server using a Windows XP 
machine.
  My client wants me to build the PHP scripts and the database on one single 
machine. So far I could run the PHP fine, but I am having a hard time 
connecting to the MSSQL database even though it is on one machine.

  I have created a freetds.conf file and have it set in the Windows directory 
in the following format:

 [global]
     host = 192.168.10.62
     port = 1433
     client charset = UTF-8
     tds version = 8.0
     text size = 20971520

I have then went into C:\Inetpub\wwwroot\test and built a index.php script, 
with my code as follows:

<html>
 <head>
  <title>PHP Test</title>
 </head>
 <body>
<?php
echo "<p>Hello!</p>";
$myServer = "global";
$myUser = "user";
$myPass = "password";
$myDB = "books";
// connection to the database
$dbhandle = mssql_connect($myServer, $myUser, $myPass)
or die("Couldn't connect to SQL Server on $myServer");
// select a database to work with
$selected = mssql_select_db($myDB, $dbhandle)
or die("Couldn't open database $myDB");
echo "You are connected to the " . $myDB . " database on the " . $myServer . 
".";
// close the connection
mssql_close($dbhandle);
?>
</body>
</html>

So far I only get this from the screen:

Hello!
Couldn't connect to SQL Server on global

Is there anything else I have missed? I have followed the prompts of installing 
FreeTDS according to http://docs.moodle.org/en/Installing_MSSQL_for_PHP, Would 
anyone say if I use something like ODBC would work better?

I welcome any suggestions.

Alice
======================================================
Alice Wei
MIS 2009
School of Library and Information Science
Indiana University Bloomington
[EMAIL PROTECTED]

--- End Message ---

Reply via email to