+ Reply to Thread
Results 1 to 16 of 16

Thread: Running a php file
      
   

  1. #1
    Jamesta is offline Private First Class
    Join Date
    Feb 2008
    Posts
    8

    Default Running a php file

    I created a php file. The data is saved but when i pull up the page I'm asked to download the file to save locally.

    1.) I have created the file with .php extension.
    2.) The code is:

    <?php
    phpinfo();
    ?>

    3.) I added a php handler of application/x-httpd-php as well.

    Can anyone provide some insight into what is the problem?

    4.) Also do I need to install php on the server using shell access?

    Much appreciated.

    -James

  2. #2
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,061

    Default Re: Error when running php file

    Not sure I follow you.

    Your code

    <?php
    phpinfo();
    ?>

    will output on the screen the info regarding the php version and settings of your server. Unless you have added something else, it should only do that.

    Handler: HOW did you embed the handler ? it is probably because of this that it asks to save.

    Not sure i follow you: why should you install php ??? Are you talking about a VodaHost server ? If yes, php is already installed, you don't need to do anything. If not, and your host doesn't support php, could be the reason why you are asked to download / save the file. It doesn't see it as a php file that needs to be executed, but as an unknown type file so it sees it as a download request.

    I don't think ANY host in the world would ever let you install php, seems impossible (to me) that they could give you permissions to do so.
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!


  3. #3
    Ver
    Ver is offline Private
    Join Date
    Oct 2008
    Posts
    3

    Default Re: Running a php file

    To Navaldesign,

    I am new here and just joined.. Hope with your helping hand you can share some of your knowledge... Barely new with html but what I am trying to understand is php. I have a website which a friend created it . It was saved in the form of many php files and not one html. How do I load these php files so it will show the site. Will these have to be converted as one html. Please kindly help as I am new to these but very willing to learn at the shortest possible time...Am I at the right forum to get the request I need? This may be a dumb question but "what is php vs html" in lay man's term.

    Thanks,

    Ver

  4. #4
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,061

    Default Re: Running a php file

    PHP is a programming language, so php is usually used to create pages where the content is different, depending on the users input. Example: in a shopping cart, the product page is only one, and, depending on the product ID passed to the page, it will display the specific product details.

    HTML istead is a page description language. It can create only static pages.

    You can't create php pages that are usefull if you don't know HTML. That's because, at the end, php creates the output using html.

    I can't know what all those php files that you have are, or how they are joined. And, seems highly improbable that you can join al those files in a unique html file. Why ? each HTML file is ONE page. If those php files are an entire website, then there are certainly more than one pages, so joining them would be meaningless

    Further more, if your friend has created it in php, there SHOULD be a reason. In example, the site takes the content from a database, or a file. So seems rather difficult that you could convert the site to a html one, or your friend would have done so right from the start.
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!


  5. #5
    Jamesta is offline Private First Class
    Join Date
    Feb 2008
    Posts
    8

    Default Re: Running a php file

    Thank you very much for the response.

    1)When I executed the .php file what I see in the browser is the lines of code written as text and not the php server/other information. Correct me from wrong but this happens if the server does not understand the extension then the data is displayed as a text file as it is and not as any other file to be interpreted by the php compiler/pre-processor.
    2)I added the handler so that the server can understand that this is a php file and hence it needs to be interpreted. Should I remove this one?

    I want to make sure that php is interpreted and executed. How do I do this? If I no need to do anything, then my setup is probably not set right?
    Who do I contact regarding this?

    Is there a document which explains how to run php applications with a sample example?

    Thanks again,


    James

  6. #6
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,061

    Default Re: Running a php file

    Please provide a link to one of th eproblematic pages.

    If your page is published as php and IF your server supports php (are you a VH customer ? ) there is no need for handlers of any kind.

    IF the server supports php, it automatically executes the php code as it should. No need for further actions on your side, other than publish the pages as php.
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!


  7. #7
    Jamesta is offline Private First Class
    Join Date
    Feb 2008
    Posts
    8

    Default Re: Running a php file

    Thanks Navel! I appreciate the quick response.

    Here is the url:

    http://www.sowhatchee.com/testDBtest.php

    I am a customer.

    Whenever I pull the page up I'm asked to open or save as.

  8. #8
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,061

    Default Re: Running a php file

    How complicated!

    Create a BV page and place a html box in the page, then paste in the box this code:

    <?
    phpinfo();
    ?>

    Publish the page as php and publish. That's all.
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!


  9. #9
    Jamesta is offline Private First Class
    Join Date
    Feb 2008
    Posts
    8

    Default Re: Running a php file

    I tried again this time with html box.

    I set page properties to php and then saved.

    Published.

    Now when i pull up the page, I"m asked to find a web service to open the file.

    www.sowhatchee.com/phptest.php is the page.


    Why am I being asked to find a web service to open the file?

    Thanks again,

    -James

  10. #10
    Karen Mac's Avatar
    Karen Mac is offline General
    Join Date
    Apr 2006
    Location
    X marks the spot
    Posts
    8,354

    Default Re: Running a php file

    You arent asking it to execute anything else? The info or the script to process it is missing...

    Karen

    VodaHost

    Your Website People!
    1-302-283-3777 North America / International
    07031847328 / United Kingdom

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

    Top 3 Best Sellers

    Web Hosting - Unlimited disk space & bandwidth.

    Reseller Hosting - Start your own web hosting business.

    Search Engine & Directory Submission - 300 directories + (Google,Yahoo,Bing)



  11. #11
    Jamesta is offline Private First Class
    Join Date
    Feb 2008
    Posts
    8

    Default Re: Running a php file

    I'm not sure I follow.

    I added the following to the html box:

    <?
    phpinfo();
    ?>

    Should there be something else?

    I'm just trying to get a simple php script to work before I hook up with db.

    Thanks,

    James

  12. #12
    Karen Mac's Avatar
    Karen Mac is offline General
    Join Date
    Apr 2006
    Location
    X marks the spot
    Posts
    8,354

    Default Re: Running a php file

    Well php works just fine on vodahost.. hook up your database and most likely will take care of the errors.

    Karen

    VodaHost

    Your Website People!
    1-302-283-3777 North America / International
    07031847328 / United Kingdom

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

    Top 3 Best Sellers

    Web Hosting - Unlimited disk space & bandwidth.

    Reseller Hosting - Start your own web hosting business.

    Search Engine & Directory Submission - 300 directories + (Google,Yahoo,Bing)



  13. #13
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,061

    Default Re: Running a php file

    Please use my contact form to send me your page. It SHOULD have worked as i said.
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!


  14. #14
    Jamesta is offline Private First Class
    Join Date
    Feb 2008
    Posts
    8

    Default Re: Running a php file

    Hey.. I'm not sure what you mean by "contact me". Is this a private message? Where would I send this?

    The page that I'm trying to get to work is: www.sowhatchee.com/phptest.php

    Thanks for the support.

    -James

  15. #15
    navaldesign's Avatar
    navaldesign is offline General & Forum Moderator
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    12,061

    Default Re: Running a php file

    Contact me means "use my contact form" to send me the file of your page.
    In my signature you can find my site and hence my contactform.
    Direct Link: contact form
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!


  16. #16
    Jamesta is offline Private First Class
    Join Date
    Feb 2008
    Posts
    8

    Default Re: Running a php file

    Thanks. So... that won't be necessary after all. I figured out the problem. Earlier I tried to get the php to work via text. After several failures I figured that the issue was with the Apache handler and added a .php handler.

    I forgot about this, which is why I received the request to open a file when I later used the html box.

    I removed the apache handler and all is well now.

    Thanks for the help. Now I'm working on a script to fetch from the DB... so I'm sure I'll have some questions later.

    Any sample scripts would be appreciated.

    Thanks again folks!

    -James

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49