tvmcgee Posted February 1, 2011 Share Posted February 1, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/226302-php-on-go-daddy-php-not-working-in-html-files/ Share on other sites More sharing options...
requinix Posted February 1, 2011 Share Posted February 1, 2011 Did you notice the .php extension in those two AddHandler directives? Did you try duplicating one of those lines but changing the extension to, say, .html? Quote Link to comment https://forums.phpfreaks.com/topic/226302-php-on-go-daddy-php-not-working-in-html-files/#findComment-1168150 Share on other sites More sharing options...
tvmcgee Posted February 1, 2011 Author Share Posted February 1, 2011 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! Quote Link to comment https://forums.phpfreaks.com/topic/226302-php-on-go-daddy-php-not-working-in-html-files/#findComment-1168167 Share on other sites More sharing options...
requinix Posted February 1, 2011 Share Posted February 1, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/226302-php-on-go-daddy-php-not-working-in-html-files/#findComment-1168198 Share on other sites More sharing options...
tvmcgee Posted February 1, 2011 Author Share Posted February 1, 2011 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. Quote Link to comment https://forums.phpfreaks.com/topic/226302-php-on-go-daddy-php-not-working-in-html-files/#findComment-1168456 Share on other sites More sharing options...
tvmcgee Posted February 1, 2011 Author Share Posted February 1, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/226302-php-on-go-daddy-php-not-working-in-html-files/#findComment-1168468 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.