[Solved] How to deploy php app to heroku from windows

I am fulltime linux user and parttime windows user. Lately I have started working with windows for some project stuffs. I found windows quite frustating and limited to what linux provided me. Well it’s all personal feelings. I always hated unnecessary installations of extra applications for the same tools which most of the linux distributions provides us out of the box. For e.g. ssh-keygen. To emulate the most of the linux command we need to install cygwin.

I was working on a facebook application and had to deploy it to heroku. I could do this with few commands in ubuntu which already come with those commands preinstalled. I had to do nothing, just push and push as I had already added my SSH keys in heroku settings.

Basic walkthrough on how one can deploy the heroku app using git Bash shell.

To carry out this process you must have git bash shell installed. Download git for windows and install it.
Git Download Link

Download Heroku toolbelt for windows, Download Link for Heorku

Once downloaded install the heroku toolbelt. After installation is complete, you can set heroku path to the environment variable.

c:\set path=%path%;C:\Program Files (x86)\Heroku\bin;

Now start the Git bash shell.
Git bash shell

Note:We installed git bash shell because it already comes with ssh-keygen which is required to generate pair of our keys.

1. Generate SSH Keys for windows

$ ssh-keygen -t rsa

When asked for

Enter file to which to save the key(/c/Users/user/.ssh/id_rsa):
just hit enter then enter your password, re-enter your password.

See the screenshot below:
Generate SSH Keys for windows

You have successfully generated ssh keys and has been saved in location supplied above.

Now, you have to use those SSH keys with heroku. To do this first copy the contents of id_rsa.pub file exactly as it is. You will find this file in C:\Users\user\.ssh\, if you haven’t changed the default folder location while creating ssh keys shown above.

Now, Go to your heroku dashboard, scroll down under section SSH Keys, Click in Add new SSH Key, paste contents of id_rsa.pub here. Then click in Add key. You have successfully added your public key to heroku. Now is the time to test our key.

Also see the screenshot below:
Heroku SSH keys

Upload ssh keys to heroku

$ heroku keys:add

Try to login to heroku use the command shown below, Since we have already added heroku to path. This should work.

$ heroku login

See the screenshot below:
heroku login

If we are using heroku login for the first time, it looks for ssh keys and since we have already created SSH keys and have also added it to heroku, this should work as expected and give us authentication successfull message. That’s it.

2. Add heroku remote repository to the project

$ heroku git:remote -a survey2email-sam

See screenshot below:
Add git repository to heroku

3. After adding heroku remote confirm it. To confirm it use the following command.

$ git remote -v

git remote -v

4. Now push code commits

$ git push heroku master

Enter password that you used to create SSH Key pairs. Wait for a while, heroku is working on your requesting.
After few seconds/minutes depending on your sources you will be shown feedback what is going on. Now you can feel relaxed and have cup of tea.

Push git repository to heroku

Congratulations. You have successfully deployed your PHP app to heroku.

I have skipped some steps assuming that you have basic familiarity with git. The above command assumes that you have already added, commited your codes to repository and want to deploy them to heroku.

If you find any difficulty in following the walkthrough drop your questions in comment box below.

[Solved] Codeigniter session expires frequently

I was working in a Codeigniter project and when I hit refresh button (F5) continuously, My application session was expiring frequently. I googled for a while and found the simple solution.

A solution is to increase the amount of time for the session_time_to_update in codeigniter config.

Since I won’t be updating session frequently. I am setting it to much higher values such as 86400 (24 hours).

Here is my settings

$config['sess_cookie_name']	= 'app_session';
$config['sess_expiration']	= 0;
$config['sess_expire_on_close']	= FALSE;
$config['sess_encrypt_cookie']	= FALSE;
$config['sess_use_database']	= TRUE;
$config['sess_table_name']	= 'app_sessions';
$config['sess_match_ip']	= FALSE;
$config['sess_match_useragent']	= TRUE;
$config['sess_time_to_update']	= 86400; // 24 hours

Since then I haven’t got this problem.

Reference : http://ellislab.com/forums/viewthread/182755/#864970

[Solved] Netbeans- Long running project scan

I use Netbeans for my daily web development. Sometimes I have very huge projects working with SVN, Git Version Controls. And sometimes I use the symlinks in my document root and other project folders. So, you might be wondering why I am mentioning all these things here, So lets get to the point.

