Install new programs to a shared-hosting server ( without su / root )

This information is for educational purposes only, and is not guranteed to work for all cases. Attempting the steps below might violate your hosting provider’s terms of agreement. For example, check out this excerpt from Godaddy’s legal hosting agreement.
Proceed at your own risk! 😀

Before we begin
Many website hosting companies prevent their customers from installing new software to shared-hosting servers. They restrict use of the GCC(Gnu Compiler Collection) tools, because the GCC can be used to build executable programs from source code. Although this is great for the hosting company’s security and server performance, it’s a less than ideal situation for any website owner to be forced to use out-of-date versions of software. Below, I’ve outlined a work-around around which helped me get around a big-name hosting provider’s GCC usage restriction. For any website owners seeking flexibility, Virtual Private Server(VPS) or Cloud hosted instance are both a much better option than shared-hosting.

Discover installed software

Install Libraries & Create Folders

Download Install GNU C compiler

Discover current configuration and installed software ( type and version)
Before trying to download or install anything, it helps to know what kind of system the hosted server is running on. Do this with uname -a The system I used for this example was running Linux Kernel version 3.10 and seemed to be a CentOS based distribution. First thing I did was to check for already installed package-manager. The two major ones are .deb(Debian distros ) and .rpm. (Red Hat distros ) Use “which” command to find out which version your server uses. I checked for a Debian package manager with:
which dpkg

Check for Red Hat package manager.
which rpm

Rpm is installed

I’ll be using the rpm(RedHat Package Manager) in this guide, but the process should be be similar for a different package manager.

Install Libraries & Create Folders
In your home directory, create source folder to hold extracted files and another for the binary files. cd ~
mkdir ~/src
mkdir ~/bin
Add the ~/bin directory to your executables PATH. code>export PATH=~/bin:$PATH

Download Install the GNU C compiler
Now we need to download GCC which will compile the programs. Before doing this, check the system for the currently installed version. If you do not have execute permission for the compiler in /bin/gcc, then running gcc --version will not work. Instead query the package manager on your server to find out which version of gcc is installed. That command for me was:

rpm -qa | grep gcc

Take note of the version number and then hop over to to find a gnu package which matches the version from the command above. Now we need to extract the files from the gcc package to a directory of our choice. This next step differs slightly for each package manager. For rpm, I found the following guide to be a great help: We need to extract all files from the package but maintain directory structure as if a super user unpacked them. This command does just that for rpm packages: rpm2cpio gcc-4.4.7-23.el6.x86_64.rpm | cpio -i --no-absolute-filenames -d -m -v
Flags used with cpio:
-d --make-directories
-m --preserve-modification-time
-v --verbose
After unpacking, find the gcc binary in the “bin” directory, and add it to your PATH using: ln -s ~/path/to/gnu/compiler/bin/gcc ~/bin
At this point I tried to compile one of my favorite programs, tree , and was met with yet another error message: "ld not available"
The man page for ld describes ld: “… ld combines a number of object and archive files, relocates their data and ties up symbol references. Usually the last step in compiling a program is to run ld…” Ld is one of the tools contained within the binutils package, so the next step is to install binutils that and hope there are no more major hurdles to clear.

Install binutils
To find the version of binutils compatible with the server, run

Binutils version check
rpm -qa | grep binutils

Take note of the version value and try to find the exact version on the GNU software website. The New York-based RIT server has a ton of download packages and mirrors and worked great for me. After downloading the package, extract the files, find and run the .configure script to build ld. Next, add ld to your path ln -s ~/path/to/binutils/bin/ld ~/bin

Install new programs!
If you made it this far, you should be able to install programs on the server. I usually search for a pre-compiled binary on before I try compiling from source. Expect to receive the odd error message here and there, for a missing library, or from install scripts trying to save files in location without write permissions. Remember to create a link for each newly compiled binary eg. "ln -s ~/path/to/binary/directory/binary-file"
, and place the link inside your home binary folder( eg. ~/bin )

Other Guides
If you were unable to find a compatible gcc binary, you might have success grabbing the binaries from a virtual machine with a distro similar to that of your server. This virutal machine would ideally have the same kernel version and cpu architecture as your server. Here’s another guide to achieve the same result using a different methods:

Abusive Activities and Other Threats. You acknowledge and agree that you may not use our servers and your website as a source, intermediary, reply to address, or destination address for mail bombs, Internet packet flooding, packet corruption, denial of service, or other abusive activities that threaten the stability of our network or will damage the systems of, or cause a disruption of internet services to, GoDaddy, our customers, or third-parties. Server hacking or other perpetration of security breaches is prohibited and we reserve the right to remove sites containing information about hacking or links to such information. Use of your website as an anonymous gateway is prohibited. We prohibit the use of software or scripts run on our servers that cause the server to load beyond a reasonable level, as determined by us. You agree that we reserve the right to remove your website temporarily or permanently from our servers if you are in violation of this Service Agreement and/or there are activities that threaten the stability of our network. You acknowledge and agree that all websites associated with your hosting account may be removed if one website is in violation of this Service Agreement. You further acknowledge and agree that GoDaddy reserves the right to scan your hosted account for malicious content (e.g., malware), and that, in the event any such content is discovered, it may be removed in GoDaddy’s discretion for security purposes.

MySQL cli vs. PhpMyadmin

When I first started using Mysql, I relied heavily on the Phpmyadmin in-browser control panel for database administration. Eventually the feeling of reliance on the GUI became became so unbearable that I switched to using the command line mysql client to communicate with the database server. Here is how I use the the Mysql cli with Vim to accomplish tasks such as user creation, and search-replace operations.

Why use the Mysql cli

Using the command line interface offers offers several benefits. Visually there are less distractions when compared with. I find that I pay much more attention to each keypress and am inclined to pay attention to every character of output the cli displays. The cli experience is also snappier being ‘closer’ to the databse, and feels more interactive. Though I don’t mind using Phpmyadmin, it always feels good to eliminate a possible point-of-failure, even with such ubiquitous tool where bugs are unlikely. Update 9/18/19: A few months ago when I wrote this post, I thought this might be a stretch to suggest, but it looks like increased security is indeed a legitimate reason to choose the CLI. Check out this article on

MySql Vi Config

To set the mysql pager to vim( or less, nano etc.) Simply enter the following command (including the minus sign ): \P vi -
pager     (\P) Set PAGER [to_pager]. Print the query results via PAGER.

Vim will open each query result in a temporary file which you can then navigate/search/edit like any other text file. It is also possible to use the \e flag to enter editing mode and then use vim to structure your query before executing it.
edit      (\e) Edit command with $EDITOR.
I use the “HELP” query to obtain the proper syntax of unfamiliar commands. It’s usually quicker than switching tabs to search the online documentation. It’s also great to have the results in vim so that the text can be quickly manipulated in-place to form the next query. To view the same results using Phpmyadmin, I had to select the “Full texts” option under “Options”.   PhpMyAdmin is a great choice for those uninterested in becoming comfortable on the command line. However, for the rest of us, choosing to use the cli version will eventually lead to more efficient database use. Also vim users enjoy the added benefit of stacking skills by using vim as the primary pager. It’s a great way to maintain the familiarity with the editor’s options and abilities, which comes only from frequent use.

Reset worpdress password on development site / localhost

When running WordPress on a testing environment( localhost), I use generic usernames and passwords which are easy to remember.
Unfortutely, sometimes, I choose more difficult p@$$w0rd5 which I inevitable forget. After multiple failed attempts to remember whether I used two or three dollar signs, and in what order, it is time to give-up and reset the password.
Although using wordpress’ “Lost your password” feature will work in most cases, there are times when you may be working offline, or do not have access to your email.
My preferred fix in this situation is, to write the text contents of the reset email to a file. This avoids any need to manually edit hashed password values in the database.

Outputting reset info to a text file can be accomplished with the addition of a single line to the login file ( default login file name is “wp-login.php” ).

Open the login file and locate the “retrieve_password()” function.
Within the function find the last line of text that is appended to “$message”, and insert this code immediately after it:

file_put_contents('reset_email.txt', $message);

Your login file should resemble the image above

Using your web browser, open the word-press login page, click the “Lost your password” link, and enter your user name when asked. The reset email should now be saved in your web root directory

Using your system file browser, check inside the website root folder. If the reset was successful you should find the ‘reset_link.txt’ file there. It should contain text which looks something like …

Someone has requested a password reset for the following account:                        
Site Name:                                                                        
Username: usernm                                                                             
If this was a mistake, just ignore this email and nothing will happen.                          
To reset your password, visit the following address:                                            

Copy and paste the reset address in your browser url bar to reset the password.
If you chose to save the reset_email.txt file to a different location then apache will need write access to the directory.

If you are familiar with using a line-by-line debugger, you could also set a breakpoint immediately after the url has been appended to theĀ  “$message” variable and copy the url value from your debugger watch window.