Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP 5.4.3 Update brokes my Symfony2 instance #4262

Closed
mishunika opened this issue May 11, 2012 · 37 comments
Closed

PHP 5.4.3 Update brokes my Symfony2 instance #4262

mishunika opened this issue May 11, 2012 · 37 comments
Labels

Comments

@mishunika
Copy link

Hi there... After updating PHP to version 5.4.3, a strange fatal error appears on app_dev.php:

Fatal error: Cannot mix bracketed namespace declarations with unbracketed namespace declarations.

This happens in file: /app/cache/prod/classes.php on lines that define a namespace...

I thought that something from the new version of php brokes symfony, but I wasn't able to find some useful information on php's changelogs... So I gave up, I've just downgraded all my php packages to version 5.3.13... But I think there might be a solution, so I decided to post here...

btw. I'm using an updated ArchLinux...

@arghav
Copy link
Contributor

arghav commented May 12, 2012

I'm running 5.4.3 on Arch Linux and I don't have any problem. Have you tried clearing your prod cache?

@mishunika
Copy link
Author

I have cleared the cache, but error stil appeared...

@mishunika
Copy link
Author

Ah! I forgot to mention that I'm using php-fpm and nginx... maybe there are some bugs în php-fpm...

@jakzal
Copy link
Contributor

jakzal commented May 13, 2012

Might be related to https://github.com/symfony/symfony-standard/issues/169

@mishunika do you have Tokenizer extension installed?

@matteosister
Copy link

same problem here on my arch box!

@jakzal tokenizer is enabled by default...at least on my arch installation no configurations was needed.

@jakzal
Copy link
Contributor

jakzal commented May 14, 2012

@matteosister what about other requirements? Did you guys run check.php to verify your environments?

@matteosister
Copy link

Both on the cli and with apache. Everything is "ok"

@matteosister
Copy link

this is definitely a problem with the php version that comes with arch (php-5.4.3-1).
After a downgrade to 5.3.12 everything works fine!

@ashnur
Copy link

ashnur commented May 16, 2012

It's not a php version problem, as the downgrade did not solve the problem for me.

@matteosister
Copy link

have you downgraded also all the php related packages? (apc, mcrypt, intl...etc)

@ashnur
Copy link

ashnur commented May 16, 2012

nope. I wasn't aware that each php version has it's own list of module packages...

@mvrhov
Copy link

mvrhov commented May 16, 2012

Then it's probably one of the additional modules. Things are working just fine for me on Ubuntu 12.04 with custom compiled 5.4.3

@alxfv
Copy link

alxfv commented May 23, 2012

I had same trouble with nginx + php-fpm, the error was wrong version php-apc

@matteosister
Copy link

@faost so by downgrading apc you solved this?

@mvrhov
Copy link

mvrhov commented May 24, 2012

Well You can't really run SF2 on PHP 5.4.x with APC. Versions before 3.1.10 are not compatible with 5.4, 3.1.10 is compatible with it, but it breaks xml see #4185

@matteosister
Copy link

@mvrhov thanks! I'll try to remove the package...

@gzankevich
Copy link

Removing APC does indeed fix the issue. Could we document the incompatibility of 5.4.x with APC somewhere? This is confusing new users.

Alternatively, Symfony could check for this and provide a clear error message describing the problem.

@immutef
Copy link
Contributor

immutef commented May 25, 2012

just a note, with almost every new major version of PHP, APC is broken for a while.

@matteosister
Copy link

Removing apc fixes the problem also for me.

@arghav
Copy link
Contributor

arghav commented May 28, 2012

Works fine on arch linux with PHP 5.4.3 and php-apc 3.1.10-2

@arghav
Copy link
Contributor

arghav commented May 29, 2012

I revoke my statement, it doesn't work with apc enabled.

@mishunika
Copy link
Author

It seems that the last php-apc update (php-apc 3.1.10-3) fixes the problem.

Thanks for providing workaround solutions ;]

@mvrhov
Copy link

mvrhov commented Jul 20, 2012

And those who were waiting for an official release APC 3.1.11 was released yesterday with included fix.

@echterhoff
Copy link

Thanx to @mvrhov, your hint lead me to a solution form my problem.

