php-7.1

CentOs 6, Php7.1, libevent, nginx returns 502

喜欢而已 提交于 2019-12-11 17:46:12
问题 I am upgrading laravel web application from php5.6 to php7.1 which leads me to upgrading libevent module. Application is async ans based on react library. So I ended with installed: PHP 7.1.12, libevent: 2.1.8 + expressif/pecl-event-libevent. And I have stable "502 Bad Gateway" from nginx. Without libevent (ReactStreamLoop) or on PHP 5.6 + libevent:1.4 works fine. Request lands to index.php and something happens later, inside of starting application. nginx log: 2017/11/24 10:41:24 [error]

Error: Apache shutdown unexpectedly error message

◇◆丶佛笑我妖孽 提交于 2019-12-11 16:53:27
问题 I just upgraded the PHP version of XAMPP from PHP 7.1.7 to PHP 7.2.0 using the guidelines from this article. Then I tried restarting the XAMPP but I got this error: 10:54:47 AM [Apache] Error: Apache shutdown unexpectedly. 10:54:47 AM [Apache] This may be due to a blocked port, missing dependencies, 10:54:47 AM [Apache] improper privileges, a crash, or a shutdown by another method. 10:54:47 AM [Apache] Press the Logs button to view error logs and check 10:54:47 AM [Apache] the Windows Event

Turn iterable into iterator

◇◆丶佛笑我妖孽 提交于 2019-12-11 05:46:55
问题 In PHP 7.1 a new iterable pseudo-type was introduced. Is there a straightforward way to transform a generic iterable into an Iterator ? Or should I use something like if (is_array($iterable)) { return new \ArrayIterator($iterable); } return new \IteratorIterator($iterable); 来源: https://stackoverflow.com/questions/43474857/turn-iterable-into-iterator

Get Names from get_class_methods(), but in which order?

*爱你&永不变心* 提交于 2019-12-11 05:42:30
问题 Like this sample from PHP manual, get_class_methods() get all the functions names. <?php class myclass { // constructor function myclass() { return(true); } // method 1 function myfunc1() { return(true); } // method 2 function myfunc2() { return(true); } } $class_methods = get_class_methods('myclass'); // or $class_methods = get_class_methods(new myclass()); foreach ($class_methods as $method_name) { echo "$method_name\n"; } ?> Result : myclass myfunc1 myfunc2 But is this order guaranteed or

laravel: Argument 1 passed to App\Exceptions\CustomException::report() must be an instance of Exception,

允我心安 提交于 2019-12-11 03:47:20
问题 I have created a custom exception class in Laravel 5.2. It works well till laravel 5.4. When Im trying to use the same custom exception class with laravel 5.5 it is throwing following error. Type error: Argument 1 passed to App\Utility\Exceptions\CustomException::report() must be an instance of Exception, none given, called in /var/www/html/bubbles/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php on line 102 {"exception":"[object] (Symfony\\Component\\Debug\\Exception

How to create password protected archive file in PHP?

强颜欢笑 提交于 2019-12-11 01:45:00
问题 I need to be able to create an archive(zip) file with password protection using PHP. I am using Laravel 5.4 and PHP 7.1 version. I looked at this link here for ZipArchive class documentation in PHP. I also looked at here for setPassword function. But appears that creation of password protected archives is not supported. It will be a massive surprise for me if it is not possible to create password protected archive in a mature programming language such as PHP 7.1. So I guess I must be missing

Openssl equivalent to mcrypt_get_block_size

两盒软妹~` 提交于 2019-12-11 00:55:09
问题 I am currently in the process of replacing Mcrypt with OpenSSL since Mcrypt will be deprecated in PHP 7.1. I need is a way to get the blocksize per algorithm like mcrypt_get_block_size(). I am wondering if there is an equivalent function to mcrypt_get_block_size() but it's pretty badly documented can't seem to find it. 回答1: php-openssl unfortunately doesn't have an API that would give you the cipher blockSize. If you really need it, you'd have to hard-code the blockSize (per algorithm).

PHP 7.1 Nullable Default Function Parameter

蓝咒 提交于 2019-12-10 02:54:18
问题 In PHP 7.1 when the following function is called: private function dostuff(?int $limit = 999) { } with syntax like so: dostuff(null); the value of $limit becomes null. So I guess it can be said that the value of $limit was explicitly set to null . Is there any way to overcome this? I.e. when a null value (i.e. the lack of a value) is encountered use the default, whether it is implicit or explicit? Thanks 回答1: No PHP doesn't have a "fallback to default if null" option. You should instead do:

Create folder on FTP server in directory where PHP script is

无人久伴 提交于 2019-12-09 21:21:21
问题 I use Current PHP version: 7.1.4 for Ionic2 application back-end. I'm trying to create folder on my ftp server in the same directory, where directory.php located itself. After link to http://site/php/directory.php echo: Successfully created images it creates images folder in user directory: home/ user /public_html/folder/php/uploads/ My directory.php located in php folder: home/user/public_html/folder/ php /uploads/ I want create images directory in exist uploads folder: home/user/public_html

Failed to read session data on PHP7.1

人走茶凉 提交于 2019-12-09 05:57:31
问题 Sharing a problem that I had (and now solved). On my development machine, I run IIS with PHP. I upgraded to PHP7 and suddenly my code no longer worked, returning this error... session_start(): Failed to read session data: user (path: C:\WINDOWS\temp) It looks like a permissions issue, right? So, I spent a long time tweaking php.ini settings and trying to change folder permissions - with no success. Then I realised something. See my answer below. 回答1: I finally realised the message was