Questions tagged [php-7]

PHP 7 is the successor to PHP 5.6, it was released on December 3, 2015. Use this tag for issues relating to development using PHP 7

PHP 7 is the next version of . It succeeds , which is the last release of the PHP 5.X version. PHP 7.0.0 was released on Dec 3, 2015

PHP 6

Several years ago there was a major push to make PHP Unicode compatible and this push focused around what was then slated to be PHP 6. An internal version was developed and a lot of material was published (including some books) about this new version. Serious problems with the implementation arose, however, and the project was abandoned, with most of the surviving code being implemented in PHP 5.4. To avoid confusion with this discussion the decision was made to skip version 6.

Development

You can download the PHP 7 source and compile it yourself. Official builds are available on the PHP website.

Features

New features of PHP 7 include (See all accepted features):

PHP7 migration guide

There's a whole section on Migrating from PHP 5.6.x to PHP 7.0.x in the manual:

© 1997-2015, The PHP Documentation group, CC-BY 3.0

Information

  • For global question on PHP, please use the generic tag:
  • If you want to talk about PHP or if you have a question, you can come to the PHP chat room
2761 questions
10
votes
1 answer

PHP 7 - Comparing Anonymous Class Instances

I have tried this code: $ac1 = new class {}; $ac2 = new class {}; var_dump($ac1); // object(class@anonymous)#1 (0) {} var_dump($ac2); // object(class@anonymous)#2 (0) {} var_dump(new class {}); // object(class@anonymous)#3 (0) {} var_dump($ac1 ==…
Rax Weber
  • 3,730
  • 19
  • 30
10
votes
1 answer

Why are my integers overflowing before they should?

I am running PHP 7.0.8 (VC14 x64 Thread Safe version) on Windows 7. echo PHP_INT_MAX; shows 9223372036854775807, but this doesn't actually seem to be correct. According to the PHP documentation, If PHP encounters a number beyond the bounds of the…
Don't Panic
  • 41,125
  • 10
  • 61
  • 80
10
votes
3 answers

php7 oauth illegal memory allocation

Intro While running inside a complex web application, a spawned php7 process tries to allocate illegal amount of memory (18446744069414584466 bytes) when using the oauth module. After fpm manager restart the error appears after 2-5 times this code…
10
votes
4 answers

How to use Memcached with PHP7?

I was trying to find any information about using Memcached with PHP7, but I failed. The only valuable information is short Readme.md of php-memcached repo. Unfortunately, its travis build failed as well as 30/126 tests on my machine. However make…
James Akwuh
  • 2,169
  • 1
  • 23
  • 25
10
votes
2 answers

PHP Notice: Array to string conversion only on PHP 7

I am a newbie of PHP. I study it from php.net, but I found a problem today. class foo { var $bar = 'I am bar.'; } $foo = new foo(); $bar = 'bar'; $baz = array('foo', 'bar', 'baz', 'quux'); echo "{$foo->$bar}\n"; echo "{$foo->$baz[1]}\n"; The…
lizs
  • 540
  • 2
  • 8
  • 18
10
votes
4 answers

Apache crashes with munmap_chunk(): invalid pointer after update to php7 on Jessie

I recently updated to php 7.0.4 on my server running a Debian 8. here is what dpkg -l | grep php gives me: ii libapache2-mod-php7.0 7.0.4-1~dotdeb+8.1 amd64 server-side, HTML-embedded scripting language (Apache 2…
Daniel
  • 6,916
  • 2
  • 36
  • 47
10
votes
1 answer

foreach changes in PHP7

foreach in PHP7 by default, when iterating by value, operates on a copy of the array according to: http://php.net/manual/en/migration70.incompatible.php Does it lazily create a copy only if there are changes made to the array or a value or will it…
inquam
  • 12,664
  • 15
  • 61
  • 101
10
votes
7 answers

How to setup XDebug for PHP7 on Mac?

I've installed PHP 7 on my mac using Homebrew i.e. $ brew install php70 Also I want to have the the XDebug setup on my machine. Ideally I would love to have an easy solution like using brew again, but unfortunately it seems there is no such…
Ali
  • 2,993
  • 3
  • 19
  • 42
9
votes
5 answers

How can I type cast when using the null coalescing operator?

Say I have this: $username = (string) $inputs['username'] ?? null; If $inputs['username'] is set then I want it to cast to string. If it's not set then $username should be null. However, at the moment if $inputs['username'] is not set it will be an…
Optimae
  • 942
  • 1
  • 12
  • 23
9
votes
4 answers

How to tell Deployer to use different PHP version once ssh'ed to my shared hosting?

I'm experimenting with Deployer to deploy Laravel application into shared hosting (using laravel recipe) from my local ~/Code/project_foo. The point is that when I'm connected to my shared hosting server via ssh, then default php -v version is…
Matt Komarnicki
  • 5,198
  • 7
  • 40
  • 92
9
votes
2 answers

Different PHP version for each folder on my server

I have little knowledge of how to configure Apache and the server. Currently, my server is running a version of PHP 5.X I would like to upgrade to PHP 7 but there would be a lot of projects that would need to be upgraded. So here's my question :…
fly LFC
  • 101
  • 1
  • 1
  • 5
9
votes
3 answers

In PHP 7.0 Fatal error: Uncaught Error: Call to undefined function json_encode()

My server configurations: [root@server ~]# php -v PHP 7.0.22 (cli) (built: Aug 7 2017 16:18:27) ( NTS ) [root@server ~]# nginx -v nginx version: nginx/1.10.2 OS: CentOS 7.3.1611 (Core) Details of my YUM installation: [root@server ~]# yum list…
Dibya Sahoo
  • 839
  • 3
  • 9
  • 30
9
votes
1 answer

Symfony 3.0 migration PHP 5.5 to PHP 7.1 : "A PHP accelerator should be installed > Install and/or enable a PHP accelerator (highly recommended)"?

I want to upgrade PHP5.5 to 7.1 in a SYMFONY 3.0 Project. I have been checking the "php.ini" file to get the right result. One last thing is unresolved: Under PHP5.5, I used the extension accelerator php_apcu.dll. This is not maintained in PHP7. I…
nyluje
  • 3,573
  • 7
  • 37
  • 67
9
votes
6 answers

CentOS 7 + PHP7 -- php not rendering in browser

I have a clean install of apache/httpd and php7.1.0 running on CentOS 7. When I execute from the command line: php -v I get the expected response: PHP 7.1.0 (cli) (built: Dec 1 2016 08:13:15) ( NTS ) Copyright (c) 1997-2016 The PHP Group Zend…
Didier Jean Charles
  • 462
  • 2
  • 9
  • 22
9
votes
3 answers

How to enable PCNTL on Ubuntu server 16.04

I'm wondering how to enable pcntl extension in PHP7 running on Ubuntu server 16.04. I saw this http://www.crimulus.com/2010/07/30/howto-enable-pcntl-in-ubuntu-php-installations/ but do we really have to recompile PHP7? It surprises me as other…
fralbo
  • 2,534
  • 4
  • 41
  • 73