magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.57k stars 9.32k forks source link

Segmentation fault (core dumped) in PHP7 #2880

Closed raybogman closed 8 years ago

raybogman commented 8 years ago

There is a PHP7-CLI bug when running the install via the shell

Segmentation fault (core dumped)

I tested it in CE and EE 2.0

when switching to PHP5.6-CLI everthing works. It's only during installation, no other issue in PHP7 so far

alankent commented 8 years ago

Hi Ray! Which version of PHP7 did you use? 7.0.0 or 7.0.1? Also, exactly what command did you run? (I run the install from PHP 7.0.1 without problem.)

raybogman commented 8 years ago

Alan its PHP 7.0.1

deb http://ppa.launchpad.net/ondrej/php-7.0/ubuntu trusty main deb-src http://ppa.launchpad.net/ondrej/php-7.0/ubuntu trusty main

alankent commented 8 years ago

What exactly was the command you ran? (All the command line arguments too.) Just trying to repeat your problem.

raybogman commented 8 years ago

php bin/magento setup:install --db-host=localhost --db-name=magento2ce --db-user="root" --db-password="root" --backend-frontname=admin --base-url=http://yourdomain.com/ --admin-lastname=Doe --admin-firstname=John --admin-email=john@doe.com --admin-user=admin --admin-password=password123 --use-rewrites=1 --cleanup-database

alankent commented 8 years ago

Thanks Ray. I tried your command with PHP 7.0.1 and got the following.

$ php bin/magento setup:install --db-host=localhost --db-name=magento2ce --db-user="root" --db-password="root" --backend-frontname=admin --base-url=http://yourdomain.com/ --admin-lastname=Doe --admin-firstname=John --admin-email=john@doe.com --admin-user=admin --admin-password=password123 --use-rewrites=1 --cleanup-database
SQLSTATE[HY000] [2002] No such file or directory

  [InvalidArgumentException]
  Parameter validation failed

setup:install [--backend-frontname="..."] [--key="..."] [--session-save="..."] [--definition-format="..."] [--db-host="..."] [--db-name="..."] [--db-user="..."] [--db-engine="..."] [--db-password="..."] [--db-prefix="..."] [--db-model="..."] [--db-init-statements="..."] [-s|--skip-db-validation] [--http-cache-hosts="..."] [--base-url="..."] [--language="..."] [--timezone="..."] [--currency="..."] [--use-rewrites="..."] [--use-secure="..."] [--base-url-secure="..."] [--use-secure-admin="..."] [--admin-use-security-key="..."] [--admin-user="..."] [--admin-password="..."] [--admin-email="..."] [--admin-firstname="..."] [--admin-lastname="..."] [--cleanup-database] [--sales-order-increment-prefix="..."] [--use-sample-data] [--magento-init-params="..."]

I tried fiddling the settings (change DB name, changing passwords etc). No change. (The error message here is not very helpful to say what exactly is wrong.) Here is the command I successfully used in a script with PHP 7.0.1 in case useful

bin/magento setup:install --backend-frontname=admin \
    --cleanup-database --db-host=127.0.0.1 --db-name=magento --db-user=magento --db-password=magento \
    --admin-firstname=Magento --admin-lastname=User --admin-email=user@example.com \
    --admin-user=admin --admin-password=admin123 --language=en_US \
    --currency=USD --timezone=America/Chicago --use-rewrites=1 --use-sample-data

The head of my php -i output is as follows:

PHP Version => 7.0.1

System => Linux 3e5c2e35b277 4.1.13-boot2docker #1 SMP Fri Nov 20 19:05:50 UTC 2015 x86_64
Build Date => Dec 21 2015 19:06:52
Configure Command =>  './configure'  '--with-config-file-path=/usr/local/etc/php' '--with-config-file-scan-dir=/usr/local/etc/php/conf.d' '--with-apxs2' '--disable-cgi' '--enable-mysqlnd' '--with-curl' '--with-openssl' '--with-readline' '--with-recode' '--with-zlib'
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /usr/local/etc/php
Loaded Configuration File => /usr/local/etc/php/php.ini
Scan this dir for additional .ini files => /usr/local/etc/php/conf.d
Additional .ini files parsed => /usr/local/etc/php/conf.d/docker-php-ext-gd.ini,

/usr/local/etc/php/conf.d/docker-php-ext-intl.ini,
/usr/local/etc/php/conf.d/docker-php-ext-mbstring.ini,
/usr/local/etc/php/conf.d/docker-php-ext-mcrypt.ini,
/usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini,
/usr/local/etc/php/conf.d/docker-php-ext-xsl.ini,
/usr/local/etc/php/conf.d/docker-php-ext-zip.ini

I have to go get some other work done, so I am going to leave this to the Engineering team to chase down. Just sharing where I got up to. I am almost wondering if copy/paste is sneaking some unicode hyphen in somewhere...

