google recaptcha v3 site key & secret key

Google reCAPTCHA V3 integration in PHP with Demo Example

Google has launched reCAPTCHA v3 to prevent spam bots from Form Submission without any user interaction. Google reCAPTCHA v3 returns score for each request based on interactions with your site. We can say this score a spam score. With this score we can take various action in your web apps. Today in this tutorial, we are going to show you how you can integrate Google reCAPTCHA v3 in PHP for your website. Register your website and get reCAPTCHA v3 Secret Key First of all you need to register your website on Google reCAPTCHA v3. To do that click here. Now, Login to your Google account & click on the + (Plus icon) on the right side near settings icon. Fill …

Read More

Install PHP Version (7.3, 7.2 or 7.0) on Ubuntu 19.04, 18.04 & 16.04 via PPA

Thanks to Ondřej Surý for maintaining PPA of most the popular PHP versions on launchpad. PHP 7.3 is the current & stable version of PHP. You can check the PHP Release History. PHP 7.3 has support till 6 December 2020. If you want to install the specific version of PHP, then this article can be helpful for you. In this article we will help you in installing PHP 7.3, 7.2 or 7.0 using PPA on Ubuntu 19.04 18.10 LTS, 18.04 LTS, 16.04 LTS, 14.04 LTS or 12.04 LTS systems. Install PHP 7.3 on Ubuntu 19.04, 18.04 & 16.04 PHP 7.3 is the current & stable version of PHP. Use the following set of commands that is installing software-properties-common and then …

Read More
PHP Registered Hashing Algorithms

PHP Registered Hashing Algorithms and their Hashed Value Length

PHP has a many hashing functions like sha1(), hash(), md5(), etc that can be used to hash a string/number based on certain algorithms i.e. “sha1”, “sha256”, “md5”, etc. You can use hash_algos() function to check a list of registered hashing algorithms. All these function takes a string/number as an argument and output an Alpha-Numeric hashed string of certain length. hash_algos() — Return a list of registered hashing algorithms. Currently PHP supports 46 hashing algorithms. hash_algos() function returns a numerically indexed array containing the list of supported hashing algorithms. Each hashing algorithm has a specific hashed value length. PHP Hash Algorithms Name & Length S.No. Algorithm Name Length 1 md2 32 2 md4 32 3 md5 32 4 sha1 40 5 …

Read More
Generate Random String Number in PHP JavaScript Ruby Python

Generating Random String Using PHP, JavaScript, Ruby, Python

Sometime in the programming world, you may need to generate a random string for any purpose, just like to random password suggestions, random passwords for your users. Today, In this Article we will study how can we achieve that in the easiest and fastest way. Random password / Random String can be generated with fully-custom functions but when we compare that with custom function those uses pre-defined functions of that language then that will be the best and fastest. As pre-defined function’s definitions are already compiled where the fully-custom functions are not compiled. Compiler/Interpreter will compile the code (fully-custom function) before executing that. And that will take a couple of microseconds to make it executable. But when it comes with …

Read More
Coders Den

Get Mime Type of file without reading file metas

What is MIME Type? MIME stands for Multipurpose Internet Mail Extension. It is the standardized way to identify the nature and format of a document. It is defined and standardized in IETF RFC 6838. The Internet Assigned Numbers Authority (IANA) is the official body who is responsible for keeping track of all official MIME types, and you can find the most up-to-date and complete list at the Media Types page. Syntax of MIME Type type/subtype MIME type string is a combination of 2 strings that are Type & SubType separated by / symbol. There should not be any space between Type & SubType. Type is a category of multiple MIME types of common groups that are closely related to each other. SubType …

Read More

Install LAMP AWS EC Ubuntu 16.04 – PHP 7, Apache, MySQL 5.7, GD, iMagick, Curl, MemCache

What is LAMP LAMP stands for: L = Linux as the operating system platform. A = Apache as the Web server M = MySQL as the database server P = PHP as the supportive language In this tutorial, we are going to see how to setup/install LAMP server on Ubuntu 14.x. This tutorial will cover the installation of PHP 7.0, Apache 2 & MySql 5.7, GD, iMagick, Curl, MemCache, Sqlite3, etc Instance Setup Install Apache2 Web Server

Verify: Install PHP 7

Restart Apache 2 Server To reflect changes in a server you need to restart the server. To restart server run the following command in SSH terminal window.

Check Installed PHP Version After successfully restart server run …

Read More

What are traits in PHP OOPS / Laravel ?

What is Traits? Traits are a mechanism that allows you to create reusable code in languages like PHP where multiple inheritance is not supported. A Trait cannot be instantiated on its own. In layman language,  traits are simply a group of methods that you want to include within another class. A Trait is like an abstract class that cannot be instantiated by itself. The trait is created to reduce the limitations of single inheritance in PHP by enabling a developer to reuse sets of methods freely in several independent classes living in different class hierarchies. Example of Trait:

To use Trait within the other classes use use keyword with Trait name. i.e. user AbcClass;

Now if you create new objects …

Read More
Ubuntu iMagick

How to install iMagick for PHP 7.x in Ubuntu 14 and above

Imagick is the most famous & best PHP extension for image manipulations. You can create and modify images using the iMagick (ImageMagick) library. It’s known on other platforms due to its difficult installation process, however in Ubuntu, installing it is pretty easy thanks to the php-imagick package that installs ImageMagick and Imagick as well. If you want to install Imagick on your server in just a couple of minutes, follow these steps: Install PHP Imagick To use Imagick with PHP 7.x in your server, you can easily achieve it with the following command:

The source of the package is the original package of Imagick from pecl. The installation takes about 1-2 minutes. You just need to press ‘Y’ each …

Read More
set default php version

Set Default PHP Version in Ubuntu

You can set the default PHP version to be used on the system with the “update-alternatives” command, after setting it, check the PHP version to confirm whether desired PHP version is set as default or not.

Restart apache server

Check PHP version

Output of above command is Check PHP configuration file You can find your PHP configuration file, by running the command below.

Output of above command is Now, check the current PHP version with phpinfo. Sometime you may see phpinfo() function shows older/different PHP version and SSH command line shows newer/different PHP version. To over come with this issue you need to disable unwanted PHP version and enable desired installed PHP version. Disable PHP5 module …

Read More

Install PHP 7.x GD Library on Ubuntu 14.x

PHP 7 do not come with GD library you need to install it manually. Depending on your current installed PHP version you may install GD library on Ubuntu. Install PHP 7.x (7.0, 7.1, 7.2, etc) GD library

Restart apache server

Now check phpinfo whether GD library is installed or not? Use bellow function in any file and open that file on browser.

Do browser search for GD. If you see “GD Support” is enabled. Then your GD library is successfully installed. Now you may use GD library for image manipulations.

Read More