#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2006
    Posts
    58
    Rep Power
    9

    Downloading rather than executing PHP script


    All of the sudden my html files have started directing my web browsers to download their linked php files rather than execute and display them.

    <form action="processorder.php" method="post">

    The above is an example of my HTML file's link to the php script. When the HTML file executres that script, it downloads the processorder.php file rather than execute and display it. I've tried this in two browsers and I have also sucessfully executed 'localhost/phptest.php' which contained the code below and it worked just fine. Any ideas?

    Code:
    <?php
    
    phpinfo()
    
    ?>
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2003
    Posts
    3,508
    Rep Power
    594
    Did you try putting phptest.php in as the action on your form? It sounds like PHP as been disabled on your server but then the phpinfo would not work either. What do your logs say?
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2006
    Posts
    58
    Rep Power
    9

    php downloading


    My logs didn't give me any usefull information. I have verified that the apache server as well as php are present. I can run phptest.php from the browser and it works fine but if I change the action="" in the HTML file to the phptest.php file it just downloads the file into my ~/downloads directory. I can't figurethis out.

    Originally Posted by gw1500se
    Did you try putting phptest.php in as the action on your form? It sounds like PHP as been disabled on your server but then the phpinfo would not work either. What do your logs say?
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2003
    Posts
    3,508
    Rep Power
    594
    Did you try a simplified form in a new php page that perhaps only has a submit button? You need to determine if this is happening with all forms on any page or if it is limited to this specific page.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2006
    Posts
    58
    Rep Power
    9
    I've tried it with different html files linked to different php files and they are all doing the same thing. I just uninstalled apache2 and php5 and re-installed both of them. It's still doing the same thing.

    Originally Posted by gw1500se
    Did you try a simplified form in a new php page that perhaps only has a submit button? You need to determine if this is happening with all forms on any page or if it is limited to this specific page.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2003
    Posts
    3,508
    Rep Power
    594
    What actually gets downloaded? The PHP code itself or the output from the PHP code as if it ran but downloaded rather than rendering in the browser?
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2006
    Posts
    58
    Rep Power
    9
    The php file that's in /var/www get's copied into my ~/Downloads directory, just as if I had download the file from the inernet. The strange thing is, I can point the web browser stright to the php file and it will work just find 'localhost/hello.php' works, but if that same file gets called from an html form the browser downloads the file into my downloads diectory as if I were downloading a file from the internet.

    Originally Posted by gw1500se
    What actually gets downloaded? The PHP code itself or the output from the PHP code as if it ran but downloaded rather than rendering in the browser?
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2003
    Posts
    3,508
    Rep Power
    594
    This makes no sense. Does it work from a different client machine?
    There are 10 kinds of people in the world. Those that understand binary and those that don't.

IMN logo majestic logo threadwatch logo seochat tools logo