Jump to content


Photo

Php Scripts Embedded In Html File Not Working On Tommy

PHP Tommy .htaccess

  • Please log in to reply
3 replies to this topic

#1 pab49162

pab49162

    Newbie

  • Members
  • 5 posts

Posted 16 February 2017 - 04:15 PM

With the demise of the Stevie server, I now have an account on the Tommy server and am trying to get a website back up and running.

 

I am having a problem getting the server to parse PHP scripts embedded within HTML files having an .html extension.  On Stevie, I used the following .htaccess directive to set up html files so they were executed like php files:

 

     AddHandler application/x-httpd-php5 .html

 

Unfortunately, this directive does not seem to work on Tommy as the embedded PHP script is basically ignored.

 

Any info on what I need to do to resolve this problem would be greatly appreciated.

 

Thanks - Paul

 

 



#2 Krydos

Krydos

    Rank X Member

  • Root Admin
  • 10,594 posts
  • Gender:Not Telling

Posted 17 February 2017 - 04:38 AM

On Tommy it depends on which version of php you want to use. For instance if you want to use php 7.1 then use
AddType application/x-httpd-ea-php71 .html


#3 pab49162

pab49162

    Newbie

  • Members
  • 5 posts

Posted 17 February 2017 - 04:23 PM

Thank you for the reply as the information you provided fixed my problem!

 

In case anyone else has the same question, you can find out which version of PHP you are using in the MultiPHP Manager under the Software category on the cPanel home page.

 

In my case, I was inheriting the system default PHP version which is ea-php56.  So in the .htaccess file, I added the following directive:

 

     AddType application/x-httpd-ea-php56 .html

 

Once I did this and saved the file, the server did processed the embedded PHP script.

 

Thanks again - Paul



#4 isuru

isuru

    Newbie

  • Members
  • 1 posts
  • Gender:Male
  • Location:Kottawa, Pannipitiya, Sri Lanka

Posted 21 February 2017 - 07:08 PM

Hi, so I'm yet another noob, so please bare with me.

I have read this....

Thank you for the reply as the information you provided fixed my problem!

 

In case anyone else has the same question, you can find out which version of PHP you are using in the MultiPHP Manager under the Software category on the cPanel home page.

 

In my case, I was inheriting the system default PHP version which is ea-php56.  So in the .htaccess file, I added the following directive:

 

     AddType application/x-httpd-ea-php56 .html

 

Once I did this and saved the file, the server did processed the embedded PHP script.

 

Thanks again - Paul

and did the following

added 

AddType application/x-httpd-ea-php70 .html

to my .htaccess since I'm using ea-php70 which made my .htaccess file look like this...

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
AddType application/x-httpd-ea-php70 .html

and yet I receive the following error

 

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at webmaster@isuru.heliohost.org to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

what am I doing wrong? without the php line

AddType application/x-httpd-ea-php70 .html

with just the this

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

in my .htaccess file, my index.html file displays perfectly fine from what I can see... so what am I doing wrong trying to get php to render html?


Hello again, this is rather embarrassing but then again I did say I'm a "noob"  :) so I have seen this

https://my.getstarte...e-by-group.html

500 Error: File is writeable by group


On occasion you may get a 500 page error (a green/blue error page) when trying to run a PHP script in your account. When checking the error og which you can do via the cPanel account log in you may see the following line:
 
[Wed Jan 31 16:34:12 2011] [error] [client 11.111.111.111] SoftException in Application.cpp:256: File "/home/username/public_html/index.php" is writeable by group
 
This is due to the server running SuPHP and the files having higher permissions than allowed, to fix this problem you need to make sure your files are chmod 644 for all PHP based files and 755 for directories in order for them to work with SuPHP.You can easily do this by connecting via FTP with Filezilla and right clicking on the problem folders and files and selecting file permissions.

 

and it WORKS :) :) Thank you to anyone who had a look at this. Hope this helps anyone who gets in the same JAM :)






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users