php-windows Digest 10 Feb 2005 10:21:01 -0000 Issue 2569

Topics (messages 25547 through 25551):

Re: PHP in IIS 6
        25547 by: Gilbert, Mark

$_SERVER['PHP_SELF']
        25548 by: Patrick Roane
        25549 by: Zareef Ahmed

PHP Development Environments
        25550 by: Darren Linsley
        25551 by: Irvin Piraman

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 ---
First log into IIS and click on the folder "Web Service Extensions". You
will see a list of "Web Service Extensions" on the right hand side. If you
are not familiar with them then right click one of them and click on
"properties". You will need to add that file to one of the "Web Service
Extensions". If you do not want to add it to one of the existing extensions
the create a new "Web Service Extension".

Next you should right click the file itself and the check the security
settings of the actual file.

That should solve it for you.

In Him
Mark Gilbert
 
2 Peter 1:2 Grace and peace be multiplied unto you through the knowledge of
God, and of Jesus our Lord.
 

-----Original Message-----
From: Jason Beaver [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 09, 2005 12:25 PM
To: [email protected]
Subject: PHP in IIS 6

I'm running PHP 4.3.1 on a windows 2k3 server. I have a script that used to 
work on my 2k server using CGI. When I use the ISAPI method under my 2k3 
server the scrip appears to work fine but when it gets to a system() command

it doesn't do it for some reason.
Under the CGI method it gives me the  "The specified CGI application 
misbehaved by not returning a complete set of HTTP headers." error.
What the script does is it takes some data out of a database then formats it

into a print file called "prnfile" then I use "system('type prnfile > lpt4',

$result);" the result I get is "1". I have tried other commands in there in 
the troubleshooting process I tried "dir" and it actually give me the 
directory listing of the working folder so it appears that my code is 
getting processed. I tried "echo test > test.txt" and that did not work. 
This leads me to believe that the issue is with permissions, only I can't 
figure out what it wants. I have tried giving IUSR full permissions on the 
web folder, php folder, and cmd.exe, I have also tried giving write 
permissions in IIS to the web site.
With both methods it does create the "prnfile".

anyone have any ideas if you need any more info let me know

--- End Message ---
--- Begin Message ---
I'm trying to execute my php code from w/in the same
page as my form. I've done this before, but recently
i've been getting some parse errors.

Is there a certain way of writing the following so it
works with my form?

For example, do I use:

action="<?php print $_SERVER['PHP_SELF']?>

or,

action="{' . $_SERVER['PHP_SELF'] . '}">

Currently, the error I get is:

Parse error: syntax error, unexpected '<' in
c:\wamp\www\php_excercises\grabfile.php on line 13

My code is below:

<form enctype="multipart/form-data"
name="frmUploadFile" action="<?PHP echo $me;?>"> 
 

<?php
   <form method="post" action="<?php print
$_SERVER['PHP_SELF']?>">
   /*   action="{' . $_SERVER['PHP_SELF'] . '}">   */
   
?>

<a href="http://www.devarticles.com";>

<img border="0"
src="http://www.devarticles.com/dlogo.gif";>

</a>

<table border="0" cellpadding="0" cellspacing="0"
bordercolor="#111111" width="100%">

<tr>

<td width="100%" bgcolor="#FF9900" height="22"
colspan="2">

<p style="margin-left: 10"><b><font face="Verdana"
size="2" color="#FFFFFF">

Upload a File</font></b></td>

</tr>

<tr>

<td width="100%" bgcolor="#FFE3BB" colspan="2">

<p style="margin-left: 10; margin-right: 10"><font
face="Verdana" size="2">

<br>Please select a file from your local computer to
upload to our web server

for saving in our database. This file can be of any
type you like. Once you

have chosen a file, please click on the &quot;Upload
this file&quot; button below.&nbsp;

&nbsp;<br>&nbsp;</font></td>

</tr>

<tr>

<td width="15%" bgcolor="#FFE3BB">

<p style="margin-left: 10"><font face="Verdana"
size="2">

File Description:</font></td>

<td width="85%" bgcolor="#FFE3BB">

<input type="text" name="strDesc" size="20"
maxlength="50"></td>

</tr>

<tr>

<td width="15%" bgcolor="#FFE3BB">

<p style="margin-left: 10"><font face="Verdana"
size="2">File Location:</font></td>

<td width="85%" bgcolor="#FFE3BB">

<font face="Verdana" size="2">

<input type="file" name="fileUpload"
size="20"></font></td>

</tr>

<tr>

<td width="33%" bgcolor="#FFE3BB">

<p style="margin-left: 10"><font face="Verdana"
size="2">

<br>

<br>

&nbsp;</font></td>

<td width="67%" bgcolor="#FFE3BB">

<font face="Verdana" size="2">

<input type="submit" value="Upload this file"
name="cmdSubmit"></font></td>

</tr>

</table>

</form>

<?php
} else {
// GrabFile.php: Takes the details

// of the new file posted as part

// of the form and adds it to the

// myBlobs table of our myFiles DB.



global $strDesc;

global $fileUpload;

global $fileUpload_name;

global $fileUpload_size;

global $fileUpload_type;

// Make sure both a description and

// file have been entered

if(empty($strDesc) || $fileUpload == "none")

die("You must enter both a description and file");

// Database connection variables

$dbServer = "localhost";

$dbDatabase = "myFiles";

$dbUser = "";

$dbPass = "";

$fileHandle = fopen($fileUpload, "r");

$fileContent = fread($fileHandle, $fileUpload_size);

$fileContent = addslashes($fileContent);

$sConn = mysql_connect($dbServer, $dbUser, $dbPass)

or die("Couldn't connect to database server"); 

$dConn = mysql_select_db($dbDatabase, $sConn)

or die("Couldn't connect to database $dbDatabase");

$dbQuery = "INSERT INTO myBlobs VALUES ";

$dbQuery .= "(0, '$strDesc', '$fileContent',
'$fileUpload_type')";



