Heroku Cloud With PHP : Advanced Commands for Perfect Setup


Heroku Cloud is an excellent cloud PaaS for free of cost for the developers to test or even run serious instances. Here is some extra shining tips for Heroku. We have quite number of articles on Heroku Cloud; you can simply search with the the phrase Heroku Cloud in the search box of this website to get the list as search result. At minimum, read this one article view the Video Guide on Installing WordPress on Heroku Cloud. That guide was done on Ubuntu, for installing Heroku Tool Belt on Mac OS X, follow this guide.

 

Heroku Cloud With PHP : Fix All the Missing Parts

 

It is unfortunate that OS X 10.8 has been bit different than the older our ‘normal’ UNIX like OS from command line. So, if you have not ‘calibrated’ your command line tool, first fix them. You will need to install the minimum things, which are actually covered in that article.

On the Heroku Cloud Server side, the definite issue of Heroku Cloud is – missing PHP zlib extension. For ‘forgetting’ this thing, we basically can not update the plugins of (on Heroku Cloud) from Admin. Other missing things, most developers cum bloggers has fixed are – cache, a webroot etc. We will however point out two basic things people get stuck – first time login, creating a SSH key pair and then fixing the missing PHP zlib extension by installing it.

 

Installing PHP zlib extension on Heroku Cloud

 

The steps are almost same for Ubuntu and Windows too, but specifically this is for full OS X Server administration (read Mac OS X 10.8). First directory to .ssh :

 

cd ~/.ssh

 

This is very nice command, you will get a 1024 bit key pair (public and private keys) with no password prompts and many extra things :

 

ssh-keygen -b 1024 -t dsa -f id_dsa -P ''

 

Heroku Cloud With PHP


Then :

 

touch authorized_keys2

 

Next :

 

cat id_dsa.pub >> authorized_keys2

 

Set the permission rightly for it :

 

chmod 400 id_dsa

 

Add the public key :

 

heroku keys:add

 

Installing PHP zlib extension on Heroku Cloud

If your App’s name is afternoon-autumn-6095 ; then clone it you need to run :

 

git clone git@heroku.com:afternoon-autumn-6095.git -o heroku

 

Else create a new app :

 

heroku create --stack cedar

 

The next steps of adding git are already written in the previous guide. In short, change directory to that cloned app folder, change app as you need and push it. Now the important steps and commands are :

 

heroku run bash

 

It is practically indicating you do have the shell with root permission. I have not discovered the way, its two people worked quite nicely. Run the commands one by one, please understand WHAT you need to change (do not copy paste blindly):

 

export PS1="\u@\h \w> "
mkdir tmp
cd tmp
git clone https://github.com/php/php-src.git -b PHP-5.3
cd php-src
cd ext/zlib
/app/php/bin/phpize
./configure –with-php-config=/app/php/bin/php-config
cd modules
scp zlib.so user@host:~/destination
mkdir -p lib/php
mv zlib.so lib/php
echo "extension = /app/www/lib/php/zlib.so" > php.ini
mkdir src/app/cache
touch src/app/cache/.placeholder
git add php.ini lib/ src/app/cache/
git commit -m "Write whatever you want"
git push heroku heroku:master

 

This the part of installing PHP zlib extension on Heroku Cloud. Basically, you add a web root, use it with all features just like a webserver with root access.

 
Abhishek-Ghosh


0saves
If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

Mentions

  1. Heroku Cloud Advanced Commands says:

    [...] Heroku Cloud Advanced Commands [...]

  2. xecute bash Commands on Heroku Cloud says:

    [...] Execute bash Commands on Heroku Cloud to get more control and in this way you can install extra [...]

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>