php-7

AES Encryption PHP to NodeJS?

*爱你&永不变心* 提交于 2019-12-24 10:23:01
问题 I am in process of moving a small project from PHP to NodeJS that includes a small part of AES Encryption. As PHP code works fine, it goes as function decysek($data, $app_key) { $output = openssl_decrypt(base64_decode($data), 'AES-256-ECB', $app_key, OPENSSL_RAW_DATA); return $output; } function decyGetBillData($rek , $data , $decrypted_sek){ $decrypted_rek = openssl_decrypt(base64_decode($rek), 'AES-256-ECB', $decrypted_sek, OPENSSL_RAW_DATA); $decrypted_data = openssl_decrypt(base64_decode(

Use Trait Function with Same Name but Optionally

和自甴很熟 提交于 2019-12-24 07:45:09
问题 PHP Class Using Same Name as Trait Function Refer to the question I just asked above here. Here was my original code. trait sampletrait{ function hello(){ echo "hello from trait"; } } class client{ use sampletrait; function hello(){ echo "hello from class"; //From within here, how do I call traits hello() function also? } } I can call the trait function like this thanks to the answer to the question. class client{ use sampletrait { hello as protected sampletrait_hello; } function hello(){

PHP 7 FPM does not show request body with chunked encoding

故事扮演 提交于 2019-12-24 07:06:15
问题 The Code I have the following very simple code in index.php : <?php if (!function_exists('getallheaders')) { // Outputs all HTTP headers function getallheaders() { $headers = []; foreach ($_SERVER as $name => $value) { if (substr($name, 0, 5) == 'HTTP_') { $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value; } } return $headers; } } echo "Content:\n" . @file_get_contents("php://input") . "\n" . "Post:\n" . print_r($_POST, true) . "\n" .

Laravel Artisan Hangs using Memory Until Freeze

情到浓时终转凉″ 提交于 2019-12-24 06:48:32
问题 With Laravel 5.4 Artisan will not run and uses a lot of memory, it worked a long while before with the same versions (besides PHP 7.0.14 to 7.0.15 maybe?). Problem : any $ ./artistan command does nothing. While watching htop I notice the memory climb from 2gb to 4gb very quickly. Once I cancel it, it jumps back down. What Im Using Ubuntu Linux Xenial x64 (Local Development) Apache2.4 MySQL 5.7 PHP 7.0.15 Laravel 5.4 Composer 1.3.2 PHP Extensions Loaded [PHP Modules] bz2 Core ctype curl date

PhpStorm not to generate docblock for function/method arguments that are typehinted

萝らか妹 提交于 2019-12-24 01:54:48
问题 At the moment on my PhpStorm I have the following options enabled: File | Settings | Editor | Inspections | Missing @return tag` -> Marked both options there (Ignore PHPDoc without @param + Ignore PHPDoc with return type hint). File | Settings | Editor | Inspections | PHPDoc comment matches function/method signature` -> Mark option about allowing params with typehint. So according to these settings my functions should look like this: /** * @throws \Exception */ public function submit(string

Encrypt in PHP 7 decrypt in Node JS

*爱你&永不变心* 提交于 2019-12-24 00:38:05
问题 In PHP 5.6 there were plenty of solutions that worked perfectly that were based on http://php.net/manual/en/function.mcrypt-decrypt.php For example public function encrypt($data) { //don't use default php padding which is '\0' $pad = $this->blocksize - (strlen($data) % $this->blocksize); $data = $data . str_repeat(chr($pad), $pad); return bin2hex(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $this->encryptKey, $data, MCRYPT_MODE_CBC, $this->iv)); } But PHP7 has a WARNING that discourages using this

What's the difference between MYSQLI_CLIENT_SSL and MYSQLI_OPT_SSL_VERIFY_SERVER_CERT?

泪湿孤枕 提交于 2019-12-24 00:25:02
问题 This is how I usually connect to a MySQL database using SSL: $db = mysqli_init(); mysqli_ssl_set( $db, NULL, NULL, '/etc/ssl/my-certs/ssl-ca.crt.pem', NULL, NULL ); mysqli_real_connect( $db, 'db.example.com', 'john', '123456', NULL, NULL, NULL, MYSQLI_CLIENT_SSL ); From what I understand, the MYSQLI_CLIENT_SSL flag is necessary to make mysqli::real_connect connect to the server using SSL. Today I stumbled upon the documentation for mysqli::options, and noticed that it accepts MYSQLI_OPT_SSL

Cakephp with PHP7

∥☆過路亽.° 提交于 2019-12-23 09:34:59
问题 Can I run CakePHP 1.3 with PHP7? I have to do a migration to PHP7, but in the hosting there is a project in CakePHP 1.3 and need to know if there is any risk if I run this project in this version of PHP. 回答1: Unfortunately CakePHP 1.3 is not really compatible with PHP7 out of the box. I work on a old project in CakePHP 1.3 and my system upgraded to PHP7. There are a lot of these in the core of CakePHP 1.3 After changing these, I ran into the next batch of errors, after which I rolled back and

Can't send the request to the server

这一生的挚爱 提交于 2019-12-23 04:27:24
问题 I've some problem with the PHP script. So, I'm trying to connect to the FMI Server, but when I'm enter a valid credentials the server always return HTTP code 330, instead of 200 OK. Also when I'm trying with invalid credentials it's return 401 and it's okay, but why I've this problem only with VALID credentials? What I'm tried? curl_setopt($ch,CURLOPT_ENCODING , "gzip"); But no luck :( Here's my code: <?php $username = "callibra@yandex.ru"; //Valid login $password = "callibra4App"; //Valid

php 5.x 7.x, ssl pdo error: Peer certificate CN=`someName' did not match expected CN='someIP'

做~自己de王妃 提交于 2019-12-23 03:32:14
问题 We have a server with mysql on port 3306. We have sertifications and key and we try to connect to this server. But we see such problem: Peer certificate CN='SomeName' did not match expected CN='someIP' I've read a lot of articles and can't find answer for PDO PHP. The most interesting is that the SQLYog could connect with all settings. I've read that I verify_peer_names can be disabled (I hope I understand what is peer_names...), but only if we use openssl_{functions} or mysqli, not PDO. Both