Ahhh... I just changed "localhost" to "127.0.0.1" and it started working I think. I remember reading something about MySQL treats "localhost" as a special string, not as a host name. So it might be something to do with the MySQL libraries causing you a problem, not PHP 7 itself. My Docker image is not doing a 'standard' thing to get MySQL installed.

marvincaspar commented 8 years ago

Are you using Xdebug with PHP7? If yes, try to disable Xdebug and run the command again.

raybogman commented 8 years ago

@mc388 no Xdebug installed only required php modules

monkeysee commented 8 years ago

Created internal ticket MAGETWO-47636 for investigation

mazhalai commented 8 years ago

@raybogman can you please add the following to your php.ini, restart server and try installing again. Please post contents of path_to_log_file.

log_errors = On
error_log = <path_to_log_file>
keithbentrup commented 8 years ago

I had a seg fault during the cli install due to a memory allocation issue using the php7 package from ppa:ondrej/php. However, I had previously been using php7-beta1 from http://repos.zend.com/zend-server/early-access/php7/repos just fine. I haven't had time to investigate further so I reverted to php7-beta1 from zend.

My environments can be replicated using these Dockerfiles based on an ubuntu 14.04 image: working - https://github.com/esepublic/docker-lamp-app-server/blob/0985a6fe7cfa2799593b418a97197ef839f198a7/Dockerfile seg faults - https://github.com/esepublic/docker-lamp-app-server/blob/a0724e9a7ce93d036c22eb32243686ffa6d8e937/Dockerfile

mazhalai commented 8 years ago

@keithbentrup why are you using php5 extensions for gd and mcrypt etc? ETA: Sorry I saw the working one first. But that is still inconsistent with some php7 mixed with php5.

These steps worked for me:

add-apt-repository -y ppa:ondrej/php-7.0

apt-get update

apt-get install -y apache2 libapache2-mod-php7.0 php7.0  php7.0-common php7.0-gd php7.0-mysql php7.0-mcrypt php7.0-curl php7.0-intl 
raybogman commented 8 years ago

new PHP 7.0.2 is out

it looks like there is a core bug https://bugs.php.net/bug.php?id=71163

I am going to test it

csdougliss commented 8 years ago

With PHP 7.0.2 I still get the following when reindexing catalogsearch_fulltext

Segmentation fault: 11

I can't use PHP 7 and I can't use HHVM, not a good start!

acidreian666 commented 8 years ago

@craigcarnell I get the same exact problem on php 7.0.2 on reindexing catalogsearch_fulltext Link to my Magento Stack-exchange with pictures http://magento.stackexchange.com/questions/96590/magento-2-0-with-upgraded-to-php-7-0-indexer-stuck-at-processing

keithbentrup commented 8 years ago

@mazhalai re the php5 exts with php7-beta ... at the time, the php7-beta didn't have all the extensions and the php5 ones were compatible

Regardless, I set up a docker image were you can reproduce the problem.

