Change Primary Domain Documentroot in cPanel

Usually the default document root for each cPanel account is “public_html”, this is mostly fine with most of scripts but when it comes to times that you are using a framework which is suppose not to expose the main files in it’s public document root, it gets complicated.

Unfortunately there is no way to change the document root for the primary account of cPanel within the control panel itself, and the only way to do it is to have root access.

If you do have root access on your server then it will be easy to achieve that.

To change the document root simply edit the config file for the account you wish to modify, its located at:

/var/cpanel/userdata/{username}/{domainname.com}

look for the config documentroot and change it to the way you want it.

documentroot: /home/{username}/newlocation

if you got ssl installed on your domain you will need to do the same change for another file at:

/var/cpanel/userdata/{username}/{domainname.com}_SSL

once done run the following cPanel scripts to rebuild the user data cache as well as rebuild the httpd configurations.

/scripts/updateuserdatacache
/scripts/rebuildhttpdconf

Lastly restart the apache by running:

service httpd restart

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:

sed -i 's/oldstring/newstring/g' /some/path/file.txt

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.

find . -type f -exec sed -i 's/oldstring/newstring/g' {} \;

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:

rpm -Uvh oracle-instantclient11.2-basic-version.x86_64.rpm 
rpm -Uvh oracle-instantclient11.2-devel-version.x86_64.rpm

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 :

/usr/bin/ea-php71-pecl install oci8

you can change php71 to php70.

Enable your iCloud Backup right now cause the iTunes Backup Suck!

I tweeted a short video few days ago expressing my anger towards apple update which made the touch screen not responsive in the welcome or “hello” screen. So here is the complete story.

I’ve always hated how apple thinks, although for the past 2 years I’ve been using apple devices daily specially Macbook Pro as my daily driver but it never took away a bit of my disagreement with the way they control how customers use their device.

Last Thursday my boss seeked my help to assist him to migrate his everything from his old iPhone 6s to his newly purchased iPhone X. Well this shouldn’t have been an issue at all because I’ve done that many times without issue but ever-since iOS 11 there were many weird instability bugs doing all these. The older iPhone was running iOS 10, typically I used to be able to make a full backup using iTunes and restore it while setting up the new device. This has been always working out for me but this time I was out of luck.

Continue reading “Enable your iCloud Backup right now cause the iTunes Backup Suck!”

First Day with XOX

I’ve finally pull the trigger and moved my 9 year old maxis number to XOX. I was all blind by the definition of hybrid “postpaid/prepaid” kind of a plan they had which is named “XOX Black”. Well to get a overall of the story, I have been maintaining 2 phone numbers since 7 years ago, when I got a umobile number and used it as my primary number since they had a nicer data plan to offer. So during all these years I’ve had to feed some monthly fees into my maxis line to keep it active and make sure someone else is not going to take over my number.

But that sucked, I wasn’t really able to make use of any of the credit I was buying for the maxis, as my life was getting more boring and I had to spend more time in Office and Home. I decided to find a cheaper data plan and migrate my maxis number to it, something that takes away all the stress of forgetting to top up a secondary phone on the right due date and so on. thats when I found XOX, a newly born mobile Operator in Malaysia running over Celcom Network offering kind of a hybrid postpaid/prepaid like service called XOX Black, a monthly subscription with carry-forward ability to avoid my data package loss and connectivity issues. that just sounded so good and I was all up for the change, some more my maxis card was too old that it did not even support 4G, so I had every single reason to make the change and start my journey with XOX.

Starting off was easy, like most of todays Operators I requested a sim card online to port in my maxis number to their network. The card arrived to me pretty quick, I was satisfied with the hassle-less delivery. I ran up to the office and opened the envelope. Registered my serial number in their website and boom. Lets wait for the port in to happen, I had both the new sim and the old maxis card in my phones. all ready to see the maxis losing it’s connectivity and the XOX to come up. but oops! one the lovely Friday evening while I was in a restaurant with a friend I received an email saying the port in failed because I used the wrong passport number. Well I kind of expected that, I had one of my older passport number registered with maxis and I was not sure which one of them. So I decided to leave it for the next day and call maxis to confirm which passport number do I have with them. The call went quick and easy, found the right passport number and I was all ready to re-submit my application in XOX online app. That is when I realised, damn I do not remember the serial number that was written in the envelope and I left the envelop in the office. I really had zero interest in going back to office on Saturday morning to get the number back, so I decided to try my luck and call xox customer service and see if they can give my my serial number. I did call them and selected the english as the language, the guy picked up and he started greeting me in Malay, well this is fine but I expected that selecting the language while dialing means something to them like any other customer service Centers, I started to explain my case to the customer support guy and he seemed to be able to understand my problem and he asked for my information, once I gave him the info he asked me to stay on the line while he checks. After a short while someone comes to the line and says how can he help, that’s when I asked if he is not the same guy who I was talking to earlier, he said that his colleague wasn’t able to understand what I say. Well I explained everything and he said he will try to check my serial number but because their system was under maintenance at that particular time, I’d had to call them after few hours. I don’t really like the idea of keep repeating my entire story to different customer service people’s so I asked him if it is possible for him to call me back once their system is online and he said sure. He’d be calling me back to the same number I tried to to the MNP once their maintenance is over, well hours passed and nobody called. I knew he was gone so I tried calling them again and spoke to a different person. He told me that their system is online at that time and he give me my serial number. I made it, I resubmitted my mnp request. But it appeared that it was all a waste. There was no changes in my submission status until Monday, so the MNP basically happens only during the weekdays. Last night I received a SMS off the maxis giving me their good bye wish and hoping to have me onboard again in the future. It was nice of them and I kinda missed it, but was super excited with my new half post paid XOX.

Today morning I noticed that my maxis is no longer in service. I went ahead and checked the phone with the xox sim.

But there was no service on that too, I thought that if I put my phone to airplane mode and then switch it back on again it should help. Did it couple of times but appearntly it was useless. Looks like this mnp process is more sophisticated than that, thus it needed a real reboot.

Yay! Rebooted the phone and I was on brand new shiny XOX mobile. All these happened while I was driving to work. Once I reached I tried to install their mobile app. Such a sucky app. It crashed on my iPhone and the one on the Android was so lousy, but who cares I just want a working cheap monthly service.

I didn’t waste a second and went to the process of signing up with them for the first time, but oops! There is no TAC being delivered. Tried it many times. It was saying try 5 minutes later. It was useless. I know porting into network’s causes TAC delivery issues for banks, I remember a friend of mine was experiencing it before. I went ahead to seek help from their customer service again. The CS told me that this issue sometimes happens to some new port in customers. He told me to try requesting a TAC and he’ll be reading it for me. Tried it twice and spent more than 10 minutes on the phone, nope he was not able to receive anything either.

I asked him so what’s the solution, he told me to reconnect to the network by manually selecting the operator in the phone settings. So I hang up the call with the hope that refreshing the connection helps.

It’s 0903 pm now and I’ve tried to request for a TAC from both mobile and web for more than 20 times and I’m yet to receive my TAC code.

Well after all, welcome to XOX. I hope I can sort this out soon. To be fair I’m writing this on my phone using my brand new XOX card 😎