Roshan Book

My Tech Notebook

Tag Archives: hostgator

Increase activeCollab upload limit using htaccess

for activecollab



From hostgator


To increase the upload file size limit on your website, you need to edit PHP’s configuration settings. Unfortunately, not everyone has their own web server, so most of the time people are constrained by the limits of shared hosting. But you can still modify your base php.ini file by creating your own php.ini with the edits that you want.

Your php.ini file needs to be in every folder that’s going to be affected, or at least in the folder where the php script is being called from. Unfortunately if you have dozens of folders that need this edit, then you’ll need dozens of php.ini files.

An alternative is to then use .htaccess. By just placing a.htaccess file in your root folder, all folders beneath it will also have the change. The code to change your PHP max file upload size is:

RewriteEngine On
php_value post_max_size 1000M
php_value upload_max_filesize 1000M
php_value max_execution_time 6000000

You can edit it to suit your needs. 1000M = 1GB, so edit accordingly. Do note that your host will need to allow PHP edits though.





Deploying cakephp on hostgator method 2


Another helpful link :

I just buy new shared hosting account for my new domain on hostgator. I want to install cakephp web application into this hosting. However the local setting or common setting that i used on other hosting is not work on hostgator. After figure out the problem, i found that the hostgator hosting does not allow for changing DOCUMENT ROOT setting.