mysql_query($dbQuery) or die("Couldn't add file to
database");

echo "<h1>File Uploaded</h1>";

echo "The details of the uploaded file are shown
below:<br><br>";

echo "<b>File name:</b> $fileUpload_name <br>";

echo "<b>File type:</b> $fileUpload_type <br>";

echo "<b>File size:</b> $fileUpload_size <br>";

echo "<b>Uploaded to:</b> $fileUpload <br><br>";

echo "<a href='uploadfile.php'>Add Another File</a>";

?>
</body>

</html>

=====
Patrick Roane
Web design and development
www.franklin-band.com
Fox River Grove, Il.

--- End Message ---
--- Begin Message ---
On Wed, 9 Feb 2005 17:21:03 -0800 (PST), Patrick Roane
<[EMAIL PROTECTED]> wrote:
> I'm trying to execute my php code from w/in the same
> page as my form. I've done this before, but recently
> i've been getting some parse errors.
> 
> Is there a certain way of writing the following so it
> works with my form?
> 
> For example, do I use:
> 
> action="<?php print $_SERVER['PHP_SELF']?>
> 
> or,
> 
> action="{' . $_SERVER['PHP_SELF'] . '}">
> 
> Currently, the error I get is:
> 
> Parse error: syntax error, unexpected '<' in
> c:\wamp\www\php_excercises\grabfile.php on line 13
> 
> My code is below:
> 
> <form enctype="multipart/form-data"
> name="frmUploadFile" action="<?PHP echo $me;?>">
> 
Error lies in these lines

> <?php
Your  PHP tag is start.
>    <form method="post" action="<?php print
but you write a normal html without a print or echo.
> $_SERVER['PHP_SELF']?>">
>    /*   action="{' . $_SERVER['PHP_SELF'] . '}">   */
> 
> ?>

it must be like this 
<?php
print "<form method='post' action='{$_SERVER['PHP_SELF']}'>";
 ?>

or 

print "<form method='post' action='"; // Note single quotes before
closing double quotes.
print $_SERVER['PHP_SELF'];
print "'>";

Remember once you have started a PHP tag you must use php things only .
Even if you want to write HTML then include it in  print or echo statements.

Zareef Ahmed 





> 
> <a href="http://www.devarticles.com";>
> 
> <img border="0"
> src="http://www.devarticles.com/dlogo.gif";>
> 
> </a>
> 
> <table border="0" cellpadding="0" cellspacing="0"
> bordercolor="#111111" width="100%">
> 
> <tr>
> 
> <td width="100%" bgcolor="#FF9900" height="22"
> colspan="2">
> 
> <p style="margin-left: 10"><b><font face="Verdana"
> size="2" color="#FFFFFF">
> 
> Upload a File</font></b></td>
> 
> </tr>
> 
> <tr>
> 
> <td width="100%" bgcolor="#FFE3BB" colspan="2">
> 
> <p style="margin-left: 10; margin-right: 10"><font
> face="Verdana" size="2">
> 
> <br>Please select a file from your local computer to
> upload to our web server
> 
> for saving in our database. This file can be of any
> type you like. Once you
> 
> have chosen a file, please click on the &quot;Upload
> this file&quot; button below.&nbsp;
> 
> &nbsp;<br>&nbsp;</font></td>
> 
> </tr>
> 
> <tr>
> 
> <td width="15%" bgcolor="#FFE3BB">
> 
> <p style="margin-left: 10"><font face="Verdana"
> size="2">
> 
> File Description:</font></td>
> 
> <td width="85%" bgcolor="#FFE3BB">
> 
> <input type="text" name="strDesc" size="20"
> maxlength="50"></td>
> 
> </tr>
> 
> <tr>
> 
> <td width="15%" bgcolor="#FFE3BB">
> 
> <p style="margin-left: 10"><font face="Verdana"
> size="2">File Location:</font></td>
> 
> <td width="85%" bgcolor="#FFE3BB">
> 
> <font face="Verdana" size="2">
> 
> <input type="file" name="fileUpload"
> size="20"></font></td>
> 
> </tr>
> 
> <tr>
> 
> <td width="33%" bgcolor="#FFE3BB">
> 
> <p style="margin-left: 10"><font face="Verdana"
> size="2">
> 
> <br>
> 
> <br>
> 
> &nbsp;</font></td>
> 
> <td width="67%" bgcolor="#FFE3BB">
> 
> <font face="Verdana" size="2">
> 
> <input type="submit" value="Upload this file"
> name="cmdSubmit"></font></td>
> 
> </tr>
> 
> </table>
> 
> </form>
> 
> <?php
> } else {
> // GrabFile.php: Takes the details
> 
> // of the new file posted as part
> 
> // of the form and adds it to the
> 
> // myBlobs table of our myFiles DB.
> 
> global $strDesc;
> 
> global $fileUpload;
> 
> global $fileUpload_name;
> 
> global $fileUpload_size;
> 
> global $fileUpload_type;
> 
> // Make sure both a description and
> 
> // file have been entered
> 
> if(empty($strDesc) || $fileUpload == "none")
> 
> die("You must enter both a description and file");
> 
> // Database connection variables
> 
> $dbServer = "localhost";
> 
> $dbDatabase = "myFiles";
> 
> $dbUser = "";
> 
> $dbPass = "";
> 
> $fileHandle = fopen($fileUpload, "r");
> 
> $fileContent = fread($fileHandle, $fileUpload_size);
> 
> $fileContent = addslashes($fileContent);
> 
> $sConn = mysql_connect($dbServer, $dbUser, $dbPass)
> 
> or die("Couldn't connect to database server");
> 
> $dConn = mysql_select_db($dbDatabase, $sConn)
> 
> or die("Couldn't connect to database $dbDatabase");
> 
> $dbQuery = "INSERT INTO myBlobs VALUES ";
> 
> $dbQuery .= "(0, '$strDesc', '$fileContent',
> '$fileUpload_type')";
> 
> mysql_query($dbQuery) or die("Couldn't add file to
> database");
> 
> echo "<h1>File Uploaded</h1>";
> 
> echo "The details of the uploaded file are shown
> below:<br><br>";
> 
> echo "<b>File name:</b> $fileUpload_name <br>";
> 
> echo "<b>File type:</b> $fileUpload_type <br>";
> 
> echo "<b>File size:</b> $fileUpload_size <br>";
> 
> echo "<b>Uploaded to:</b> $fileUpload <br><br>";
> 
> echo "<a href='uploadfile.php'>Add Another File</a>";
> 
> ?>
> </body>
> 
> </html>
> 
> =====
> Patrick Roane
> Web design and development
> www.franklin-band.com
> Fox River Grove, Il.
> 
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


-- 
Zareef Ahmed :: A PHP Developer in India ( Delhi )
Homepage :: http://www.zareef.net

--- End Message ---
--- Begin Message ---
I will apologise for this questions now, but everyone has to start 
somewhere.

I am just starting out with PHP and wanted to know what development 
environments/editors that you guys are using for your PHP development.  (On 
Windows)

I know that you can use good ol Visual Notepad, but i was wondering if there 
was anything better out there.

Thanks.

--- End Message ---
--- Begin Message ---
st*a

or if you're lazy, here goes...

http://marc.theaimsgroup.com/?l=php-windows&w=2&r=1&s=php+editor&q=b

hth

irvin

--- End Message ---

Reply via email to