How to switch to PHP5 using .htaccess
Many shared server environments currently run .php scripts using the PHP4 interpreter and .php5 code using the PHP5 interpreter. Rather than changing all your file extensions, and perhaps breaking many links, use a .htaccess file to dynamically map one extension to the other.
IMPORTANT CAVEAT: One common reason for doing this is that hosts leave PHP4 configured with register_globals ON in order to support legacy code while offering PHP5 with register_globals OFF. If you are on a shared server at a host that has configured register_globals ON server wide, you should be very worried!
Turning register globals OFF via a local php.ini or a .htaccess file will NOT offer you any extra protection. Another exploited account on your server can simple hack yours. For server security, and since php 4.2, register globals is OFF server wide by default (php default). Any host overriding this is inviting trouble. If you need register globals ON for a specific site, simple use a .htaccess file for that specific directory, and server wide security will not be compromised. Of course, if you do this be sure all effected scripts fully sanitize input data.
- Your Apache server must be configured to use .htaccess files. If not, you may be able to request this from your host.
- Your Apache configuration must allow the following setting. If not, you may be able to request this from your host.
- Your host must have configured the .php and .php5 file extensions as described above. If not, they may possibly have chosen other extensions. Check with your host.
- Check to be sure your site is configured to use .htaccess files.
- Make a backup of the .htaccess file in your root public_http directory. If you don't have a .htaccess file at this location, create one now.
- There are various ways to set the command, depending on your server configuration. One of the following will probably work. Add ONE the following lines at the end of your .htaccess file. If unsure which to use, check with your hosting provider on which version works best for your configuration.
AddType x-mapp-php5 .php
AddHandler application/x-httpd-php5 .php
AddHandler cgi-php5 .php
4. Carefully test.
5. Delete the backup .htaccess file. Don't leave backups of .htaccess files in public directories.
- Category: Webmaster
Setup a cron job that runs on every 15 minute using Crontab in Ubuntu 16.04
Ubuntu 27-09-2017 Hits: 210
Do you want to be an SEO expert?
SEO 10-07-2017 Hits: 460
How to Increase the Views of YouTube Videos in Organic Ways
Social Media 04-06-2017 Hits: 710
Facebook Ad Retargeting: How Does Facebook Get The Whereabouts of Our Visited Websites?
Social Media 21-05-2017 Hits: 722
Increase Twitter Engagement: 11 Easy How-Tos
Social Media 11-05-2017 Hits: 748
How to Use WordPress Custom Logo API: With Code Example
WordPress 07-05-2017 Hits: 1189
10 Important WordPress Plugins and Tools for SEO to Rank Your WordPress Website Even Better
WordPress 20-04-2017 Hits: 1292
Most Read Tutorials
How to combine all .vcf files to single .vcf file manually to merge into Gmail Contacts
Webmaster 23-05-2015 Hits: 75680
Get component, module and plugin parameters in Joomla 3
Joomla 3.0 24-07-2014 Hits: 34048
How do you detect a website visitor's country?
Webmaster 30-05-2013 Hits: 19093
Troubleshooting Joomla 3.0 Database Connection Errors
Joomla 3.0 17-03-2013 Hits: 18610
Fixing JFolder::create: Path not in open_basedir paths
Joomla 3.0 22-02-2014 Hits: 17079
How to setup SMTP in Joomla 2.5 to send emails
Joomla 2.5 23-07-2012 Hits: 16681
How to add Google Analytics code in Joomla! 2.5 template
Joomla 2.5 14-07-2012 Hits: 15725
Open a Port in Firewall in Windows 7 OS
Windows 18-07-2012 Hits: 15708
How to fix 'Creating default object from empty value' PHP warning in Joomla
Joomla 3.0 23-10-2013 Hits: 15287
Using Popover on Hover with Twitter Bootstrap in Joomla 3
Joomla 3.0 06-07-2013 Hits: 14787
Store user state variables in Joomla 2.5/3.0
Joomla 3.0 24-03-2013 Hits: 14442
NetBeans auto completion does not show class methods when using Singleton design pattern
Joomla 3.0 24-02-2014 Hits: 9324