AddHandler .htaccess on GoDaddy stopped working today - php

I have the following code in my GoDaddy .htaccess file:
AddHandler fcgid-script .do
FCGIWrapper /usr/local/cpanel/cgi-sys/php .do
AddType application/x-httpd-php5 .do
This means that whenever we go to a ".do" file in the web browser, it runs as PHP. All of a sudden, after three years of working with no problem, it has stopped working correctly! Now, if I go to a .do file, the browser just downloads the file.
I think that GoDaddy have done a server upgrade, but I can't work out how to solve the problem.
Anyone have any ideas? Thanks in advance....

GoDaddy upgraded EasyApache (from version 3 to version 4) last night.
You should drop the FcgidWrapper and the AddType directives from your .htaccess, and modify AddHandler to:
AddHandler application/x-httpd-lsphp .do
Refresh browser cache after change.

I faced a similar issue. We were able to fix it by replacing the module name to the Apache V 2.4 standard.
In your case, you would need to do:
AddHandler fcgid-script .do
FcgidWrapper /usr/local/cpanel/cgi-sys/php .do
AddType application/x-httpd-php5 .do
We referred the official Apache documentation here. There might be more choices for your context.

Related

Apache runs php files with or without .php extension

My apache runs php files with or without .php extension, How can I disable this and force apache to run php files only with .php extension. I don't want to use .htaccess, this might be an apache config. does anyone know how to disable this option?
Thanks for the answer but using Addtype as you mentioned did not ever work for me, all by itself, even in PHP 5..
Here's what I've tried that DOESN'T work with this version of PHP:
Options +ExecCGI
AddType application/x-httpd-php .php .nusuffix
AddHandler x-httpd-php5 .php .nusuffix
This worked for PHP 5. Now, does not.
This is for a hosted account, so I must do this via .haccess.
You can check your httpd.conf what extensions are configured, it need need to be following. if there is change in your file you can change it to following and restart the apache
AddType application/x-httpd-php .php
more details : https://wiki.archlinux.org/index.php/Apache_HTTP_Server
please add if anything is missing

Parsing .html as PHP in .htaccess for Apache 2.4

I am hosting in a whm/cpanel server and two of my sites were having .htaccess files that would parse .html files to .php.
However, the server is upgraded to Apache 2.4 and PHP to 5.5.38.
Since then the .htaccess files are not parsing the .html as PHP. I contacted the server provider, they said that the syntax for 2.4 is different which they don't know.
I'm a novice. If someone please help me with the correct .htaccess codes and if there is any module to be installed or scripts to be added in the root level, please provide me the step by step guidance - as I will just forward those instructions to the server provider.
Thanks in advance...
I'm not aware of any changes to the AddType or AddHandler directives between 2.2 and 2.4 - it could be the case that your htaccess file simply isn't running (disabled via AllowOverride, etc), or that it contains some other directive that isn't compatible with the new versions.
The required directive should be something like:
AddType application/x-httpd-php .html .htm
or
AddHandler application/x-httpd-php .html .htm
depending on the configuration.
Assuming AllowOveride is such that SetHandler is allowed.. per
http://httpd.apache.org/docs/current/mod/core.html#sethandler .htaccess should look like...
<FilesMatch "\.html$">
SetHandler application/x-httpd-php
</FilesMatch>
Check /etc/apache2/apache2.conf and /etc/apache2/conf.d where AllowOverride is typically set. Check out http://httpd.apache.org/docs/current/mod/core.html#allowoverride for the syntax and list of allowable methods.
The new syntax is:
AddHandler "proxy:unix:/usr/local/php56/sockets/[username].sock|fcgi://localhost" .html .htm .inc

php includes in .htm files

I've read everything here and tried almost all the suggestions, nothing is helping.
I've got several static .htm pages that all call common headers & footers via a php include:
<?php include('inc_logo_nav.htm');?>
So I just moved to a new server with all kinds of higher level security and nothing we have tried helps.. the system refuses to allow these include calls unless I change the file extension to .php
On the old server I was using in my .htaccess:
AddType application/x-httpd-php .html
AddType application/x-httpd-php .htm
But on this new box I had to comment out those lines to get the pages to even come up. The tech guy is stumped too..
back to suphp & seuexec but no nginx
and that didnt help either...
cPanel Server running: CENTOS 6.5 x86_64 vmware – WHM 11.40.
I'm already suffering from loss of traffic, changing all the pages to .php after 20+ years is going to kill the site... Can anyone help here??
Thanks
Have you tried these in your .htaccess?
AddHandler x-mapp-php5 .html .htm
AddHandler x-mapp-php6 .html .htm
I needed them on a server hosted by 1&1 to cause HTML files to be parsed as PHP.

htaccess rule to parse php in html files not working

can't for the life of me work out why this isn't working - on a dreamhost server, I've created an htaccess file and added AddHandler php5-cgi .html .htm to allow php in html files, as per the dreamhost docs. On an identical dreamhost package, I've done the same thing for another site and it worked perfectly, but in this case it just won't parse the php! Is there anything I could have missed here which could be causing the problem? The htaccess is in the web root and isn't being overridden by anything else.
Try this
AddType application/x-httpd-php .html .htm
The above setting will work if the apache is picking php as a module.
AddHandler application/x-httpd-php .html .htm
or
AddHandler application/x-httpd-php5 .html .htm
above will work if apache is executing php as CGI?
there is no harm i would say to put both of the above conditions together but try one over other and see if it work for you.
read more here in this article I wrote.
Is your server using suPHP rather than mod_php or plain php-cgi?
Try using
AddHandler x-httpd-php .html .htm
or
AddType application/x-httpd-php .html .htm
instead.
Postscript
Shared Hosting services use UID based separation on individual accounts from each others. Most use suPHP, but some use suEXEC. They will use one of these. Both act as a su wrapper around php-cgi so you can't tell from the phpinfo()as its PHP scripting engine as this will report Server API CGI/FastCGI in both cases. For CGI initiated scripts, phpinfo doesn't report on the Apache config. You need either to look at your hosting provider's FAQ or possibly try:
<?php
header( "Content-Type: text/plain");
echo system('grep -iR LoadModule /etc/httpd /etc/apache2');
The hosting provider's support forums / FAQ might give specific configuration advice here. Have you tried them?
I've got the same problem as you but I just put this AddType php .html .htm to my .htaccess, it's working.
For me it is working for only like this:
AddHandler php-cgi .php .htm

WAMP PHP/Apache selectively refusing to parse php pages

I have many years experience of working with Apache/PHP/MySQL directly and have only just started using WAMP.
I installed WAMP last week and had my first 4 PHP/MySQL websites up and running immediately. How much easier is this I began to think! That is until I added a fifth site and cannot get php to parse any php file below the websites root directory.
I have a test.php file containing just the word 'hello', ho HTML tags and no PHP directives.
If I place this into /wamp/www/ob/test.php it works, if I place it into /wamp/www/ob/html/test.php the browser comes up with 'You have chosen to open test.php, what should Firefox do with this file? Basically php failed to parse it.
My other sites are working fine with identical setup and this site plus three others were downloaded using Filezilla.
Can anybody help please before I uninstall WAMP and go back to installing Apache/MySQL/PHP manually.
Either the php handler is not turned on for that directory, or the content-type of the returned data is set wrong.
My WampDeveloper Pro setup has this...
<Directory "C:/WampDeveloper/Websites/*/webroot">
AddType text/html .php .php4 .php5 .phps
AddHandler application/x-httpd-php .php .php4 .php5
AddHandler application/x-httpd-php-source .phps
</Directory>
This turns on PHP for all website folders.
Has a DefaultType text/html in httpd.conf for fallback.
Also check any .htaccess files, they might be setting content-type to something other than 'text/html'.
The pages on the Internet that explain how to make Apache parse the PHP that you add to a file with the extension HTML suggest this:
AddType application/x-httpd-php .html .php .htm
AddHandler application/x-httpd-php .html .php .htm
If your Apache server is configured for php5 but not php, then the result, I believe, is the refusal described. I changed what I added to .htaccess to this (notice the digit 5):
AddType application/x-httpd-php5 .html .php .htm
AddHandler application/x-httpd-php5 .html .php .htm
That fixed the problem for me.

Categories