• GoDaddy Community
  • Websites + Marketing | Website Builders
  • Websites + Marketing | Website Builders

    cancel
    Showing results for 
    Show  only  | Search instead for 
    Did you mean: 

    PHP file will not run but can be opened or saved

    Please help.  I have moved my website from another hosting company where it worked perfectly and here it works except for any .php file.  If I click on a .php file, rather than running it, it displays a dialog asking whether I want to open or save it.  If course I don't want to do either - I just want it to run.

     

    Having had these difficulties (and talked at length with support) I created a simple php script (only 3 lines, the key one of which was phpinfo) but it still won't run it.

     

    It's almost as though PHP isn't installed.  I've put the correct handler in .htaccess. I have cleared the cache and retried, numerous times but no success.

     

    Please, please help.

    12 REPLIES 12
    Helper IV Helper IV
    Helper IV

    Re: PHP file will not run but can be opened or saved

    @LadyHynarc - I know this is an obvious question, but have you checked to make sure you've set Executable for the permissions on the file?

     

    Cheers

    Doc

     

     

    Need some help with WordPress? Check out Site Doctor 911
    Worry-Free WordPress Support - So You Can Focus On The Important Stuff

    Re: PHP file will not run but can be opened or saved

    My first thought.  Set it - no change.  Besides, on my previous host it didn't need executable.

    Helper IV Helper IV
    Helper IV

    Re: PHP file will not run but can be opened or saved

    @LadyHynarc - I figured that you had probably checked the permissions, but you have to start somewhere.

     

    Are you running a Linux server or Windows IIS? If you can't get even a simple echo script to run, contact tech support again because it's a configuration problem on the server and only they can fix it.

     

    Good luck

     

    Doc

     

     

    Need some help with WordPress? Check out Site Doctor 911
    Worry-Free WordPress Support - So You Can Focus On The Important Stuff

    Re: PHP file will not run but can be opened or saved

    I'm on a Linux server and I think I have made some progress.  I copied my php file to my root directory and got rid of my htaccess file and it worked.  When I recreated the htaccess file, it didn't work.  I can't run without the htaccess because my website exists within a subdirectory and the htaccess directs it there.

     

    How can I get the php to run in the subdirectory?

    Helper IV Helper IV
    Helper IV

    Re: PHP file will not run but can be opened or saved

    @LadyHynarc - what have you got in your .htaccess file?

     

     

    Need some help with WordPress? Check out Site Doctor 911
    Worry-Free WordPress Support - So You Can Focus On The Important Stuff

    Re: PHP file will not run but can be opened or saved

    All of a sudden the community won't let me post...

    Trying to post code and I get

    Access Denied

    You don't have permission to access

    http://www.godaddy.com/community/forums/replypage.editorform.form.form.form" on this server.

    Reference #18.208b1bb8.1474400862.2a976f8e

     

    Employee
    Employee

    Re: PHP file will not run but can be opened or saved

    Hey @LadyHynarc!

     

    I'm sorry you're having trouble posting. Have you tried clearing browser cache and cookies? I've seen this happen once and clearing browser cache did the trick.

     

    Heather - GoDaddy | Community Moderator
    24/7 support available at x.co/247support
    Helper IV Helper IV
    Helper IV

    Re: PHP file will not run but can be opened or saved

    Actually, including code into  a post seems to cause a repeatable error as @LadyHynarc mentioned. I had the same problem, even when it was formatted as code.

     

    Maybe you could attach a file with the code in it?

     

     

     

     

     

    Need some help with WordPress? Check out Site Doctor 911
    Worry-Free WordPress Support - So You Can Focus On The Important Stuff

    Re: PHP file will not run but can be opened or saved

    Let's see if the file solution works...sort of.  Had to attach as a jpg as it wouldn't take a txt file.  There is one line missing from the bottom of the image "
    RewriteRule ^(/)?$ asm/index.html [L] "

    Re: PHP file will not run but can be opened or saved

    The problem is solved!

     

    Through a process of elimination, the following line was the problem.

    "AddHandler application/x-httpd-php .php"

    Why?  I have no idea but I don't really care.

     

    Now, finally, I can move on.  I'm really not impressed with GoDaddy though.  Nowhere near what I was expecting.

     

    Thank you to all those who attempted to help.

    Helper IV Helper IV
    Helper IV

    Re: PHP file will not run but can be opened or saved

    Glad you were able to solve it!

     

     

    Need some help with WordPress? Check out Site Doctor 911
    Worry-Free WordPress Support - So You Can Focus On The Important Stuff

    Re: PHP file will not run but can be opened or saved

    I'm having the same problem. Where did you add that? What is the file name thanks.