Php 4 on cpanel

Here are a few articles that mention it:

https://documentation.cpanel.net/display/EA/Custom+Modules
https://forums.cpanel.net/threads/how-to-easy-php4-php5-side-by-side-after-removal-of-php4-from-easyapache.304942/
http://www.liquidweb.com/kb/the-end-of-php-4/

How to switch to a different PHP version?

You can set the handler for the site using a .htaccess file in the domains webroot with the following contents:
Code:
AddHandler application/x-httpd-php4 .php .php4 .php3

Enable gzip on WHM/cPanel

To enable gzip, login to cPanel account for the user account which GZIP compression wants to be turned on. Then click on Optimize Website under Software / Services. Choose Compress All Content or Compress the specified MIME types to enable GZIP compression on all websites hosted by the particular account. Click on Update Settings when done.

MIME types include text/html, text/plain, text/xml, text/css, text/javascript, application/javascript, application/xhtml+xml, application/xml, application/rss+xml, application/atom_xml, application/x-javascript, application/x-httpd-php, application/x-httpd-fastphp, application/x-httpd-eruby, and image/svg+xml.

Once you’re done you can easily test to see if the compression is working by using the gzip test tool here: http://www.gziptest.com/

SCP Examples

How to secure copy a file from remote server to to local directory:
/home/user/file.txt = remote file
/home/user/Desktop/ = path to copy to local system


# scp -r user@remote.server.com:/home/user/file.txt /home/user/Desktop/

-r Recursively copy entire directories

What if the port is on 2243?

Use:

# scp -P2243 -r user@remote.server.com:/home/user/file.txt /home/user/Desktop/

# scp -P -r user@remote.server.com:/home/user/file.txt /home/user/Desktop/

-P port Specifies the port to connect to on the remote host. Note that this option is written with a capital ‘P’, because -p is already reserved for preserving the times and modes of the file in rcp(1).

-p Preserves modification times, access times, and modes from the original file.

Copy from local to remote:

# scp -P 22 file.txt root@192.168.1.1:/vmfs/volumes/datastore1/ISO

Find Mysql Connection script

Recently, I had to find a connection script for mysql as the clients programmer had gone away. I knew the database username and here is the grep command that found it.

# cd /var/www/vhosts/domain.com/httpdocs
# grep -r 'database username' *

* Where database username is the actulay database username in the plesk database