docker run -it esepublic/m2-php7-install-test (more info here: https://github.com/esepublic/docker-m2-php7-install-test)

It appears to be due to a memory allocation error (it consume all available memory) when it calls prepareProductIndex in Magento/CatalogSearch/Model/Indexer/Fulltext/Action/Full.php.

mazhalai commented 8 years ago

@kiethbentrup yes we are aware of issues in indexer on PHP7(this is a duplicate of #2750), but this thread started as Segmentation fault for install. Do you still have problems installing Magento2 on PHP7?

@raybogman any update regarding installation using PHP7? We cannot reproduce the segfault during installation.

keithbentrup commented 8 years ago

@mazhalai yes, that's what i'm saying - the install fails with php7 and I've created a reproducible docker container here, so you can see for yourself:

docker run -it esepublic/m2-install-tests:php7-install-test

If you have docker, just run the 1 cmd, watch it all install and you'll see it fail during the install at the point that I described. Find the Dockerfile and install script (install-m2.sh) here: https://github.com/esepublic/docker-m2-install-tests/tree/php7-install-test

keithbentrup commented 8 years ago

image

mazhalai commented 8 years ago

@keithbentrup You have sample data, did you try installing without sample data?

keithbentrup commented 8 years ago

I'm only trying to install with sample data. I have no need for an installation without sample data at this time, but if that makes it a duplicate of #2750, then I guess it's not a separate issue.

mazhalai commented 8 years ago

@keithbentrup just tried with sample data, and got a segfault! It is related to indexer issue #2750.

SunshineTech commented 8 years ago

When I install Magento2 on CentOS7 with php7, the following error display:

[Progress: 317 / 362] Module 'Magento_CatalogSampleData': Installing data.. Segmentation fault

My php7's info:

PHP 7.0.2 (cli) (built: Jan 6 2016 15:25:31) ( NTS ) Copyright (c) 1997-2015 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies with Xdebug v2.4.0RC3, Copyright (c) 2002-2015, by Derick Rethans

cedricblondeau commented 8 years ago

Hi there!

I'm experiencing this problem as well since I switched from the PHP7 version I built from source to the package provided Ondřej Surý for Ubuntu (ondrej/php-7.0).

I used to compile PHP7 with the following options:

--prefix=/usr/local --enable-soap --enable-bcmath --with-mcrypt --with-xsl --enable-mbstring --with-curl --with-gd --with-jpeg-dir --with-png-dir --enable-intl --enable-fpm --with-openssl --with-pdo-mysql --with-mysql-sock=/var/run/mysqld/mysqld.sock --enable-zip --with-zlib --with-zlib-dir

ondrej/php-7.0 was built with the following options:

--includedir=/usr/include --mandir=/usr/share/man --infodir=/usr/share/info --libdir=/usr/lib/x86_64-linux-gnu --libexecdir=/usr/lib/x86_64-linux-gnu --disable-maintainer-mode --disable-dependency-tracking --prefix=/usr --enable-cli --disable-cgi --with-config-file-path=/etc/php/7.0/cli --with-config-file-scan-dir=/etc/php/7.0/cli/conf.d --build=x86_64-linux-gnu --host=x86_64-linux-gnu --libdir=/usr/lib/php --libexecdir=/usr/lib/php --datadir=/usr/share/php/7.0 --program-suffix=7.0 --sysconfdir=/etc --localstatedir=/var --mandir=/usr/share/man --disable-all --disable-debug --disable-rpath --disable-static --with-pic --with-layout=GNU --without-pear --enable-bcmath --enable-calendar --enable-ctype --enable-dba --with-db4=/usr --without-gdbm --with-qdbm=/usr --enable-inifile --enable-flatfile --enable-dom --enable-exif --with-gettext=/usr --enable-fileinfo --enable-filter --enable-ftp --enable-hash --with-iconv --with-pcre-regex=/usr --enable-mbregex --enable-mbregex-backtrack --enable-mbstring --enable-phar --enable-posix --enable-mysqlnd-compression-support --with-zlib-dir=/usr --with-openssl=yes --enable-libxml --enable-session --enable-simplexml --enable-soap --enable-sockets --enable-tokenizer --enable-xml --enable-xmlreader --enable-xmlwriter --with-mhash=yes --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-zip --with-system-tzdata --enable-dtrace --enable-pdo --enable-mysqlnd --enable-pcntl --with-libedit=shared,/usr build_alias=x86_64-linux-gnu host_alias=x86_64-linux-gnu CFLAGS=-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -O2 -Wall -fsigned-char -fno-strict-aliasing -g LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro CPPFLAGS=-D_FORTIFY_SOURCE=2 CXXFLAGS=-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security
ishakhsuvarov commented 8 years ago

@cedricblondeau

while (0 > 1) {
}

Evaluates to false, so the loop never starts and causes catalogsearch_fulltext index to be empty.

cedricblondeau commented 8 years ago

@ishakhsuvarov My bad!

mazhalai commented 8 years ago

@all PHP7 issues have been fixed in tag 2.0.1 Please have a look and let us know if your issue has been fixed.

csdougliss commented 8 years ago

@mazhalai Well done :+1:

mazhalai commented 8 years ago

Closing this issue, please reopen if it persists.

josefbehr commented 8 years ago

I still get a Segmentation fault with Magento 2.0.1 on PHP7.0.0, when running the setup:di:compile command:

screen shot 2016-03-23 at 11 34 37 screen shot 2016-03-23 at 11 36 27

Not sure, if this is a PHP or Magento problem...

danslo commented 8 years ago

Upgrade your PHP version, I believe this was fixed in 7.0.3 or even 7.0.4.

stefandoorn commented 8 years ago

I also have this problem on PHP 7.0.4. Magento 2.0.2. It also fails on the first 14% somewhere. See referenced issue above. If I take out that library, it continues beyond the 14%.

Ravenmire commented 8 years ago

I get this segfault when installing from git.

The last lines in the compile are: Installing PEAR environment: /usr/local/lib/php/ Makefile:455: recipe for target 'install-pear-installer' failed make[1]: *\ [install-pear-installer] Segmentation fault (core dumped) Makefile:458: recipe for target 'install-pear' failed

What further is needed to diagnose and fix this problem?

gusterwoei commented 8 years ago

I was using php 7.1.0-alpha and got the same issue, then I upgraded to 7.1.0-beta it started working fine. It's really the php problem

sma09sjb commented 8 years ago

I'm experiencing a similar issue on php version 7.0.8 with a CE installation of Magento 2.1

php bin/magento setup:di:compile
Compilation was started.
Repositories code generation... 1/7 [====>-----------------------]  14% 1 sec 46.                                                                                                                    0 MiBPHP Fatal error:  Class 'Magento\Braintree\Controller\Paypal\AbstractAction'                                                                                                                     not found in /chroot/home/amritanu/amritanutrition.uat.quba.co.uk/html/vendor/ma                                                                                                                    gento/module-braintree/Controller/PayPal/PlaceOrder.php on line 18
Segmentation fault

Can anyone offer any help? This is preventing me from setting the mode to production on our server.

Thanks,

Sophie