Shared hosting has always very popular among the average website owners as it’s one of the cheapest hosting solution. Not everybody can afford to have their own dedicated server.
While shared hosting may suit most website requirements, in some cases you’ll need to change some PHP settings. And as you don’t have access to server administration, you’ll need to find other ways of changing these settings.
Depending on your web host, there can be three ways of changing the PHP settings.
If you have a very simple PHP application or if all your PHP scripts include a common setting file, you can change the PHP settings using the ini_set() command like this:
<?php ini_set('register_globals', 1); ?>
However, this unlikely to be the best solution if you need to change PHP settings for a complex web application like a blog or forum.
This method will set the PHP settings at the directory level. This means that all the PHP scripts residing in the same directory as the .htaccess file will be using the custom settings.
This will only work on Apache web servers as IIS doesn’t support .htaccess files.
Here’s an example of how to use PHP custom settings in a .htaccess file:
php_value upload_max_filesize 5M php_value post_max_size 6M php_value memory_limit 64M php_value session.auto_start 0
For this method to work, you have to make sure the web server’s administrator as set Apache’s “AllowOverride All” parameter for your website’s directory.
Another way to customize your PHP settings is to create a file named php.ini and to upload it to your web server. This works in a way similar to the .htaccess file except you don’t have to add “php_value” at the beginning of the line:
upload_max_filesize 5M post_max_size 6M memory_limit 64M session.auto_start 0
Unfortunately some web hosts are more restrictive on which settings you can customize and which one you can’t. At this point, you’ll need to contact your server administrator… or switch to another web host!
0 responses so far ↓
There are no comments yet...Kick things off by filling out the form below.
Leave a Comment