So after research on cakephp tutorial, which come to setting cakephp on shared hosting and i think this solution also good for production phase. I will mention how i set my cakephp on hostgator

  1. move app, cake, plugins, vendors folder into your hosting root folder. It is user root folder on your hosting
  2. delete .htaccess and index.php on cakephp root folder
  3. move /app/webroot/*.* to /public_html folder
  4. delete empty /app/webroot folder
  5. edit /public_html/index.php to point to the ‘cake’ and ‘app’ directories. For example my public_html path for my domain is /home/myhost/public_html, so i point
    – ROOT to look at /home/myhost
    – APP_DIR to look at /home/myhost/app
    – CAKE_CORE_INCLUDE_PATH to look at /home/myhost/cake
  6. edit this line on /public_html/index.php with your appropriate path
    if (!defined('ROOT')) {
    define('ROOT', DS.'home'.DS.'myhost');

    if (!defined('APP_DIR')) {
    define('APP_DIR', 'app');

    if (!defined('CAKE_CORE_INCLUDE_PATH')) {
    define('CAKE_CORE_INCLUDE_PATH', DS.'home'.DS.'myhost');

  7. The only .htaccess i have on /home/myhost/public_html, the setting for .htaccess look like this
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]

Deploying cakephp on hostgator

I’m having trouble with uploading my cakePHP project on a shared hosting ( from hostgator ). Here is what I have done: I’ve organized my cake distribution like this:

  • home/user/app
  • home/user/cake/cake
  • home/user/cake/vendors
  • home/user/cake/.htaccess
  • home/user/cake/index.php

    I have taken the content of webroot directory from app and put it in

    • home/user/public_html

    I’ve modified this file home/user/public_html/index.php ( the one that was in app/webroot ) changing these lines like this:

    • define(‘ROOT’, DS.’home’.DS.’user’);
    • define(‘APP_DIR’, ‘app’);
    • define(‘CAKE_CORE_INCLUDE_PATH’, DS.’home’.DS.’user’.DS.’cake’);

    And that’s about it.


    I have managed to deal with all the problems involved in the default index.php cakePHP page and I have a green and fully functional so to say, project. So when I access my “/”, I get:

    “Your tmp directory is writable.

    The FileEngine is being used for caching. To change the config edit APP/config/core.php

    Your database configuration file is present.

    Cake is able to connect to the database.”

    Now, I’ve created a model-view-controller with a mysql database background (like in the 15 min Blog Tutorial ), but when I’m trying to access some views ( e.g. /posts )…it gives me a blank page ( this worked perfect on my local machine virtual server apache ).

    What configuration am I missing ?

    Thank you.

EDIT: Apparently I had problems with the hosting. My URL was something like:

and all I had to do was add an extra line in the webroot .htaccess:

RewriteBase /~username/

Thanks for the support.

Getting django up and running on hostgator

This post was originally published at

I thought it would be fun this year to start learning Django, so here’s a bit about how to get it set up using Hostgator (I have a shared hosting account).

I am using Terminal on the MAC and the File Manager on the cPanel.

The first thing you have to do is enable SSH (shell access). To do this, log into your cPanel and go to “Billing”:

Then choose, “View Hosting Packages”:

Then, click the link that says, “Enable Shell Access“.

Next, write down your IP as shown in the cPanel (I blurred mine out for security purposes, but you can see what the section looks like here):

Also, write down your cPanel username and password, you will need this.

Open Terminal and the File Manager in cPanel. I keep both open at the same time to see what I am doing.

In your File Manager, you should see /home/your-username/. Then look for a folder called django. You should have this. If not, in Terminal, type the following to SSH to your account:

ssh -p 2222 your-username-goes-here@your-ip-goes-here

If this works (you might have to wait a moment while it connects to your site), you will be prompted for your password.

Type in your password (you won’t see it at all) then hit enter and wait.

If this is your first time, you will be asked about a key. Just say “yes”.

You might then get some message like, “The authenticity of this host can’t be established” and “RSA key fingerprint is blah blah blah”.

Don’t worry about this, if you like, write down the key in case you need it later. That’s it. You are now connected to your logged in to your account via SSH. Now type the following.

mkdir ~/django
cd ~/django
svn co

mkdir creates a folder called “django”.

cd changes where you are to inside of the “django” folder.

The last line gets the latest stable version of django and installs it into the “django” folder. You need to have subversion installed for this to work.

I can’t really remember if I had to install subversion on my version of OS X, I think it was already installed, but if not, you’ll have to install it. It’s free.

Then, create a directory for your projects inside of the django folder by typing:

mkdir ~/django/projects

You should now have a folder called “django” with two folders inside:

Now, to test if django is running, you make a test project.

In Terminal, type:

cd projects

This will switch you into the projects folder.

Then type: startproject newproject

This tells django to create a new project called, “newproject”.

Then type:

cd newproject
chmod +x
./ startapp newapp

If you go inside of your “newproject” folder you should now see the following:

This is your “newapp”. Yay, django is working…sort of

Next, you have to enable fastcgi (or, I suppose, django will run really slowly).

Create a new file called index.fcgi in your public folder:

Then change the permissions of the file to 755:

Next, edit the file and add the following (be sure to change “username” with your username for your account):

import sys, os, user

# sys.path.insert(0, "/usr/lib/python2.4")
sys.path.insert(0, "/home/your-username-goes-here/django")
sys.path.insert(0, "/home/your-username-goes-here/django/projects")
sys.path.insert(0, "/home/your-username-goes-here/django/projects/newproject")

# Switch to the directory of your project.

# Set the DJANGO_SETTINGS_MODULE environment variable.
os.environ['DJANGO_SETTINGS_MODULE'] = "newproject.settings"

from django.core.servers.fastcgi import runfastcgi
runfastcgi(method="threaded", daemonize="false")

Next, open the .htaccess that is in the same folder as index.fcgi.

AddHandler fcgid-script .fcgi
Options +FollowSymLinks
RewriteEngine On

RewriteRule (media/.*)$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(admin/.*)$ index.fcgi/$1 [L]

Next (and this is important) check your website. If you are getting a 500 error, open Terminal and log in to your account:

ssh -p 2222 your-username-goes-here@your-ip-goes-here

Then type:

which python

This should give you a message like:


If you are getting something different (for example, user/local/bin/python/), update your script to reflect this:


If all goes well, you should see this:

Below is my working code for hostgator

Below are my working code based on Robert code.

1. For curlgen.fcgi – change permission to 755

code is :
import sys, os, user

# sys.path.insert(0, “/usr/lib/python2.7”)
sys.path.insert(0, “/home/r5tpl/django/projects”)

# Switch to the directory of your project.

# Set the DJANGO_SETTINGS_MODULE environment variable.
os.environ[‘DJANGO_SETTINGS_MODULE’] = “newproject.settings”

from django.core.servers.fastcgi import runfastcgi
runfastcgi(method=”threaded”, daemonize=”false”)

For .htaccess code is
AddHandler fcgid-script .fcgi
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ curlgen.fcgi/$1 [QSA,L]

%d bloggers like this: