How to check what PHP version running on Linux?

It’s very simple to check PHP version

1. PHP Info

You can use the following to yield PHP version number via Command Line

php -i

or

You can create a php file contain the following, upload it to your website

phpinfo();

Note: if your sys admin disabled phpinfo, you cannot check what PHP version with phpinfo()
2. Short Info in SSH

 

You can use the following to yield PHP version number via Command Line

php -v

or

php -i | grep 'PHP Version'

Compress files with Gzip and Zip in CentOS

Gzip
Type the following command to compress a file at a shell prompt

gzip filename.ext

-> The file will be compressed and saved as filename.ext.gz

Type the following command to expand a compressed file

</code><code>gunzip  filename.ext.gz</code><code>

-> The filename.ext.gz is deleted and replaced with filename.ext

Type the following command to compress multiple files at a shell prompt

</code><code>gzip filename.gz file1 file2 file3</code><code>

->  this command will compress file1, file2, file3 and put them in filename.gzip.

Zip
Type the following command to compress a file at a shell prompt

</code><code>zip -r filename.zip files</code><code>

->  filename represents the file you are creating and files represents the files you want to put in the new file

Type the following command to expand a compressed file

</code><code>unzip  filename.zip</code><code>

Type the following command to compress multiple files at a shell prompt

</code><code>zip filename.zip file1 file2 file3</code><code>

-> this command will compress file1, file2, file3 and put them in filename.zip

If you add directory to multiple files

</code><code>zip filename.zip file1 file2  file3 /user/work/school</code> <code>

->  this command will compress file1, file2, file3, the contents of the /user/work/school directory and put them in filename.zip