What is SESSION in PHP ?

What is SESSION ? A session is a mechanism to persist information across the different web pages to identify users as they navigate a site or app A PHP session stores data on the server rather than user's computer.  In a session based environment, every user is identified through a unique number called session identifier or SID.  The session IDs are randomly generated by the PHP engine Starting a PHP Session To begin a new session,...

How to show errors in PHP?

If you are having problem in debugging with your PHP web application and want to display all the errors and warnings, then use error_reporting. The quickest way to display all php errors and warnings is to add these lines to your PHP code file: ini_set('display_errors', 1);  ini_set('display_startup_errors', 1);  error_reporting(E_ALL);    For development server  error_reporting should be set to E_ALL value;  display_errors...

How to Increase File Upload Size in PHP ?

You need to set the value of upload_max_filesize and post_max_size in your php.ini : #Maximum allowed size for uploaded files. upload_max_filesize = 40M #Must be greater than or equal to upload_max_filesize post_max_size = 40M   After modifying php.ini file(s), you need to restart your HTTP server to use new configuratio...

Installing PHP5.6 on Ubuntu 16.04

Installing PHP5.6 on Ubuntu 16.04 sudo add-apt-repository ppa:ondrej/php sudo apt-get update sudo apt-get install php5.6 libapache2-mod-php php5.6-curl php5.6-gd php5.6-mbstring php5.6-mcrypt php5.6-xml php5.6-xmlrpc php5.6-mysql In case, php5.6-xmlrpc gives not found error use: sudo apt-get install php5.6 libapache2-mod-php php5.6-curl php5.6-gd php5.6-mbstring php5.6-mcrypt php5.6-xml php5.6-mysql It will install PHP5.6 on your server sudo...

Find out the elapsed time of a running process #process #terminal

There are a lot of processes running on your Linux system. Here is a command that will let you know how long the process has been running: #ps -eo "%p %c %t"|grep "sshd" In response to the above command, you will get the following output: 2850 sshd 172-01:37:22 29532 sshd 125-09:07:10 In the above command %p is pid, %c is command and %t is elapsed time...

Clearing a log/text file #file

$ >filenam...

How to check the date and time the system was rebooted #terminal #reboot #security

Here is a simple command to check the system's reboot date and time: #last reboot reboot system boot 2.6.18-53.el5 Sat Aug 6 18:02 (8+04:45) wtmp begins Sat Aug 6 18:02:07 2011 The command below will give you the date and time the system was booted: #who -b system boot 2011-08-24 09:4...

Securing files #terminal #security #file

Here is a simple tip to password protect your files: vi -x test This command will ask for an encryption key. You have to type the key twice. Then save and quit the opened file. Now, whenever you open this file, it will ask for that password first...

To display network statistics #netstat

netstat -...

To display all open network sockets #netstat

netstat -u...

To display the kernel routing table #netstat

netstat -...

To display the kernel interface table #netstat

netstat -...

Cut specific logs #file #vi #cut

If you need to cut specific logs from the complete log of any application, here is a tip that will be of help. Open the log file in a vi editor and set the editor to display the line number: vi server.log :set nu The above process will provide you the line numbers in the logs. You can then search for the specific string and note down the line number (e.g., 550). Now, note down the last line number by using Shift+G (e.g., 780) sed -n 550,780p...

Print a file with line numbers #file #nl

If you want a file with line numbers (say for printing), you can use the 'nl' command in Linux: $ nl file.c This prints the file with line numbers to standard output or this can be even redirected to a file as shown below: $nl file.c > output.txt Here, output.txt will have the codes of file.c with each line having a line number...

Measuring the network throughput between two Linux systems #networking #throughput

Iperf is a tool that measures the bandwidth and the quality of a network link. It can be installed very easily on any Linux system. One host must be set as the client and the other one as the server. Make sure that iperf is installed on both systems. If it is not installed, then use your package manager to install it before trying this tip. Now run iperf on one of the Linux systems as the server, as shown below: linux-erv3:/home/test/Desktop...

Find your OS and distribution name #terminal #system configuration

Here is a tip that will let you know the name of the OS, along with other details: [root@vl-pun-blg-qa27]# lsb_release -a LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch Distributor ID: CentOS Description: CentOS release 5.5 (Final) Release: 5.5 Codename: Fina...

