Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP or ASP but not Both (until you reopen the browser)

Status
Not open for further replies.

teash

IS-IT--Management
May 3, 2005
99
US
Hello,

We recently moved from NT to SBS 2003 and are hitting a few bumps in the road.

I have installed PHP/MYSQL and it works just fine. I enabled ASP in IIS as well. All scripts work fine.

However...
Upon login (from any computer), I run a php script. Let's call it "updateinventory.php". I can keep "updating the inventory" until I decide to login to the "orderform.asp". All the ASP scripts will continue to work, but if I go back to the php scripts they stop working.

"Stop working" is loosely used here. The PHP script processing works, however I use "GET", "POST", "REQUEST" methods. In other words the form submissions won't work.
The code didn't change, neither did the client computers.

Ang suggestions?

 
Interesting... downloaded and installed firefox...
I don't have the problem anymore.

What's with internet explorer? It worked before.

 
I only hope its a cache problem. A part of my php code that I can tell fails. For some reason: isset($_GET['ID'])
will not be true after ASP script has been ran.

Does the cache have anything to do with this code?

__________________
<?php
if (isset($_GET['ID'])
{
Valid($_GET['ID'')
}
else
{
NotValid();
}
?>


Thanks for your thoughts.


 
Let me see if I understand the situation.

You submit data from an HTML form to a.php and it works. You can do this multiple times. But if you submit data from a form to b.asp, you can no longer submit to a PHP script.

Is this any PHP script, or is are you submitting to a.php again?

If it's the latter, it's a cache problem. IE's cache, frankly, is terrible. The cache handler apparently has exceptions to understand that .asp files (and a few Microsoft-specific extensions) are scripts and that the output of them should not be cached, data should always be submitted, etc. IE doesn't know all this about PHP.

If it's the former, I'm not sure.



Want the best answers? Ask the best questions! TANSTAAFL!
 
Have you explicitly told IE to empty it's cache (the "Delete all offline content" option)? Does this change IE's behavior, at least temporarily?


Our of curiosity, why are you not sticking to one language or the other?



Want the best answers? Ask the best questions! TANSTAAFL!
 
Hello,
I did try the clearing the cache. Didn't work. Still has the issues.
Using the code below (i hacked it apart to shorten it up).
I can update the inventory level, and press the submit. I can do this over and over. Then I open up an asp script to log into our order form. I go back and try to update the inventory (by pressing the submit button) and that when it says "No ID Specified". This is because the $_POST/$_GET has no value.

It's not just from my computer, its from every computer using internet explorer (as well as the server). Perhaps it's a problem with IIS. But I have followed the instructions to install php 5 on IIS 6.

The reason for both languages is that when I came to this small business everything was in ASP. It's not the fact that is was ASP that I didn't like. It was the numberous Access databases with 50,000 records on the NT4 system that if it didn't crash the system, it certainly took a long to to query anything. Since I like PHP/MYSQL/CSS and since my boss doesn't like to spend money... we are taking the free route. There are two languages because we are in a transition stage. I quit this job, went away to be a web programmer and with in 4 days... the new girl crashed the system... the whole boot sector on the hard drive is fubar'd.

So we are migrating as well... just the wrong way!

_________________________
<?php

if (isset($_POST['SubmitItem']))
{
$link = db_connect();
$sql = "UPDATE inventory SET BLAH BLAH " .
do_sql($sql);
}
else if (isset($_GET['id']))
{
$p = GetQuery($_GET['id']);
DisplayForm($p);
}
else
{
echo "No ID Specified"
}

?>

 
I dunno, I'm just grasping at straws, here. Most of my PHP experience is on LAMP boxes.

Have you tried turning on content expiry in IIS?



Want the best answers? Ask the best questions! TANSTAAFL!
 
Stick an
Code:
echo '<pre>';
print_r($_POST);
echo '<hr>';
print_r($_GET);
At the top of your script and see what the values are when you come in normally vs. when you come in after the ASP snafu.

I'm personally not following your flow quite right in my head, and am wondering if perhaps it's something simple like your using the same form in two web pages, and you've capitalized it somewhere, but not somewhere else...

I'm also grasping at straws btw.
 
I do think its something little. I have installed PHP 10+ times, and installed in on IIS 5. The Php worked. I don't think it's the code.
I did stick the code in at the top of the script.

edit.php?id=2247
#########################
Array()
-------------
Array
(
[id] => 2247
)
#########################


After pressing "submit"
#########################
Array
(
[PDesc] => 1096 S-10 FRONT AIR DAM
[PQty] => 3
[PLocation] => 5315
[PCat] => GE
[PUnitCost] => 25.00
[SubmitItem] => Save
[id] => 2247
)
-------------
Array()


#######################################
ALL Normal above.. now I login to orderform.asp
and then go back to the edit.php?id=2247
***************************************

Array ()
------------- Normal (pre-asp)
Array
(
[id] => 2247
)

****************************************
Array()
----------- Where did my post go?
Array()



I never had any straws to grasp.




 
it's not the server as you don't have the problem with firefox.

it must, therefore, be internet explorer.

when you say you cleared the cache. did you clear it AFTER you had loaded the asp page? (and before you loaded edit.php).
 
I did clear the cache, both before and after. Basically trying all combinations.

I just don't understand why IE on every client has the same problem. The only thing I had to change on their computer was the DNS address. I can't think of anything that would effect the $_POST/$_GET

I also added the print_r($_SERVER) and this information get's display all the time, even with the asp.


 
Well I'm not quite as convinced that it's not on the server as jpadie, Firefox & IE each make their own concessions on certain standards...

Since the form does work in both browsers pre-ASP it seems likely to be an IE caching issue... but it could be something as simple as a quoting issue, or a nested tag that for some reason is getting called after the ASP (perhaps a session or superglobal is in use in DisplayForm?) or maybe you're posting back to $_PHP['SELF'] and an asp redirect is doing funky things to the header (asp loves header redirects).

I think you gotta ground up trouble shoot it. Make a simple one field form, and validate with an HTML validator to make sure you have everything in place, which goes through the same steps and see what happens. Then add in the DB call. Then just keep going from there until you have the original back.
 
This is some interesting output from printing the $_SERVER array. The difference is that the php script is using a cookie after I use ASP.

%%%%%%%%%%%%%% BEFORE ASP %%%%%%%%%%%%%%%%%%%%%%%
[ALL_HTTP] =>
HTTP_CONNECTION:Keep-Alive
HTTP_ACCEPT:*/*
HTTP_ACCEPT_ENCODING:gzip, deflate
HTTP_ACCEPT_LANGUAGE:en-us
HTTP_HOST:rvm HTTP_USER_AGENT:Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322)
HTTP_UA_CPU:x86
[HTTPS] => off
[SCRIPT_NAME] => /system/inv/edit.php
[HTTP_COOKIE] =>

%%%%%%%%%%%%%%%%%%%%AFTER USING ASP %%%%%%%%%%%%%%%%
[ALL_HTTP] =>
HTTP_CONNECTION:Keep-Alive
HTTP_ACCEPT:*/* HTTP_ACCEPT_ENCODING:gzip,deflate
HTTP_ACCEPT_LANGUAGE:en-us HTTP_COOKIE:ASPSESSIONIDAQACRDSS=PEPNADJBGBGNAJEBMPPMCFOG
HTTP_HOST:rvm
HTTP_USER_AGENT:Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322)
HTTP_UA_CPU:x86
[HTTPS] => off
[SCRIPT_NAME] => /system/inv/edit.php
[HTTP_COOKIE] => ASPSESSIONIDAQACRDSS=PEPNADJBGBGNAJEBMPPMCFOG
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 
That cookie is just ASP's session ID cookie. ASP always sets that cookie -- PHP will, too, if in php.ini you have session.auto_start set to 1.



Want the best answers? Ask the best questions! TANSTAAFL!
 
PHP is aware of ASP sessions?

I wrote this, small code... works fine, echoes whatever I type in the text box. As soon as I go use some ASP.. it doesn't print anything.....

<?php
if (isset($_POST['id'])) {
echo $_POST['id'];
}
?>
<html>
<form name="form1" action="test.php" method="post">
<input type="textbox" name="id">
<input type="submit" value="submit" name="submitform">
</form>
</html>


 
i don't think that either php or asp are definitively aware of the other's sessions (of course there is no reason why they should not be if you set it up that way). however a cookie is a cookie and in the same domain both php and asp will receive the same cookie from the browser.

the difference between the server variables suggests to me that IIS may be doing something strange with its cache. as sleipnir suggests, have you turned off content cacheing in IIS (in application configuration? under the mappings tab (if you are using php as an isapi) and cache options (for asp)).

 
Unless ASP and PHP are both using the same cookie name to store their respective sessions, neither will be aware of the other's session variables. PHP's default cookie name is "PHPSESSID", and your ASP installation is using "ASPSESSIONIDAQACRDSS". They should not interfere with one another.

My suggestion was to turn on content expiration, in the belief that might cause IE to consider its cache perpetually stale and always reload pages.



Want the best answers? Ask the best questions! TANSTAAFL!
 
teash said:
I wrote this, small code... works fine, echoes whatever I type in the text box. As soon as I go use some ASP.. it doesn't print anything.....
Code:
<?php
if (isset($_POST['id'])) {
  echo $_POST['id'];
}
May I suggest changing the code about to something like:
Code:
<?php
if (isset($_POST['id'])) {
  echo 'id: '.$_POST['id'];
}
else {
  echo 'id is not set.';
}
?>
With this code you should be able to determine if PHP can access the $_POST variables, but does not receive the value, or if PHP for some reason is not receiving the POST info at all.

You could also try hitting refresh after submitting the form (and it failing). When you click refresh, IE should display a warning that notifies the user that the form is again being submitted.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top