Posts

Showing posts with the label Amazon EC2

Amazon AMI install MongoDB Driver

Image
Did an installation of MongoDB driver for PHP on my Amazon EC2 AMI just now. And thought of noting the steps down. Prerequisites  Make sure the following packages are installed. $ sudo yum install gcc $ sudo yum install make $ sudo yum install httpd mod_ssl $ sudo yum install php $ sudo yum install php-devel php-pear $ sudo yum install pcre-devel Install MongoDB driver for Amazon Linux Installing Mongo driver. $ sudo pecl install mongo Enable the driver $ sudo vi /etc/php.d/mongo.ini $ extension=mongo.so $ sudo /sbin/service httpd restart Testing The simplest way to check whether the installation is successful is via phpinfo() . <?php phpinfo(); ?> And you should see the following section: Or test the connection using the code snippet below :) <?php // connect $m = new Mongo("mongodb://mongodb-user:mongodb-password@ds031087.mongolab.com:31087/sample-test-mongodb"); // select a database $db = $m->{"sample-test-mongodb...

Setting up Repo on Amazon EC2 for Git Push

Was trying to setup an instance on Amazon which I can do a git push to update the /var/www/html folder. Decided to share the steps here, so that other beginners like me can benefit too! Prerequisites Setting up Amazone Instance  This article  basically covers all the steps need to fire-up an instance and set the Security Group and SSH . Install LAMP + phpMyAdmin Install LAMP stack is easy, but install phpMyAdmin is slightly tricky. Luckily this github gist explained the steps very well. The only missing part that you might want to take note is the part to change the user of the html directory. sudo chown -R ec2-user /var/www/html/ Setting up Git Setting Up Git Repo to work with /var/www/html folder At first I tried this solution from  stackoverflow post . The method is: Copying .git folder to /var/www/html/ folder. Then use a post-update script to update the git repo. The idea looks logical, and easy to understand, bu...