The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Editing .htaccess to use PHP inside of HTML?

Discussion in 'General Discussion' started by TheXboxCloud, Aug 12, 2014.

  1. TheXboxCloud

    TheXboxCloud Member

    Joined:
    Jun 19, 2014
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    If you can help me with this, you'll be a lifesaver.

    I have tried all kinds of code to no avail. I'm running apache 2.5

    The PHP version is PHP native.

    I need to edit .htaccess to run my PHP inside of my HTML homepage (index.html).

    I have tried AddHandler and FCGIwrapper, also AddType application.

    My webhost suggested a combination of AddHandler and FCGIwrapper. This did not work. So far nothing has worked properly. I am positive my .htaccess is enabled and it's a coding issue.

    Please respond with the proper code for Apache 2.5 (you will be a lifesaver).

    p.s. Also suggest if file permission 644 is proper for .htaccess which is what I have it on
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    651
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    cPanel does not offer Apache 2.5. Are you sure cPanel/WHM is installed on this system? Has your web hosting provider installed a custom version of Apache?

    Thank you.
     
  3. TheXboxCloud

    TheXboxCloud Member

    Joined:
    Jun 19, 2014
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    My webhost is Godaddy, and I do have cpanel.

    There was a misunderstanding regarding the Apache version through a link I was given.

    Not sure the exact version but I'd love to see a full code example of how I should edit the .htaccess

    If possible, please provide me with the code needed. Also what file permission it needs to be on.

    Thank you very much cPanelMichael.

    - - - Updated - - -

    Go daddy does use cPanel.

    Though their version is custom to Godaddy. So it may use Apache 2.5 if you provide their custom setup with it.
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    651
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    The typical entries used in the .htaccess file are

    Code:
    AddHandler application/x-httpd-php5 .html
    AddHandler application/x-httpd-php5 .htm
    You don't typically need to change permissions or ownership of files. What PHP handler (e.g. suPHP, DSO, FCGI) are you using?

    Thank you.
     
  5. TheXboxCloud

    TheXboxCloud Member

    Joined:
    Jun 19, 2014
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    FCGI I believe is the handler. Like I said, I am using godaddy and their cpanel may actually use apache 2.5

    According to you, even godaddy's custom panel doesn't use this.

    Though I just cannot explain the htaccess not taking effect with the code I do put in. The support directive on godaddy's link to help was as follows:

    httpd.apache.org/mod_fcgid/mod/mod_fcgid.html

    Making me assume it was really 2.5

    It has been said, .htaccess is indeed enabled on the server.

    I have tried the RemoveHandler method as well and also AddHandler. Support claimed that AddHandler along with FCGIdWrapper was the one I should use. Still nothing.

    My guesses are either their custom cpanel really does use apache 2.5, the support guy was wrong, or the code he put in (AddHandler with FCGIdWrapper) were wrong or not complete.

    I really appreciate you helping me, I am a cpanel customer and I am fixing to get my own server hardware, so I intend to purchase cpanel directly from you in the future.

    Hopefully we'll find a solution to this.
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    651
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    I suggest consulting further with your hosting provider about this issue. Have them check to ensure the web page loads as expected after adding in those entries.

    Thank you.
     
  7. TheXboxCloud

    TheXboxCloud Member

    Joined:
    Jun 19, 2014
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    No that doesn't work and I need your help.

    - - - Updated - - -

    They use apache 2.4.9

    Now you can help me.
     
  8. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    651
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    There is not much we can do to help further without root access to the server. You are welcome to have your hosting provider submit a ticket with us if they are not sure what the issue is.

    Thank you.
     
  9. rjalcivar

    rjalcivar Registered

    Joined:
    Dec 13, 2014
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    TheXboxCloud excuse me, but you got an answer or a solution to your problem?

    I have the same problem and I can't fix it.

    can you help me?

    thanks
     
  10. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    651
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page