Cause for Netbeans Long running projects task scanning ?
Direct from Netbeans bugzilla:: https://netbeans.org/bugzilla/show_bug.cgi?id=207214

Thanks for the snapshot. According the attached snapshot, it looks like org.netbeans.modules.masterfs.filebasedfs.fileobjects.FolderObj.addRecursiveListener() doesn’t work correctly. It tries recursively add the listeners but never ends.

Guys do you have recursive links in your sources? I’m asking, just to be sure that it can be the reason for this behavior.

How to solve ?

Disable the recursive listener.

Add the below line to netbeans.conf file which is found in /etc/netbeans.conf in netbeans root folder.


Here is my netbeans.conf, I have added those lines in netbeans_default_options.

# ${HOME} will be replaced by JVM user.home system property

# Options used by NetBeans launcher by default, can be overridden by explicit
# command line switches:
netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.zip.disableMemoryMapping=true --laf Nimbus -J-Dswing.aatext=true -J-Dawt.useSystemAAFontSettings=on -J-Dnetbeans.keyring.no.master=true -J-Dnetbeans.indexing.recursiveListeners=false"
#netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.zip.disableMemoryMapping=true --laf Metal -J-Dswing.aatext=true -J-Dawt.useSystemAAFontSettings=lcd"
# Note that default -Xmx and -XX:MaxPermSize are selected for you automatically.
# You can find these values in var/log/messages.log file in your userdir.
# The automatically selected value can be overridden by specifying -J-Xmx or
# -J-XX:MaxPermSize= here or on the command line.

# If you specify the heap size (-Xmx) explicitly, you may also want to enable
# Concurrent Mark & Sweep garbage collector. In such case add the following
# options to the netbeans_default_options:
# -J-XX:+UseConcMarkSweepGC -J-XX:+CMSClassUnloadingEnabled -J-XX:+CMSPermGenSweepingEnabled
# (see http://wiki.netbeans.org/FaqGCPauses)

# Default location of JDK, can be overridden by using --jdkhome

netbeans_jdkhome="/usr/lib/jvm/jdk1.7.0_05/"# Additional module clusters, using ${path.separator} (';' on Windows or ':' on Unix):

# If you have some problems with detect of proxy settings, you may want to enable
# detect the proxy settings provided by JDK5 or higher.
# In such case add -J-Djava.net.useSystemProxies=true to the netbeans_default_options.

In case if you wish to send your netbeans snapshot to developers then guide how to do it is https://blogs.oracle.com/netbeansphp/entry/is_the_ide_slow_send


1. https://netbeans.org/bugzilla/show_bug.cgi?id=207214
2. https://netbeans.org/bugzilla/show_bug.cgi?id=206461
3. http://wiki.netbeans.org/FaqScanningAndIndexingIssues

[Solved] Mount of root filesystem failed – Ubuntu

I `dist-upgrade` my system yesterday. And there were few issues with locale package with my terminal. I manually edited the file `/etc/default/locale` and in hasty copy pasted the few codes found online at (http://askubuntu.com/questions/33025/locale-settings-are-not-right-how-can-i-reset-them). I then saved and restarted my laptop to see the changes. Bang ! I began to receive the error.

Mount of root filesystem failed.
A maintenance shell will now be started.
CONTROL-D will terminate this shell and reboot the system.
Give root password for maintenance
(or type CONTROL-D to continue):

I tried to recover with system recovery option but then I got the following error message.
Highlighted in red.

Recovery Menu (filesystem state:read-only)
resume Resume normal boot

Recovery Menu (filesystem state:read-only)

I then first ran the system scan on my linux partition.

# fdisk -l

List all the partition and clearly shows that /dev/sda7 is the Linux partition.
Output of fdisk -l

# e2fsck -C0 -p -f -v /dev/sda7

Since, I guessed the problem might have been caused due to corrupt locale file, I wanted to fix that first to see if that solves the problem and it did finally. I first mounted the root partition, so that it is no longer readonly.

# mount -ro remount,rw /
# vi /etc/default/locale

The first command remounts the root linux partition as read/write so that I can make changes to the files. I then opened the /etc/default/locale in vi and added the missing tag. Saved the file and then restarted the computer.

# reboot

Note: All of the above commands are carried out as root so you have to be very careful before running any unknown commands at this point, you might delete the system files and make the situation more worse. I won’t be responsible if anything happens to your computer after you run the above commands.

After success restart I got my laptop normal. Hope this helps you.