View the contents of tar and rpm files #tar #rpm

Here are two simple commands to show you the contents of the tar and rpm files. 1. To view the content of a tar file, issue the following command: #tar -tvf /path/to/file.tar 2. To view the content of an rpm file, use the command given below: #rpm -qlp /path/to/file.rp...

Find your MySQL configuration file #mysql #grep #file

We often have to administer a system that has been set up by someone else. In such a situation, it's difficult to find the correct configuration files for different applications. Here is a tip to find the correct configuration file for MySQL: mysql -? | grep ".cnf...

Replacing '\n' with 'space' in each line of a file #replace #awk

You can use the awk statement given below to remove the '\n' from each line and replace it with a blank space: awk '$1=$1' ORS=' ' /etc/passw...

Comment out hashes in large configuration files

Here is a small tip for system administrators, who need to tackle large configuration files, which include lots of commented lines (marked by #). With this tip you can remove all those hashes and provide only an uncommented configuration view for faster lookup into the file. If you want to check the configuration file of the Squid proxy server, run the following command: #cat squid.conf | egrep -v ^# This will show only lines that do not start...

Run a linux command after every reboot

This tip allows you to run any Linux command or script just after system reboot. You can use the @reboot cron keyword. If you have a script in your /home directory and it needs to be run on every boot, open the cron file in editable mode and add the following: $crontab -e @reboot /home/xyz/myscript.sh Do remember to enable crond on boot...

Connecting to a remote Linux Machine

  If you want to execute any command or script on a remote Linux machine, you can use ssh. Below are a few examples. The syntax for running a command or script on a remote server is: ssh [USER]@[IP] [command or script] Let us look at how this can be done. Suppose you want to display the directory contents of /root of a remote host, you can run the following command: [user@ubunu]$ ssh root@192.168.0.128 ls -l /root root@192.168.0.128's...

Installing PHP7.2 on Ubuntu 18.04

Installing PHP7.2 on Ubuntu 18.04 sudo add-apt-repository ppa:ondrej/php sudo apt-get update sudo apt-get install php7.2 libapache2-mod-php php7.2-curl php7.2-gd php7.2-mbstring php7.2-mcrypt php7.2-xml php7.2-xmlrpc php7.2-mysql In case, php7.2-xmlrpc gives not found error use: sudo apt-get install php7.2 libapache2-mod-php php7.2-curl php7.2-gd php7.2-mbstring php7.2-mcrypt php7.2-xml php7.2-mysql It will install PHP5.6 on your server sudo...

Installing PHP7 on Ubuntu 16.04

Installing PHP7 on Ubuntu 16.04 sudo apt-get update sudo apt-get install php libapache2-mod-php php-curl php-gd php-mbstring php-mcrypt php-xml php-mysql php-xmlrpc In case, php-xmlrpc gives not found error use: sudo apt-get install libapache2-mod-php php-curl php-gd php-mbstring php-mcrypt php-mysql php-xml It will install PHP7.0 on your server sudo systemctl restart apach...

How To Find your Server's Public IP Address

If you do not know what your server's public IP address is, there are a number of ways you can find it. Usually, this is the address you use to connect to your server through SSH.From the command line, you can find this a few ways.     ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//'This will give you two or three lines back. They are all correct addresses, but your computer may only be able to use one of the...

Install Apache in Ubuntu 16.04

We can get started by typing these commands:     sudo apt-get update     sudo apt-get install apache2 Since we are using a sudo command, these operations get executed with root privileges. Open up the main configuration file with your text edit:     sudo nano /etc/apache2/apache2.conf Edit the following line replace server_domain_or_Ip with your server domain or IP:     ServerName...

Hide Apache ServerSignature / ServerTokens / PHP X-Powered-By

Hiding and modifying Apache server information Fortunately, such data can easily hide and modify by changing the ServerSignature and ServerTokens directives. ServerSignature ServerSignature configures the footer on server-generated documents. Just like example 404 error page. Normal use it’s better hide whole signature and add or modify httpd.conf file or apache.conf file following row: ServerSignature Off ServerTokens Configures...

What is Jenkins?

What is Jenkins? Jenkins is an cross-platform, continuous integration and continuous delivery application. Used to : build and test your software projects continuously continuously deliver your software  Advantages :  free source that can handle any kind of build or continuous integration can integrate Jenkins with a number of testing and deployment technologies cross-platform Features: Easy...

Vulnerabilities in Web Applications

Vulnerabilities in web application A vulnerability is a system flaw or weakness in an application that could be exploited to compromise the security of the application. These crimes target the confidentiality, integrity, or availability (known as the “CIA triad”) of resources possessed by an application, its creators, and its users. It’s not until after a breach has occurred...

Infrastructure as Code

"Infrastructure as Code (IaC) is the process of managing and provisioning computing infrastructure and their configuration through machine-processable definition files, rather than physical hardware configuration or the use of interactive configuration tools. The definition files may be in a version control system. This has been achieved previously through either scripts or declarative definitions, rather than manual processes, but developments...

Continous Delivery

"Continuous delivery is a DevOps software development practice where code changes are automatically built, tested, and prepared for a release to production. It expands upon continuous integration by deploying all code changes to a testing environment and/or a production environment after the build stage. When continuous delivery is implemented properly, developers will...

Continuous Integration

Continuous Integration (CI) is a development practice that requires developers to integrate code into a shared repository several times a day. Each check-in is then verified by an automated build, allowing teams to detect problems early. Teams practicing continuous integration seek two objectives: minimize the duration and effort required by each integration episode be...

What is DevOps?

DevOps is the combination of cultural philosophies, practices, and tools that increases an organization’s ability to deliver applications and services at high velocity: evolving and improving products at a faster pace than organizations using traditional software development and infrastructure management processes. This speed enables organizations to better serve their customers and compete more effectively in the market. Devops Engineer...

What is JMeter ?

What is Jmeter ? And Why to use it? An open source tool used for knowing how efficiently a web server works or how many concurrent requests can a web server handle. Apache JMeter may be used to test functional and performance both on static and dynamic resources (files, Servlets, Perl scripts, Java Objects, Data Bases and Queries, FTP Servers and more). It can be used...

SSH SECURITY (enable CTR or GCM cipher mode encryption)

The SSH server is configured to allow either MD5 or 96-bit MAC algorithms, both of which are considered weak. disable MD5 and 96bit MAC algorithms The SSH server is configured to support Cipher Block Chaining (CBC) encryption. This may allow an attacker to recover the plaintext message from the ciphertext. disable CBC mode cipher encryption, and enable CTR or GCM cipher mode encryption This means that if two machines are connecting to each...

What are second-level domains (SLD) and country code second level domains (ccSLD)?

A second-level domain (SLD) is the portion of the domain name that is located immediately to the left of the dot and domain name extension. Example 1: The SLD in coolexample.com is coolexample. Example 2: The SLD in coolexample.co.uk is still coolexample. You define the SLD when you register a domain name. A country code second-level domain (ccSLD) is a domain name class that many country code top-level domain (ccTLD) registries implement. The...

What are top-level domains (TLD) and country code top-level domains (ccTLD)?

A top-level domain (TLD) is the part of the domain name located to the right of the dot (" . "). The most common TLDs are .com, .net, and .org. Some others are .biz, .info, and .ws. These common TLDs all have certain guidelines, but are generally available to any registrant, anywhere in the world. There are also restricted top-level domains (rTLDs), like .aero, .biz, .edu, .mil, .museum, .name, and .pro, that require the registrant to represent...

What is a Domain Name?

What is a Domain Name? New computer users often confuse domain names with universal resource locators, or URLs, and Internet Protocol, or IP, addresses. This confusion is understandable. It is worth learning the differences between them because these terms are ubiquitous. It is also helpful to be able to use terms correctly when communicating to technicians or other people within a professional organization. This naming convention is...

Factors that affect DNS propagation time

What factors affect DNS propagation time? When you update the DNS (Domain Name System) records in your domain name's zone file, it can take up to 48 hours for those updates to propagate throughout the Internet. While we strive to make updates as quickly as possible, the DNS propagation time for your domain name depends on several factors that we cannot control. Many of the updates you can make in the Domain Manager affect the DNS records...