Probably version or configuration difference between your machine's PHP and XAMPP's PHP
If you are trying to use Phalcon with XAMPP, you might have some compilation issues. When compiling Phalcon, the default code uses your machine's php scripts to run the function phpize instead of the XAMPP's php scripts. Then, when you just compile and add the .so to XAMPP, it will try to use an extension built from a different PHP version or configuration. Of course that error only occurs when your Ubuntu PHP version or configuration is different from your XAMPP php version.
So, to correct this add an extra argument on Phalcon compilation as follows:
###Part 1###
$git clone git://github.com/phalcon/cphalcon.git
$cd cphalcon/build
$sudo ./install --with-php-config=/opt/lampp/bin/php-config
We added the argument --with-php-config= which will say what php configuration should be used. After running the ./install, you should see in your terminal the message "Thanks for compiling Phalcon!
Build succeed: Please restart your web server to complete the installation". If that doesnt happen, it means that the pahlcon.so was not generated correctly. If that happens, open the ./install file and replace all phpize occurrence for phpize --with-php-config=/opt/lampp/bin/php-config. There are two occurences, one in line 59 and other in line 63. Also replace the ./configure --enable-phalcon for ./configure --enable-phalcon --with-php-config=/opt/lampp/bin/php-config on line 63. After that run again the command $ sudo ./install --with-php-config=/opt/lampp/bin/php-config and check if you see the message "Thanks for compiling Phalcon!
Build succeed: Please restart your web server to complete the installation"
After that, continue the process normally:
###Part 2###
$vi /opt/lampp/etc/php.ini
In the open file press key ":" then type "1000" then press enter key. that should take you to the 1000 line of the file, around where the etension=xxxx.so are. If not, press down arrow until you find this area. something like this:
##Part 3##
;extension=php_bz2.dll
;extension=php_curl.dll
;extension=php_dba.dll
;extension=php_exif.dll
;extension=php_fileinfo.dll
;extension=php_gd2.dll
;extension=php_gettext.dll
;extension=php_gmp.dll
;extension=php_intl.dll
;extension=php_imap.dll
;extension=php_interbase.dll
;extension=php_ldap.dll
;extension=php_mbstring.dll
;extension=php_ming.dll
;extension=php_mssql.dll
When your cursor is somewhere like that, press "i" for insertion mode and add the line:
##part 4##
extension=phalcon.so
Attention, don't put a ";" before, that means it is a commented line. After that save the file by pressing ":" after that press "x" then push enter. That menas you saved the file.
Then, finally restart your webserver by using the command:
##part 5##
$sudo /opt/lampp/lampp restart
By now, everything is gret to go. Hope it helps!