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

can not run phalcon in centos

hi , i installed phalcon in centos and in php info page everything look fine . but when i go to url i get this error in apache log :

[Tue Dec 30 04:05:15 2014] [error] [client 91.98.118.172] PHP Parse error: syntax error, unexpected '[', expecting ')' in /var/www/html/app/config/loader.php on line 20

this is my loader.php :

<?php
$loader = new \Phalcon\Loader();
try
{

$loader->registerDirs(
        array(
                $config->application->controllersDir,
                $config->application->modelsDir,
                $config->application->configDir,
                $config->application->messagesDir,
                $config->application->componentDir,
                $config->application->libraryDir
                )
        );

$loader->registerClasses(['Component\Helper' => $config->application->helperAddrees]);

$loader->register();
}
catch (\Phalcon\Exception $e)
{
        echo get_class($e), ": ", $e->getMessage(), "\n";
    echo " File=", $e->getFile(), "\n";
    echo " Line=", $e->getLine(), "\n";
    echo $e->getTraceAsString();
}

my site works fine on ubuntu server .

i don't know what is the problem



2.2k

You can use Markdown. See Code Blocks on https://forum.phalcon.io/help/markdown

What version of PHP do you use in CentOS?

my site works fine on ubuntu server .

Dd you mean the same source file works fine on Ubuntu?



822

You can use Markdown. See Code Blocks on https://forum.phalcon.io/help/markdown

What version of PHP do you use in CentOS?

my site works fine on ubuntu server .

Dd you mean the same source file works fine on Ubuntu?

thank you kenjis for your reply in centos i use php 5.3.3 and in ubuntu the php version is 5.5.20

yes the exact source file works fine in ubuntu



2.2k

I got it.

PHP Parse error: syntax error, unexpected '[', expecting ')'

You use short array syntax [key => val] below, but it is new feature in PHP 5.4.

$loader->registerClasses(['Component\Helper' => $config->application->helperAddrees]);

You are using PHP 5.3, so you must use array().



822

i updated php on centos to 5.5.20 same as ubuntu .

now i get this error :

[Tue Dec 30 04:56:50 2014] [error] [client 91.98.118.172] PHP Notice: Undefined offset: componentDir in /var/www/html/app/config/loader.php on line 15



2.2k

Did you set componentDir in your Config?



822

Did you set componentDir in your Config?

now i have componentDir in config file . the error has changed to

[Tue Dec 30 05:10:12 2014] [notice] child pid 9794 exit signal Segmentation fault (11)



58.4k

Hi

You need re-compile Phalcon when you update version php.



822

Hi

You need re-compile Phalcon when you update version php.

thanks for the reply how to re-compile phalcon ? use ./install on /cpahlcon/build folder is enough ?



58.4k

Hi

You try this

cd cphalcon/ext
phpize
./configure
make && sudo make install


822

Hi

You try this

cd cphalcon/ext phpize ./configure make && sudo make install

re-compile was successful . httpd service restart and i get the same error :

[notice] child pid 9794 exit signal Segmentation fault (11)



822

i tried everything .

recompile phalcon did not work ,

update php to 5.5.20 did not work ,

at the end i've got this error :

[notice] child pid 9794 exit signal Segmentation fault (11)

i disabled all php extension and enable one by one and the phalcon.so extension was the problem

and now idon't know what to do :(



2.2k

How did you know you recompiled successfully? Was phalcon.so changed?

How about this?

cd cphalcon/ext
phpize
./configure
make clean
make && sudo make install