Search and Replace string with SED

sed (Stream Editor) is a tiny cool tool shipped in most linux distros. most of the times I use sed to lookup for pieces of strings in my projects and replace them in cases that I’m moving them from one environment to another.

 to run sed for search and replace purpose on a single file you can do:

The above command will look up the file.txt in and search all occurances of ‘oldstring’ to ‘newstring’.

To do this in a recursive mode and all the files in a directory you can mix it up with find command.

note I’ve passed “.” as the target directory to find, means I should be in the directory that I wish to run the search in. you can also replace “.” with the path of the directory you wish to do your search and replace in.

Install oci8 Extension on CentOS 7 cPanel Server

Today I had to assist a client on setting up his cpanel server to be able to connect to their oracle instance, so I had to get oci8 up and running.

We need to download basic and sdk instant client packages first. Download them from here (if the link doesn’t work due to the article being outdated please Google them) then install them by running:

once that is done we can install oci8 using pecl. if you are using easyapache 4 it means you probably have multiphp enabled. so there is a pecl in each of the php versions bin directory.

install the oci8 using pecl in your desired php version by running :

you can change php71 to php70.