Let me explain my struggle through this mess.
I would not call my self a newbie to computer/developer related stuff but everytime you try something new (in this case symfony2) there are new things to face and new problems to solve.
So I started reading the tutorial before I decided how and where to start with. My first attempt was okay, as I did what I expected to do. I just pulled a fresh boilerplate with the composer onto my debian/apache/php5410 webserver. Everything fine and worked like a charme. The only thing I couldnt live with was the slow sync between NetBeans and the server through samba... so decided to do the dev on my local system. I've just set the machine up on Win8 several days before. On a side note... Windows 8 is... okay. Next.
So I pulled the stuff I need to get all those nice things working again. PHP, Cygwin, Git, Composer, etc... and symfony2.
My first attempt was to get it to work on a fresh Zend Server CE 5.4.
Unfortunally Zend ships with ICU3.somthing and without apc so I replaced all those files from: http://downloads.php.net/pierre/
Checks were all successful passed but the I got first an error, than the namespace error. Okay... disabled apc, nothing. Several other things I tried... One by one... (Mention, I did not know what problem I was facing.) Several web researches on that error... tokenizer... blahblah. 4h went away. Nothing moved.
Start over. Uninstalled Zend and downgraded to Zend 5.3.x... Same problems. (But just wasted 1h on that.)
Then I felt like giving the PHP 5.4.10 buildin webserver a try. Added all needed extensions but... nothing. Got stuck on that error.

@mvrhov pushed my try and error struggle to the right direction. I just got a precompiled binary ready to use from http://windows.php.net/downloads/pecl/releases/apc/3.1.13/php_apc-3.1.13-5.4-nts-vc9-x86.zip placed it into php/ext/ restarted the php buildin webserver cleared all those caches, restarted the IDE took a deep breath and: It simply worked!

@fabpot Please check for those buggy apc version's and save people like me some hairs. ;-) I thing I am neither the first nor the last who encountered that pitfall. A search for https://www.google.de/search?q=php_apc+nts+x86+windows+build will lead you direct into hell, as the first result is from pierre and buggy.

At all who read this:
The error: "Fatal error: Cannot mix bracketed namespace declarations with unbracketed namespace declarations."
is caused by a buggy APC.
In case you are on a x86 NTS PHP 5.4 get a working APC binary from:
http://windows.php.net/downloads/pecl/releases/apc/3.1.13/php_apc-3.1.13-5.4-nts-vc9-x86.zip

@fabpot
Copy link
Member

fabpot commented Jan 14, 2013

Anyone knows a list of buggy APC versions and when it was fixed?

@fabpot
Copy link
Member

fabpot commented Jan 14, 2013

Or is it still that APC does not work well with PHP 5.4?

@matteosister
Copy link

no more problems here
PHP 5.4.6-1ubuntu1.1
APC 3.1.13

I think that from 3.1.11 the probelm was fixed. But I'm not sure what previous versions was affected...

@pborreli
Copy link
Contributor

PHP 5.4 support has been added in APC 3.1.10 which is beta. last stable is 3.1.9
Installing APC with pecl install apc-beta fixes the problem.

@mvrhov
Copy link

mvrhov commented Jan 14, 2013

@fabpot: It started working in 3.1.11, but there were other problems with segfaults. IMO we should recommend >=3.1.13

edit: 3.1.13 works for me since the day it was released. Haven't yet upgraded to 3.1.14 so I cannot comment on that

@fabpot
Copy link
Member

fabpot commented Jan 14, 2013

Just to be sure I understand it right: We need to recommend 3.1.13 for PHP 5.4, everything is fine for PHP 5.3, right (at least I've nerver had a problem with 5.3)?

@mvrhov
Copy link

mvrhov commented Jan 14, 2013

looks good to me

@pborreli
Copy link
Contributor

@mvrhov segfaults while running tests or using Symfony2 ?

@mvrhov
Copy link

mvrhov commented Jan 14, 2013

@pborreli running. Fix for # 69972 was the problematic one.

@fabpot
Copy link
Member

fabpot commented Jan 14, 2013

If you have a look at the changelog for APC, what was fixed in 3.1.13 is already in the changelog for 3.1.14 (http://pecl.php.net/package-changelog.php?package=APC). Anyone else can confirm that both 3.1.13 and 3.1.14 works whereas 3.1.12 does not?

@pborreli
Copy link
Contributor

the # 69972 bug has been introduced in 3.1.12 (Fixed interned strings storage freeing on module shutdown (Anatoily)) and fixed in 3.1.13

  • 3.1.9-stable OK (for PHP 5.3)
  • 3.1.10-beta OK (fixed PHP 5.4 compatibility)
  • 3.1.11-beta OK
  • 3.1.12-beta KO (segfault)
  • 3.1.13-beta OK
  • 3.1.14-beta OK (fixed PHP 5.5 compatibility)

fabpot added a commit to sensiolabs/SensioDistributionBundle that referenced this issue Jan 16, 2013
@fabpot
Copy link
Member

fabpot commented Jan 16, 2013

see sensiolabs/SensioDistributionBundle@e417fd7 where I've added a check for problematic APC versions

@SergSlon
Copy link

The problem is because of APC(apc.dll) for windows is complied with "enable-apc-debug=yes"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests