We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Volt - Checking if assets collection exists breaks render

Hey Guys,

I'm working on my Multi Module CMS right now, and everything has been working like a charm on my Windows machine. I just moved the site up to my ubuntu server to make a live link, but now I have a huge issue.

I have my controllers set up so I can choose to call page-specific assets as a collection, which volt checks then checks to see if it exists and outputs it if it does.

{% if assets.exists('page_head_css') %}
    {{ assets.outputCss('page_head_css') }}
{% endif %}

That check works perfectly on my windows machine, but on Ubuntu it breaks the page and stops all rendering at that point.

Here is my Volt setup in the module:

        $di->set('view', function(){
            $view = new \Phalcon\Mvc\View();
            $view->setViewsDir('../core/backend/views/');

                $view->registerEngines(array(
                    '.volt' => function($view, $di) {
                    $volt = new \Phalcon\Mvc\View\Engine\Volt($view, $di);
                    $volt->setOptions(array(
                      'compiledPath' => '../core/backend/compiled/',
                      'stat' => true,
                      'compileAlways' => true  
                    ));
                    return $volt;
                    }
                ));

            return $view;
        });

I have no prefix url set (as I'm making this install not domain-specific). I'm not getting anything in the error logs.

Windows Setup - PHP 5.6.19 x86 (phalcon 2.1.0r [Mar 23 2016 00:33:33]) Ubuntu Setup - PHP 5.5.9 x64 (phalcon 2.0.13 [Jun 27 2016 14:59:39])

I'd really appreciate some insight. I've spent the past two hours googling and pulling my hair out with nothing to show for it.

edited Jun '16

Okay, figured it out. For anyone else that stumbles across this: the assets->exists() method was introduced in 2.1.0r, but the latest version I have is 2.0.13.

I tried updating phalcon from SSH, but when I ran sudo ./install after checking out 2.1.x, I get the following error

/root/cphalcon/build/php5/64bits/phalcon.zep.c:17325:43: fatal error: ext/standard/php_smart_string.h: No such file or directory
 #include <ext/standard/php_smart_string.h>
                                           ^
compilation terminated.
make: *** [phalcon.lo] Error 1

Any ideas on how to get this to install?

edited Jun '16

What php version you have ? 2.1.x works only on 5.4+. It looks like you don't have php dev package ? Try to apt-get install php5-dev

What php version you have ? 2.1.x works only on 5.4+. It looks like you don't have php dev package ? Try to apt-get install php5-dev

Hey Wojciech,

I'm running PHP 5.5.9 x64 on my live server. I tried compiling the 2.1.x branch so I could use 2.1.0r, but the compilation fails (see my post above).

And you installed php5-dev on your live server ? Write php -v, what it returns ?

And you installed php5-dev on your live server ? Write php -v, what it returns ?

Yes, php5-dev is on the server (I already have phalcon installed), I just can't compile 2.1.0r...

PHP Version 5.5.9-1ubuntu4.17

Can you compile from ext/ please?