Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

php -r 'phpinfo();' shows the phalcon extension, but localhost/phpinfo.php don't...

I apologise if it's trivial, but the phalcon.so 3.3.2 extension is shown as present in a command line phpinfo(), but is absent in the web phpinfo().. ?!? WHY ?

Any project perfectly created with phalcon tools 3.2.12 does not run in the apache server which complains with "I don't found Phalcon\Loader, Phalcon\Config" and so on.. Worst, the extensions is absent in a web phpinfo()

The site is created as a simple project with phalcon tools version 3.2.12, this one : phalcon tools : PHP Version: 7.0.25-0ubuntu0.16.04.1 | PHP SAPI: cli | PHP Bin: /usr/bin/php7.0 | PHP Extension Dir: /usr/lib/php/20151012 | PHP Bin Dir: /usr/bin | Loaded PHP config: /etc/php/7.0/cli/php.ini | Versions: | Phalcon DevTools Version: 3.2.12 | Phalcon Version: 3.3.2 | AdminLTE Version: 2.3.6

The apache server has an extension "phalcon.so" build by cloning the last github, build the .install.sh file etc. To verify the presence of the extension, a command line php -r 'phpinfo();' or php -r 'print_r(get_loaded_extensions());'

shows THE EXTENSION PRESENT as this :

phalcon

Web framework delivered as a C-extension for PHP phalcon => enabled Author => Phalcon Team and contributors Version => 3.3.2 Build Date => Mar 9 2018 20:00:07 Powered by Zephir => Version 0.10.7-2917ebe8ae etc..

but if I use the same phpinfo() in a webssite <?php phpinfo()

the extension disapears.. and I agree with this last verdict..

any idea, Phalconists ?



76.8k

same is for me, i have a specific php installtion just for cli, and a seperated one for my nxing.

So when you type php in console, you are not executing the same php executable your web server does.

or your webserver loads a different php.ini :-)



491

how could it been that php-cli and php7.0 not be the same version? they have been installed in the same time, or.. not?

Someone who still has installed in his machine a php5.6.x and a phalcon.so 2.0.x, can say if it's a big bug or not : could you please do a 'php -info'(or the more complicated in my question) and phpinfo() in the server ? Do the answers match ?

Is not a server bug also because you are talking about nginx and mine is apache.

unfortunately, I think it's a bug in the 3.xx extension phalcon.so itself



76.8k

nope, its your configuration.

its hard to explain .. read careful;ly my comment and check how you setupo php fpm to understand the idea

Hope that helps



491

I installed 5 php's from "ondrej"(andrew?) ppa : /etc/php: total 40 drwxr-xr-x 7 root root 4096 Mar 10 23:36 . drwxr-xr-x 3 root root 4096 Mar 10 23:31 5.6 drwxr-xr-x 3 root root 4096 Mar 10 23:31 7.1 drwxr-xr-x 5 root root 4096 Mar 10 22:44 7.2 <= this one is THE DEFAULT, pointed by /etc/alternatives drwxr-xr-x 5 root root 4096 Jun 28 2017 7.0 drwxr-xr-x 5 root root 4096 May 31 2016 5.5

then recompiled the github cphalcon, which, infortunatelly.. wants the 7.0 as default. and even if I re-chose 7.0 as default, apache2 web refuses, and the cli command accepts it.. etc. etc. and it loops

too many php's.. too many cphalcons and the baby with so many midwives around him, died.. Sincerly, tomorow i'll continue with my laravel. Primum vivaere, deinde philosophare Let's break the thread as "impossible to install in ubuntu 16.04-LTS and apache till some stabilisation in versioning"



76.8k
Accepted
answer

yea that ondej repo for php7 should be deleted, people should never install it. It only messes everything up. good luck with Laravel

PHP on the command line and PHP in a web server have 2 different config files. It sounds like you've added it to the command line file, but not Apache. In Debian (and likely Ubuntu), the Command Line file is at /etc/php/7.0/cli/php.ini and the Apache config file is at /etc/php/7.0/apache2/php.ini

Looking at phpinfo() online, right near the top will be line "Loaded Configuration File". That's the one you need to modify to include the Phalcon SO.



491

I FOUND THE BUG..

  • thanks to Izo and with apologizes to "ondrej", I removed absolutelly all the 5-6 versions of php. And installed the one qualified in the phalcon doc, the 7.0
  • Dylan, you were right, there are 3 or 4 applications comming with the php install. The tree under /etc/php/7.0 contains the php as language, the php-cli as a command line application, the php-ftm as a adhoc php web server and an other one, etc.. As you said, each one has also a phalcon.ini file containing the line extension=phalcon.so. For shure in each php.ini of each one of those applications is an include of the phalcon.ini file which sends to an abstract extension "phalcon.so". And as sure as that, is the build script of cphalcon which installed that mecanism The "extension_dir" in the php-cli application was right. But not in the others. I explain : to found where exactly "phalcon.so" is, there is a parameter "extension_dir" which serves as base of the full path. Then to match this fullpath, you must move/copy the module to the right directory, test it, recompile it re-move-copy it, make errors, etc. THE SOLUTION, TO ALL THIS THREAD IS TRIVIAL :

EVEN IN PRESENCE OF SUCH an "extension_dir" parameter, FORGET IT, and use a full path to point your cphalcon module example :

extension = /home/michaela/cphalcon/build/php7/64bits/modules/phalcon.so

of coarse is to root to decide where to put it