$url= 'https://example.com';
$arrContextOptions=array(
"ssl"=>array(
"verify_peer"=>false,
"verify_peer_name"=>false,
),
);
$response = file_get_contents($url, false, stream_context_create($arrContextOptions));
Category Archives: PHP
You attempted to load file with unsupported compression (application/zip). Either support for it is not implemented or disabled by your configuration.

yum install php-zip
service php-fpm restart
PHP Warning: touch(): Utime failed: Permission denied in
You might be having some troubles with file permissions!
I’m setting a new small vps for some tests and I got this…
/var/log/php-fpm/www-error.log
PHP Warning: touch(): Unable to create file ./cache/index.html because Permission denied in
Centos 7
nginx
PHP 7.3.3 PHP-FPM
My PHP-FPM running under apache user instead of nginx on /etc/php-fpm.d/www.conf

PHP MySQL to MySQLi migration shim library
phpmyadmin – Não foram recebidos dados para importar.
Não foram recebidos dados para importar. Ou não foi submetir um nome de ficheiro, ou o tamanho do ficheiro excede o tamanho máximo permitido pela sua configuração PHP. Veja FAQ 1.16.
Temos de aumentar o limit de upload e post no php.ini
rh-php73 – enable imagick extension module
Let’s search for imagick.so
find / -name 'imagick.so'
/usr/lib64/php/modules/imagick.so
/opt/rh/rh-php73/root/usr/lib64/php/modules/imagick.so
Let’s enable imagick extension module
nano /etc/opt/rh/rh-php73/php.d/20-imagemagick.ini
; Enable imagick extension module
extension=/opt/rh/rh-php73/root/usr/lib64/php/modules/imagick.so
Restart PHP 7.3 FPM
service rh-php73-php-fpm
google captcha – no curl_exec
$response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$secret."&response=".$response); $response = json_decode($response, true); if($response["success"] === true){ // actions if successful }else{ // actions if failed }
codeigniter Message: __autoload() is deprecated, use spl_autoload_register() instead

A CI application was returning me the following error, after the PHP been updated to 7.3.
I had to change a few lines at config/config.php
function __autoload($class)
{
if(strpos($class, 'CI_') !== 0)
{
@include_once( APPPATH . 'core/'. $class . EXT );
}
}
to
spl_autoload_register(function($class) {
@include_once ( APPPATH . 'core/'. $class . EXT );
});
google.com: XXX.XXX.XXX.XXX is neither permitted nor denied by best guess record for domain of [email protected]
If you are using mail() to send an email, with PHP, and you are getting the following error…
spf=neutral (google.com: 69.55.XXX.XXX is neither permitted nor denied by best guess record for domain of [email protected]) [email protected] Return-Path: <[email protected]>
You can force the ‘mailfrom’ by adding -f[email protected], after the headers.
$send = mail($to, $subject, $message, implode("\r\n", $headers), '-f'.$from);
PHP 2-chars ISO 3166-1 code to full country name
echo (Locale::getDisplayRegion(‘-PT, ‘en’))