Headsup: 5.4.14 & Yii2

Currently experiencing some weird problems with one installation.

Server config:

  • Debian 3.2.54-2 x86_64 GNU/Linux

  • nginx 1.6

  • apache

  • php 5.4.14

  • mysql

Website falls to "502 Bad Gateway" / child died with signal 11

  • Logs are clean

  • Console works as expected

  • DBO queries work as expected

The code that leads to this error is


\app\models\MyModel()::find()->...

which can be reduced to this (also causes the error):


$aq = \yii\db\ActiveRecord::find();

Unfortunately it’s a shared hosting, so I’m limited in information and actions.

Works fine on 5.5.

Probably this:

http://xcache.lighttpd.net/query?status=closed&page=3&desc=1&order=component&row=description

Have you checked the common targets that could be the culprits (basically in your webserver config) i.e… php.ini, .htaccess, how db is configured etc… … since you mentioned it works in one php version but not the other…

Everything is configured and running. But sometimes it just stops working and throws 502 until restart.

Probably related to this XCache thingie, will try to investigate further.

I wonder if there’s a good way to make a reproducible test case.

Any ideas?

XCache proved to be unsafe many times. Can you switch to APC?

Seems like there’s no stable APC for 5.4, so it will be hard to convince my hosting provider to switch.

Is there any opcode caching proven good and stable? OPCache?..

OPCache works fine with 5.5. The only thing is that if you’re using APC for cache then you need APCu additionally to OPCache.

Sure, but we don’t have too much 5.5 shared hosting providers around here.

I’ll try to force my provider to upgrade XCache version (2.0 now) and see if it helps.

If not - seems like it’s time to switch to VDS.

I didn’t believe what I read there, but you are in fact right. Support for PHP v5.4 has been introduced in APC v3.1.10. This and all younger releases are indeed betas. The more you know …

Meanwhile my hosting provider has confirmed the bug and promised me PHP and XCache update.

I can be convincing sometimes :D

On the other hand I’ve just set up a server at DigitalOcean, it was like click-click-click apt-get install […].

Up and running, PHP 5.5.9, Zend OPcache v7.0.3 and all the bells and whistles.

It’s so simple nowadays…

Sorry to be off topic, I’m thinking of moving to Digital OCean. I know nothing really about servers though. Is it a hard learning curve or pretty simple. I only need it for running Yii 2.

Consider a hosting plan or at least get a managed machine. Server administration is nothing you’ll learn overnight.

As for me, the only magic administration thing is mailing system. I have absolutely no idea how it works.

I’ve installed these packages so far:

  • build-essential (this one pulls gcc, make and so on)

  • php5-cli (for CLI stuff)

  • mysql-server (probably will replace it by postgres)

  • php5-mysql

  • nginx

  • php5-fpm

  • postfix

Then I edited a couple of config files, and reloaded services.

And that’s it, now I have Yii2 on nginx + php-fpm + php 5.5.9 + OPCache 7.0.3. It can even send emails (probably need to reconfigure it properly or use external smtp).

So I’ll sit on DO for a couple of days and wait for xcache bug resolution :)

DO has (57 pages * 12 articles per page) of tutorials. Wow, that’s a lot of information.

I have one currently, but it’s only sharedm i need a VPS for some things and it’s $1200 a year for a decent managed plan. Considering, dipping into DO just to get an idea of how easy or ridiculous an idea it may be ;)

I´m using digitalocean for housting, and www.serverpilot.io for management.

serverpilot charges USD 10/month, with ssl.

So, I get everything working for USD 20/month.

Works perfect with Yii2 basic template.

Hi,

Noticed you guys were talking about OPcache in this topic.

How can I make Yii2 work with OPcache?

For the RBAC I would like to use OPcache, but I can not find how to make Yii2 work with OPcache instead of APC. My provider will not install APC for PHP 5.5 and above as the development stopped a long time ago.

Thanks.

Opcache is code cache, not data cache so:

  1. Use php storage for RBAC.

  2. Enable Opcache and it will work out of the box.

You can try apcu which is maintained.

Ah, great! Thanks for the reply! I will give it a try.