Install Phalcon PHP framework in Fedora

In my last article i discussed that how to install phalcon framework in openSUSE, and i guess it was quite fun and easy. Today i am extending the installation to Fedora. I installed it on Fedora 19, 20 and i hope there would be no problems for anyone, it will be quite simple and easy to install. As we know, we don’t have any repo or RPM at the moment for Fedora, so we will build it from source. Don’t worry it will not be scary. Read this for the dependencies 1st.

Fire up the terminal and i assume that you are in your home dir ([user@localhost ~]$). But no worries, you can change the dir to any where you want like your backup drive etc. Let’s go with home in this article. We need to clone the phalcon repository from github and create the extension from source.

[cc lang=”bash” escaped=”true” nowrap=”false” noborder=”true” line_numbers=”false” lines=”3″ tab_size=”4″]
[user@localhost ~]$ git clone git://github.com/phalcon/cphalcon.git
[user@localhost ~]$ cd cphalcon/build
[user@localhost ~]$ sudo ./install
[/cc]

That will do the necessary for now, one last thing now. Open php.ini in terminal or whatever GUI editor you prefer(i will use vim):

[cc lang=”bash” escaped=”true” nowrap=”false” noborder=”true” line_numbers=”false” lines=”1″ tab_size=”4″]
[user@localhost ~]$ sudo vim /etc/php.ini
[/cc]

And add this line:

[cc lang=”bash” escaped=”true” nowrap=”false” noborder=”true” line_numbers=”false” lines=”1″ tab_size=”4″]
extension=phalcon.so
[/cc]

Save and that’s it. Time to restart the server:

[cc lang=”bash” escaped=”true” nowrap=”false” noborder=”true” line_numbers=”false” lines=”1″ tab_size=”4″]
[user@localhost ~]$ sudo service httpd restart
[/cc]

Download any of the app from the phalcon repo like invo OR vokuro etc, and give it a try.

Enjoy!

Install Phalcon PHP framework in openSUSE

Phalcon is a web framework implemented as a C extension offering high performance and lower resource consumption”. From the benchmark page, “The compiled nature of Phalcon offers extraordinary performance that outperforms all other frameworks measured in these benchmarks”. Personally i find it very easy to work with, less dirs and files for the project. And it’s documentation is quite organized and useful. Installation in Linux distros is quite easy for most of the parts. Let’s install in openSUSE 12.3 and 13.1. 1st of all let’s thank Mariusz Łączak for his useful work to provide repositories. Fire up a terminal and become root by su – .

If you are on openSUSE 12.3, add this repo:

[cc lang=”bash” escaped=”true” nowrap=”false” noborder=”true” line_numbers=”false” lines=”2″ tab_size=”4″]

zypper ar -f http://download.opensuse.org/repositories/home:/mruz/openSUSE_12.3/ Phalcon

[/cc]

For openSUSE 13.1:

[cc lang=”bash” escaped=”true” nowrap=”false” noborder=”true” line_numbers=”false” lines=”2″ tab_size=”4″]

zypper ar -f http://download.opensuse.org/repositories/home:/mruz/openSUSE_13.1/ Phalcon

[/cc]

zypper-add-repo-phalcon

Refresh the repos:

[cc lang=”bash” escaped=”true” nowrap=”false” noborder=”true” line_numbers=”false” lines=”2″ tab_size=”4″]

zypper ref

[/cc]

It will ask for the key to trust for the new repo, just type a to trust always. We are almost there.

Before installation of phalcon, we need to make sure that these dependencies are installed: mbstring, mcrypt, opensll, pdo/MySQL

If not, no worries install it by using this command:

[cc lang=”bash” escaped=”true” nowrap=”false” noborder=”true” line_numbers=”false” lines=”2″ tab_size=”4″]

zypper in php5-mbstring mcrypt openssl php5-pdo

[/cc]

Time to install phalcon:

[cc lang=”bash” escaped=”true” nowrap=”false” noborder=”true” line_numbers=”false” lines=”2″ tab_size=”4″]

zypper in php5-phalcon

[/cc]

And that’s it, but before jumping to your web dir to start a demo project, restart apache:

[cc lang=”bash” escaped=”true” nowrap=”false” noborder=”true” line_numbers=”false” lines=”2″ tab_size=”4″]

systemctl restart apache2.service

[/cc]

Phalcon documentation are self explanatory and easy to follow. Start here for a test project.

Simple bash script to backup database and web server directory aka ezi bakup

I wrote this script long time ago and released its 1st version v0.1 with very initial setup in mind. After that i haven’t got time to look into the code and enhance it further. But today i am going to announce the 2nd version v0.2 with new features plus easy to setup params file. Detailed error description are added to the code for better output. A separate params.ini file to change the settings, so it will be not needed to touch the code if you are not familiar with it. Just setup the params.ini file and you are good to go. As usual it will backup the database and directory you want it to backup for you in your desired location(local system). Even can run it under cron to create backup for you let’s say once a day or a week, that depends on your needs. I will explain the params.ini file in details so you get an idea, how it will work. The archive will include readme.txt, params.ini and ezi_bakup.sh files. readme.txt will contain some basic setup and details about the script. params.ini will contain the settings and ezi_bakup.sh is the meat which will do what you tell it via params.ini.

ezi_backup_output

How to use(params.ini):

[cc lang=”bash” escaped=”true” nowrap=”false” noborder=”true” line_numbers=”true” lines=”10″ tab_size=”4″]
bkdrbool=FALSE
dbbool=TRUE
dbusername=root
dbpassword=
dbname=test
stgdir=/backup/
bakdir=/var/www/test_project

[/cc]

Line 1: set to true if want to backup web server or any dir, TRUE = create, FALSE = skip

Line 2: set to true for database backup, TRUE = create, FALSE = skip

Line 3,4: Database Username and password

Line 5: Database Name

Line 6: Storage/backup directory, where you want to backup your files

Line 7: Directory to create backup of

Cron sample setup:

This will run the script every day at 11PM with a log file created to output log events. Please change the path to the script.

[cc lang=”bash” escaped=”true” nowrap=”false” noborder=”true” line_numbers=”true” lines=”2″ tab_size=”4″]

0 23 * * * /backup/bash/ezi_bakup.sh >> /backup/bash/cron.log 2>&1

[/cc]

Updates:
– Future updates will be directly pushed to bitbucket repository, keep eye on the repository for new features and updates.
– Repository: https://bitbucket.org/mmarif4u/ezi-bakup/

Download:
– Clone the repository. OR
Download it as archive by clicking on the branches tab.

Got any issues with it, feel free to report a bug/issue here.

How to install flash player in fedora 19

Installing flash player in fedora is quite easy. You only need to fire up the terminal and run few commands.

64bit arch:

sudo yum -y install http://linuxdownload.adobe.com/adobe-release/adobe-release-x86_64-1.0-1.noarch.rpm

32bit arch:

sudo yum -y install http://linuxdownload.adobe.com/adobe-release/adobe-release-i386-1.0-1.noarch.rpm

And now install it:

sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux

sudo yum -y install flash-plugin

And that’s it.

Split and Join file in Linux via terminal

Have ever want to split a big file or may be a normal file into multiple parts and later join them. Well, in Linux i would say that is quite easy by using split and cat commands in terminal.

Let’s try it with an example. Open terminal. If you want to read more, the easy way is the Linux man pages. Just type this, and you will get all the help related to split command. Same goes for other commands too.

[cc lang=”bash” escaped=”true” nowrap=”false” noborder=”true” line_numbers=”false” lines=”2″ tab_size=”4″]

split –help

[/cc]

split-help

Let’s say i have a file V-for-vendetta.mkv size of 367 MB in location /backup/Downloads/V-for-Vendetta/. 1st of i want to split this file into 100 MB each part.

[cc lang=”bash” escaped=”true” nowrap=”false” noborder=”true” line_numbers=”false” lines=”4″ tab_size=”4″]

cd /backup/Downloads/V-for-Vendetta

split -b100M V-for-Vendetta.mkv vendetta.mkv

[/cc]

M represents megabytes, K represents kilobytes and B represents bytes. Even can use G for gigabytes and T for terabytes etc. Read help of split for more.

The 1st is the name of the original file (V-for-Vendetta.mkv) and the second one is the new file name. It will split it into 4 parts like vendetta.mkvaa, vendetta.mkvab, vendetta.mkvac, vendetta.mkvad.

slipt-file

split-results

Check the images for the commands and results.

Now is time to merge all the parts into one file again.

[cc lang=”bash” escaped=”true” nowrap=”false” noborder=”true” line_numbers=”false” lines=”2″ tab_size=”4″]

cat vendetta.mkv* > vendetta.mkv

[/cc]

Cat command will do the bits here, nothing fancy here to explain, its self explanatory. Read more about cat from man pages in terminal. Just note the * here, as we removed the aa, ab, ac, ad etc from the original parts name.

join-file-with-cat

after-join-file-with-cat

And that’s it.

Happy splitting and joining.

Setup Git user name/email for github/bitbucket on your machine

So you have github or bitbucket account and repositories setup already. But the problem is if you did not set the user name and email on your machine, most probably you will see ‘Author not mapped‘ with question mark sign. It is because your account is not synced with github or bitbucket. But no worries, it’s quite easy to do that. Open terminal, if haven’t installed git yet, install it 1st and proceed with the steps below.

Method-1: Setting name and email globally:

This method will set your name and email globally which means that you will not need to set it for each repo you create next time.

[cc lang=”bash” escaped=”true” nowrap=”false” noborder=”true” line_numbers=”false” lines=”4″ tab_size=”4″]

git config –global user.name “YOUR_NAME”

git config –global user.email “test12@gmail.com”

[/cc]

Change to your name and email address above.

Method-2: Setting name and email for specific repository:

Here we apply it to a specific repository. Change directory to the root of the repository.

[cc lang=”bash” escaped=”true” nowrap=”false” noborder=”true” line_numbers=”false” lines=”4″ tab_size=”4″]

git config user.name “YOUR_NAME”

git config user.email “test12@gmail.com”

[/cc]

Change to your name and email address above.. Just to verify it in config file:

[cc lang=”bash” escaped=”true” nowrap=”false” noborder=”true” line_numbers=”false” lines=”1″ tab_size=”4″]

cat .git/config

[/cc]

That’s it.