Jump to content

Recommended Posts

I have tried many .htaccess lines from web forums.  But I still can't get the PHP tags to work in .html files.

 

I have read about php.ini files, but I don't know if I need to change or add these.  My root directory has a php.ini file, but no php5.ini file.

 

I am using GoDaddy Deluxe with Linux Grid & PHP5 (5.2.14). (I think this is new and different from the many Go Daddy example on the web.  I think the Deluxe Grid uses the "cgi" part and the php5 is a little different than the other php.

 

I am using the following .htaccess file:

AddType image/svg+xml .svg .svgz

AddEncoding x-gzip .svgz

AddHandler x-httpd-php5-cgi .php

AddHandler x-httpd-php-cgi .php4

 

I got the last two php lines from this GoDaddy support page:

http://community.godaddy.com/help/article/1082

 

If I leave the cgi off .php files still work

If I leave the "5" off the php the .php files still work

If I add any "AddType" to the .htaccees files then any HTML page doesn't work

 

See the following test pages:

http://hexpanse.com/dev/phpworking.php (works)

http://hexpanse.com/dev/phpworking.html (not working)

http://hexpanse.com/dev/layoutwithphp001.php (php gives syntax error on <?MLS version tag)

 

I believe that I should be using php tags inside of .html (XHTML / HTML5) files, and not the other way around.

 

- Go Daddy support says don't do customer support for help with running scripts, and referee me to the help/support pages.  Some of the other support posts there are using different set ups.  But here is one that is close:

http://community.godaddy.com/groups/web-hosting/forum/topic/php-using-html-file-extension/#post-95463

 

I am still waiting for a support email response.

 

Please advise  - thanks you for any help!

 

Troy McGee

troy@troymcgee.com

Searching some more I should be using the .php files and not .html.

 

The .php files work with the html forms now that I removed the first line :

<?xml version="1.0" encoding="iso-8859-1"?>

 

That line is added by Amaya from the W3C when I select a XHTML Transitional document.

 

Now I wonder what that line is for, and why W3C has it in there, and why I can't get it to work with .php files?

 

Here are the working .php file links:

http://hexpanse.com/dev/layout001.php

http://hexpanse.com/dev/layout002.php

 

Thank you!

You don't have to use the .php extension, but it is the most common one.

 

That instead).

If you have PHP's short tags enabled then PHP will see the and try to parse the stuff inside as PHP code. Which it is not. All you have to do is disable the setting.

Thank you

 

- it was the short_open_tag setting that was throwing off the .php with the <?XML tag.

 

I added short_open_tag = "0" to my php.ini file then checked Godaddy's CGI Administration page (I think this is an extra tool for their grid hosting) and saw that PHP 4 had it off, but PHP 5 still had it on.  so I coppied my php.ini file to php5.ini, rechecked the CGI Administration page and both were now off, and the .php code with the <?XML line worked properly.  I could not find my php5.ini file so I hope I did not screw any thing up by just coping my php.ini file.

 

Here is the working .php file: http://hexpanse.com/dev/layout001.php

 

Godaddy support did get back with me and gave the following information that I still need to try out:

"Thank you for contacting Online Support.  It appears you would like to parse php within your HTML files.  Typically we cannot help with scripting of a page.  However you should also add this information to your .htaccess file, which should help.

 

To run HTML files thru PHP 5 w/out FastCGI

 

Options +ExecCGI

AddType application/x-httpd-php .php .htm .html

AddHandler x-httpd-php5-cgi .php .htm .html

 

Please let us know if we can help you in any other way."

 

Thank you for the help!

 

I will try to make a support forum post on Godaddy summing up this up once I get the .html method working.

Turns out this was a two part challenge and both are now SOLVED!

 

1st was the issues of <?php tags not working in .html files

– solved by adding .html to AddHandler as suggested by requinix

 

2nd was the <?XML tag throwing off .php files

- Solved by adding short_open_tag = "0" to my php.ini & php5.ini file.  The short_open_tag issue was pointed again by requinix.

 

Godaddy support did email me back and made it clear how to fix the AddHandler.

 

I will post the solutions on the Godaddy support forums to try to help others.

 

Now both the .html and .php files now work! (I think I will stick with the .html files)

http://hexpanse.com/dev/layout002.php

http://hexpanse.com/dev/layout002.html

 

Thank you all!

 

Troy

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.