Phalcon PHP - установка для разных версий PHP и ошибки которые могут при этом возникнуть

Материал из Wiki - Iphoster - the best ever hosting and support. 2005 - 2024
Перейти к:навигация, поиск

Доступная цена

Phalcon - установка для разных версий PHP и ошибки которые могут при этом возникнуть

Пример установки на CENTOS 7 - 64 + php 5.6

# yum install git
# cd /root/
# git clone git://github.com/phalcon/cphalcon.git
# yum install pcre-devel autoconf gcc
# ./install --phpize /opt/php56/bin/phpize --php-config /opt/php56/bin/php-config --arch 64bits
# echo "extension=/opt/php56/lib/php/modules/phalcon.so" > /opt/php56/etc/php.d/phalcon.ini
# systemctl restart httpd

Проверяем наличие фреймворка:

# /opt/php56/bin/php -m | grep pha
phalcon

Ошибка при установке Phalcon - ./install: line 92: gcc: command not found

# ./install --phpize /opt/php56/bin/phpize --php-config /opt/php56/bin/php-config --arch 64bits
Error: Couldn't execute your compiler (gcc)
./install: line 92: gcc: command not found
./install: line 92: [: -ge: unary operator expected
Configuring for:
PHP Api Version:         20131106
Zend Module Api No:      20131226
Zend Extension Api No:   220131226
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script. 
./install: line 141: ./configure: No such file or directory make: *** No targets specified and no makefile found. Stop. make: *** No rule to make target `install'. Stop. Thanks for compiling Phalcon! Build succeed: Please restart your web server to complete the installation

Решение:

# yum install gcc

Ошибка при установке Phalcon - /opt/php56/include/php/ext/pcre/php_pcre.h:29:18: fatal error: pcre.h: No such file or directory

# ./install --phpize /opt/php56/bin/phpize --php-config /opt/php56/bin/php-config --arch 64bits
Configuring for:
PHP Api Version:         20131106
Zend Module Api No:      20131226
Zend Extension Api No:   220131226
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
appending configuration tag "CXX" to libtool 
mkdir .libs
gcc -I. -I/root/cphalcon/build/php5/64bits -DPHP_ATOM_INC -I/root/cphalcon/build/php5/64bits/include -
I/root/cphalcon/build/php5/64bits/main -I/root/cphalcon/build/php5/64bits -I/opt/php56/include/php -I/opt/php56/include/php/main -
I/opt/php56/include/php/TSRM -I/opt/php56/include/php/Zend -I/opt/php56/include/php/ext -I/opt/php56/include/php/ext/date/lib -
DPHALCON_RELEASE -DHAVE_CONFIG_H -march=native -mtune=native -O2 -fomit-frame-pointer -c 
/root/cphalcon/build/php5/64bits/phalcon.zep.c  -fPIC -DPIC -o .libs/phalcon.o
In file included from /opt/php56/include/php/ext/spl/spl_iterators.h:27:0,
                from /root/cphalcon/build/php5/64bits/phalcon.zep.c:80:
/opt/php56/include/php/ext/pcre/php_pcre.h:29:18: fatal error: pcre.h: No such file or directory
#include "pcre.h"         ^
compilation terminated.
make: *** [phalcon.lo] Error 1
gcc -I. -I/root/cphalcon/build/php5/64bits -DPHP_ATOM_INC -I/root/cphalcon/build/php5/64bits/include -
I/root/cphalcon/build/php5/64bits/main -I/root/cphalcon/build/php5/64bits -I/opt/php56/include/php -I/opt/php56/include/php/main -I/opt/php56/include/php/TSRM -I/opt/php56/include/php/Zend -I/opt/php56/include/php/ext -I/opt/php56/include/php/ext/date/lib -DPHALCON_RELEASE -DHAVE_CONFIG_H -march=native -mtune=native -O2 -fomit-frame-pointer -c /root/cphalcon/build/php5/64bits/phalcon.zep.c  -fPIC -DPIC -o .libs/phalcon.o
In file included from /opt/php56/include/php/ext/spl/spl_iterators.h:27:0,
                from /root/cphalcon/build/php5/64bits/phalcon.zep.c:80:
/opt/php56/include/php/ext/pcre/php_pcre.h:29:18: fatal error: pcre.h: No such file or directory
#include "pcre.h"                 ^
compilation terminated.
make: *** [phalcon.lo] Error 1
Thanks for compiling Phalcon!
Build succeed: Please restart your web server to complete the installation

Решение:

# yum install pcre-devel


Ошибка при установке Phalcon - Cannot find autoconf. Please check your autoconf installation and the

# ./install --phpize /opt/php56/bin/phpize --php-config /opt/php56/bin/php-config --arch 64bits 
Configuring for:
PHP Api Version:         20131106
Zend Module Api No:      20131226
Zend Extension Api No:   220131226 
Cannot find autoconf. Please check your autoconf installation and the
$PHP_AUTOCONF environment variable. Then, rerun this script.
./install: line 141: ./configure: No such file or directory
make: *** No targets specified and no makefile found.  Stop.
make: *** No rule to make target `install'.  Stop.
Thanks for compiling Phalcon!
Build succeed: Please restart your web server to complete the installation

Решение:

# yum install autoconf


Ошибка при подключении phalcon.so - /opt/php56/lib/php/modules/phalcon.so: undefined symbol: php_json_decode_ex in Unknown on line 0

Ошибка при подключении модуля phalcon.so:

# /opt/php56/bin/php -m
PHP Warning:  PHP Startup: Unable to load dynamic library '/opt/php56/lib/php/modules/phalcon.so' - 
/opt/php56/lib/php/modules/phalcon.so: undefined symbol: php_json_decode_ex in Unknown on line 0

возникает если модуль phalcon.so загружается раньше чем расширение php - json.

Решение для CentOS 7:

убрать расширение из php.ini: /opt/php56/etc/php.ini

и добавить в /opt/php56/etc/php.d/phalcon.ini

# echo "extension=/opt/php56/lib/php/modules/phalcon.so" > /opt/php56/etc/php.d/phalcon.ini
# systemctl restart httpd