I have a project hosted on Hostgator. I need PHP 5.4 so, as they require, I add the following line to my .htaccess file:
AddType application/x-httpd-php54 .php
The issue is that with this line, any URL throws an error 404. Without this line, everything works fine - but with PHP 5.3 only.
I'm at a loss to understand how this line and error 404 are connected. Anyone has an idea?
It's the php.ini file, probably located in your root user folder. You have to remove/rename it. There is a php.ini incompatibility between 5.2ish and 5.4.
Also, I've never been able to get AddType to work. I've always had to use the older AddHandler.
On a side note, doing some more playing around in the php.ini, I figured out that register_globals=On was causing my 5.4 to hickup. I thought it was shut off, but I guess not... I changed it to off and my phpinfo page came alive.
And even more testing against my original php.ini file, I learned that: "allow_call_time_pass_reference = On" must be commented out...
Long story short, check your user php.ini files...
Related
A while ago, I started having a problem where every few days, my Wordpress site would crash. Instead of loading, the site would just download the contents of index.php.
After some investigation, I found that commenting out the following line in the .htaccess file solved the issue:
AddHandler application/php-70 .php
However, my comment on that line keeps getting over-written somehow.
So here are my questions:
Why is that line causing the issue, and can the root cause be addressed?
If the root cause can't be addressed, how can I prevent my comment on that line from being overwritten?
If I can't prevent the comment from being overwritten, can I add some sort of monitoring to show my what's causing changes to the .htaccess file?
Additional info:
Wordpress 5.4.2 on SiteGround hosting
Seems like some plugin is overwriting your changes in .htaccess, check this link https://wordpress.org/support/topic/php-version-change-can-break-htaccess which addresses a similar problem.
Also, you can follow the instructions here https://www.siteground.com/kb/how_to_have_different_php_versions/ and you should (if you can) change/upgrade your php version to the required version.
Alternately, you can chmod 655 .htaccess file to disable any plugins writing to it.
Good morning. I'm having a major issue with my phpBB installation.
I've transfered it to my computer to develop some plugins, so i'm running it on localhost, but, i've created a vHost with the exact same domain he is running online, so, i don't need to change the cookies configuration, and the database connection information is correct already.
Regard all of that, i'm getting a 500 internal server error, which displays no error on the screen nor the logs from apache and php.
I have error reporting on php as E_ALL also. What could be possible causing this, and what the solution might be?
Thanks in advance, Jorge Ferrari.
If you're getting nothing in the Apache / PHP error logs, then it's more likely to be a server configuration issue. I would suspect the problem is in a file called .htaccess in the phpBB folder. It can be used to customize the configuration in various ways, including things like setting up redirects and URL rewriting.
If the htaccess file tries to use an Apache feature which isn't available on the server, then it can generate a 500 error. You can test this by temporarily removing the file, and seeing if the website works at all (albeit possibly with some glitches).
If you've confirmed that it's the source of the problem, then ideally you'll need to enable the missing feature in the server's configuration (or possibly update the Apache installation). Alternatively, you can delete or comment-out the problematic bits of the htaccess file.
Either way, it sounds more like a webserver admin issue than programming. You might have more luck asking on the phpBB forums, or on a different Stack Exchange Q&A site (possibly Server Fault?).
Check whether you have Rewrite module enabled?(most of the this will be the reason)
In httpd.conf and uncomment
LoadModule rewrite_module modules/mod_rewrite.so
If you try to use module which is not loaded you will get 500 internal server error.
Check your modules used in .htaccess file and check httpd.conf whether used modules are loaded
All I want to do is be able to see a PHP file from the root without it going through the rewrites (thus our custom CMS).
Here's what I've done:
In my httpd.conf, I've commented out the call to load the mod_rewrite module.
Next, I've removed the .htaccess file from the root as it had the rewrite rules in it.
I've rebooted the server.
I've searched through phpinfo() and there are no "rewrite" strings to be found
The problem is that the server still rewrites and the request passes through our CMS.
I'm using XAMP (PHP 3.3.1, Apache 2.2.14)
What am I missing?
maybe cache problem in your browser? because a similar thing happened to me and deleting the cache solved it.
Leave it to the details... I was trying to access my_file.php on the root. However, the filename was actually my-file.php (dash vs underscore).
The page I was getting was a 404, which went through the CMS. When I access the proper file, the one with the dash, I get what I'm supposed to.
I appologize for the waste of time :)
I just set up a local web server on a new Mac running 10.6 (Apache2 / PHP / Mysql). Everything seems to be working fine except when I navigate to SOME (not most) pages Apache downloads php files instead of executing them.
I thought this might have something to do with the time it takes php to execute the script so I increased my "max_execution_time" but it didn't help.
I wish I could give more details but the error logs don't output anything so I really have no idea why this is happening. One thing that might be of significance is that only pages that don't query the database seem to work every time.
UPDATE:
Just discovered something strange that might give more insite into the problem. If I type the following URLs:
localhost/index.php // the home page is served up correctly
localhost/index.php?page=1 // the home page is served up correctly
localhost/index.php?page=home // ERROR: index.php is downloaded !!!!!!!!!!
localhost/index.php?page=contact // the contact page is served up correctly
localhost/index.php?page=blog // ERROR: index.php is downloaded
localhost/index.php?page=10 // the blog page is served up correctly
Uncommenting the following line in /etc/apache2/httpd.conf fixed the problem for me:
LoadModule php5_module libexec/apache2/libphp5.so
You could try adding this to your conf or htaccess:
AddType application/x-httpd-php .php
I know that this was asked a long time ago, but I just encountered this problem so I thought I'd post what the cause was for me.
Make sure that you don't have...
AddHandler application/x-httpd-php5 .php
...in BOTH your .htaccess file and your httpd.conf file. Check your .htaccess file, comment it out, restart Apache, and try again. That is most likely your problem since Apache renders php for some sites but not others. It has to be at the directory level, which would point to a .htaccess file setting.
I stumbled upon this problem after upgrading php to 5.5 and reinstalling apache.
Finally,this fixed it, in case someone else needs it.
apt-get install libapache2-mod-php5
(here's the answer)
I get a 500 server error when I upload my CodeIgniter files online.
500 Server Error
A misconfiguration on the server caused a hiccup. Check the server logs, fix the problem, then try again.
Locally, it works perfectly. I don't know what's wrong when I upload it.
I updated the config files and everything. What am I doing wrong?
CodeIgniter has a lot of files, so I don't know if there is something specific you want to see?
This is whats inside the .htaccess file
# Use PHP5 Single php.ini as default
AddHandler application/x-httpd-php5s .php
Check your hosting company to make sure they run PHP5 and not PHP4. I had this problem with 1and1.com where you had to change your .htaccess file to force the use of PHP5. That solved my problems.
I realized a bizarre issue. If your version of php is 5.4.3 on an ubuntu server (10.04) and you are using the mysqli extension, you would have problems. enable error reporting in your script to pinpoint the errors. This particular version does not support mysqli