Category Archives: Uncategorized

3 Cards in a Row with Bootstrap 4.4

Example of 3 cards in a row with Bootstrap 4.4: <div class="row py-3"> <div class="col-sm-4 py-3"> <div class="card"> <div class="card-body"> <h5 class="card-title">Example Title 1</h5> <p class="card-text">With supporting text below as a natural lead-in to additional content.</p> <a href="#" class="btn btn-primary">Go somewhere</a> </div> </div> </div> <div class="col-sm-4 py-3"> <div class="card"> <div class="card-body"> <h5 class="card-title">Example Title 2</h5> […]

Passing a boolean through HTTP GET request

All GET parameters are strings in PHP. You can use filter_var() with FILTER_VALIDATE_BOOLEAN: $myVar = filter_var($_GET[‘myVar’], FILTER_VALIDATE_BOOLEAN);$myVar = filter_var($_GET[‘myVar’], FILTER_VALIDATE_BOOLEAN); Here is description for FILTER_VALIDATE_BOOLEAN: Returns TRUE for "1", "true", "on" and "yes". Returns FALSE otherwise.   If FILTER_NULL_ON_FAILURE is set, FALSE is returned only for "0", "false", "off", "no", and "", and NULL is […]

PHP Convert Boolean to String

You can convert a PHP boolean (true/false) into a string: $test_bool = var_export(filter_var($_GET[‘test_bool’], FILTER_VALIDATE_BOOLEAN), true);$test_bool = var_export(filter_var($_GET[‘test_bool’], FILTER_VALIDATE_BOOLEAN), true);

Certbot renew error: Missing webroot

If you get this error messsage while trying to renew the certs: – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – Processing /etc/letsencrypt/renewal/www.website.com.conf – […]

PHP Curl slow with HTTPS SSL requests

A possible solution is to force IPv4 resolving: curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 );curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4 ); And also disable SSL verifications: curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); If the error persists, Curl is not the problem. Probably there is a network issue.

Download OpenVPN 2.4.7 and TAP-Windows

From here you can download latest OpenVPN version: https://openvpn.net/community-downloads/ And from here you can download all latest stable versions: https://build.openvpn.net/downloads/releases/latest/ It includes also TAP-Windows versions.

How to Configure OVH Email POP3 with Thunderbird

When adding a new email address (OVH hosted) on Thunderbird: The red-removed part should be your website. Reference (Italian): https://docs.ovh.com/it/emails/email_condivisa_guida_alla_configurazione_di_thundebird/

What is the Correct JSON Content-Type for HTTP Headers?

Many web services uses different content-type for JSON data, i.e: application/json application/x-javascript text/javascript text/x-javascript text/x-jsonapplication/json application/x-javascript text/javascript text/x-javascript text/x-json But what is the correct content type to use for JSON data? For JSON text you should use application/json (read more on RFC 4627). For JSONP (runnable javascript) with callback, use application/javascript. You should read also […]

PHP Notice: Undefined offset: 1 (Array)

How to fix PHP Notice: Undefined offset: 1? This PHP snippet will generate a “Undefined Offset” notice: $parts = explode(".", "aaaa");   $data = $parts[1];   print_r($data);$parts = explode(".", "aaaa"); $data = $parts[1]; print_r($data); This happens because $parts[1] is undefined. To fix this “Undefined Offset” notice just check if isset($parts[1]): $parts = explode(".", "aaaa");   […]

How to Find PHP.ini Location

Need to know where is located your PHP.ini file? Locate PHP.ini with Find The best way (in my opinion) is to use “find” to locate the php.ini: find / -name php.inifind / -name php.ini You should get something like this: /etc/php/7.3/fpm/php.ini /etc/php/7.3/cli/php.ini/etc/php/7.3/fpm/php.ini /etc/php/7.3/cli/php.ini So this way you will locate PHP.ini for both PHP7 FPM and […]