USA 866-611-1556 : Intl 646-328-7520

Linux

Update PHP 5.6 on CentOS/RHEL 7.2 and 6.8 via Yum

PHP 5.6.26 has been released on PHP.net on 16th September 2016, and is also available for CentOS/RHEL 6.8 and 7.2 at Webtatic via Yum.

Update 2015-08-22 – Webtatic now has released PHP 7 RC1 for CentOS/RHEL 6 and 7

PHP 5.6 adds new features such as:

  • constant scalar expressions
  • variadic functions
  • argument unpacking
  • exponentiation operator
  • support for large(>2GiB) file uploads
  • SSL/TLS improvements including peer verification by default
  • a new command line debugger called phpdbg

To see what else has been added, check out the Migrating from PHP 5.5.x to PHP 5.6.x.

To install, first you must add the Webtatic EL yum repository information corresponding to your CentOS/RHEL version to yum:

CentOS/RHEL 7.x:

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

CentOS/RHEL 6.x:

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm

Now you can install PHP 5.6’s mod_php SAPI (along with an opcode cache) by doing:

yum install php56w php56w-opcache

You can alternatively install PHP 5.6’s php-fpm SAPI (along with an opcode cache by doing:

yum install php56w-fpm php56w-opcache

See the package list below for additional SAPIs and PHP extensions.

If you would like to upgrade php to this version it is recommended that you first check that your system will support the upgrade, e.g. making sure any CPanel-like software can run after the upgrade.

Unless you know what you are doing, it is risky upgrading an existing system. It’s much safer to do this by provisioning a separate server to perform the upgrade as a fresh install instead.

If you know what you are doing, you can upgrade PHP by:

yum install yum-plugin-replace
yum replace php-common --replace-with=php56w-common

It will likely give you a message “WARNING: Unable to resolve all providers …”. This is normal, and you can continue by tying “y“. You will be given a chance to see what packages will be installed and removed before again being given a chance to confirm.

SAPIs – different runtime environments of PHP

mod_php NTS
(non-thread safety) Contained in the php56w package, this SAPI integrates into Apache Httpd (2.2.* on RHEL/CentOS 6, 2.4.* on RHEL/CentOS 7). It is the standard SAPI for use with httpd prefork mpm (the default mode httpd is ran under. It is not thread-safe, but doesn’t need to be due to prefork not using threads. It’s located at /usr/lib[64]/httpd/modules/libphp5.so
cli
Contained in the php56w-cli package, this SAPI allows running scripts from the command-line, and also has a built-in web server for development-use. Located at /usr/bin/php
fpm
Contained in the php56w-fpm package, fpm (FastCGI Process Manager) is a scalable FastCGI process, which acts similar to how Httpd prefork mpm works managing it’s forks. Located at /usr/sbin/php-fpm, it is controlled using the /etc/init.d/php-fpm service script
phpdbg
Contained in the php56w-phpdbg package, phpdbg has the ability to debug scripts using breakpoints from the command-line, and also supports remote-debugging using an external Java client for remote communication.
embedded
Contained in the php56w-embedded package, this SAPI allows embedding PHP in other applications. It’s library is located at /usr/lib[64]/libphp5.so
cgi, fastcgi
Contained in the php56w-cli package, these SAPIs are not recommended for use, but are available where needed. They both exist in the binary at /usr/bin/php-cgi.
mod_php TS
(thread safety) Contained in the php56w package, this SAPI integrates into Apache Httpd (2.2.* on RHEL/CentOS 6, 2.4.* on RHEL/CentOS 7). It is the standard SAPI for use with httpd worker mpm. It’s supposed to be thread-safe, but can’t guarantee to be, and certainly not under additional PHP extensions. It’s better to use FastCGI SAPIs than this one. It’s located at /usr/lib[64]/httpd/modules/libphp5-zts.so

Packages

PackageProvides
php56wmod_php, php56w-zts
php56w-bcmath
php56w-cliphp-cgi, php-pcntl, php-readline
php56w-commonphp-api, php-bz2, php-calendar, php-ctype, php-curl, php-date, php-ereg, php-exif, php-fileinfo, php-filter, php-ftp, php-gettext, php-gmp, php-hash, php-iconv, php-json, php-libxml, php-openssl, php-pcre, php-pecl-Fileinfo, php-pecl-phar, php-pecl-zip, php-reflection, php-session, php-shmop, php-simplexml, php-sockets, php-spl, php-tokenizer, php-zend-abi, php-zip, php-zlib
php56w-dba
php56w-devel
php56w-embeddedphp-embedded-devel
php56w-enchant
php56w-fpm
php56w-gd
php56w-imap
php56w-interbasephp_database, php-firebird
php56w-intl
php56w-ldap
php56w-mbstring
php56w-mcrypt
php56w-mssql
php56w-mysqlphp-mysqli, php_database
php56w-mysqlndphp-mysqli, php_database
php56w-odbcphp-pdo_odbc, php_database
php56w-opcachephp56w-pecl-zendopcache
php56w-pdophp56w-pdo_sqlite, php56w-sqlite3
php56w-pear
php56w-pecl-apcu
php56w-pecl-gearman
php56w-pecl-geoip
php56w-pecl-imagick
php56w-pecl-memcache
php56w-pecl-xdebug
php56w-pgsqlphp-pdo_pgsql, php_database
php56w-phpdbg
php56w-processphp-posix, php-sysvmsg, php-sysvsem, php-sysvshm
php56w-pspell
php56w-recode
php56w-snmp
php56w-soap
php56w-tidy
php56w-xmlphp-dom, php-domxml, php-wddx, php-xsl
php56w-xmlrpc

Opcode Caches

The PHP distribution now comes with an opcode cache. This is the Zend Optimizer+ opcode cache, now known as the Zend OPcache extension. This extension is optional, so does not preclude you from using an alternate one.

Due to it being included in the PHP source distribution, it will be well maintained and more suitable for use while other Opcode cache’s are being updated over the coming months.

yum install php56w-opcache

error_reporting E_ALL now includes E_STRICT

As mentioned in the PHP 5.4 guide:

You may get a lot more errors coming out of your error logs if by default your error_reporting is set to E_ALL now without explicitly turning off E_STRICT. The default php.ini that comes with the PHP package turns this off by default, but if you are upgrading from an existing installation, your php.ini may not be updated, meaning this will likely be turned on.

How to Check Internet Upload / Download Speed from command Line on Linux

When you are experiencing slow Internet access, you may want to test the Internet speed of your upstream ISP (often called “last mile” in the residential broadband networks) as part of troubleshooting. For that matter, Speedtest.net is probably the most widely used broadband speed testing website.

Underneath it, Speedtest.net loads JavaScript code in your web browser, which then automatically detects the closest Speedtest.net server from you, and measures download/upload speed by sending HTTP GET and POST requests to the server.

However, if you are trying to check Internet speed from a remote headless server, VPS or an otherwise desktop-less system, Speedtest.net’s Flash-based user-friendly interface would be no good. For those of you, there is a command-line interface (CLI) version of Speedtest.net, known as speedtest-cli. Here I will demonstrate how to use speedtest-cli to check Internet speed from the command line in Linux.

Install speedtest-cli on Linux

speedtest-cli is a simple CLI client written in Python for measuring bidirectional Internet bandwidth by using Speedtest.net infrastructure. It works with Python 2.4-3.4. Installing the latest speedtest-cli is nothing more than downloading the Python script.

$ wget https://raw.github.com/sivel/speedtest-cli/master/speedtest_cli.py
$ chmod a+rx speedtest_cli.py
$ sudo mv speedtest_cli.py /usr/local/bin/speedtest-cli
$ sudo chown root:root /usr/local/bin/speedtest-cli

Test Internet Connection Speed with speedtest-cli

It is straightforward to check your Internet speed with speedtest-cli. Running speedtest-cli command without any argument gets its job done.

$ speedtest-cli

This will automatically discover the closest Speedtest.net server (in terms of geographic distance), and report download and upload speed measured from the server.

If you want to share the speed test result, you can use “–share” option, which will allow you to share speed test result with others in an image format via Speedtest.net.

The following is a sample image automatically generated and uploaded to Speedtest.net by speedtest-cli.

If you want to get a list of available Speedtest.net servers around the world, use “–list” option. It will display a sorted list of Speedtest.net servers (geographically closest ones first).

In the server list shown above, each Speedtest.net server shows an associated server ID in front. You can manually specify server ID during testing, instead of using the geographically closest server. For example, if I want to use a sever in Washington DC, I specify a corresponding server ID (e.g., 935).

$ speedtest-cli –server 935

NOTE: Don’t run any aggressive cron job! speedtest-cli is an unofficial third-party tool which is meant for residential users who want to check their broadband speed. You are NOT supposed to run any aggressive script with it. If you want to run automated bandwidth monitoring with speedtest-cli, you should set up your own Speedtest.net server with Speedtest Mini, and run any automated test against it, instead of bombarding the Speedtest.net’s infrastructure which is shared with many others!

original article source: http://xmodulo.com/check-internet-speed-command-line-linux.html