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.

Can't install 2.1.x with docker php:7.0-fpm

I'am trying to install phalcon on docker php:7.0-fpm image and have no luck with that. Phalcon successfully compiled, but i can't locate phalcon.so to add it to extensions. find / -name "phalcon.so" found nothing. Compilation output:

Step 8 : RUN git clone https://github.com/phalcon/cphalcon.git     && cd cphalcon     && git checkout 2.1.x     && /root/bin/zephir build --backend=ZendEngine3     && cd ..       && echo "extension=phalcon.so" >> /usr/local/etc/php/conf.d/docker-php-ext-redis.ini
 ---> Running in 5fa67cf8863a
Cloning into 'cphalcon'...
Switched to a new branch '2.1.x'
Branch 2.1.x set up to track remote branch 2.1.x from origin.
zephir_parser extension not loaded, compiling it
Parser statistics: 127 terminals, 99 nonterminals, 459 rules
                   947 states, 0 parser table entries, 0 conflicts
Parser statistics: 127 terminals, 99 nonterminals, 459 rules
                   947 states, 0 parser table entries, 0 conflicts
make: *** No rule to make target 'clean'.  Stop.
Preparing for parser compilation...
Compiling the parser...

mkdir parser/.libs
mkdir .libs
 gcc -I. -I/var/www/zephir/parser -DPHP_ATOM_INC -I/var/www/zephir/parser/include -I/var/www/zephir/parser/main -I/var/www/zephir/parser -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /var/www/zephir/parser/parser/parser.c  -fPIC -DPIC -o parser/.libs/parser.o
 gcc -I. -I/var/www/zephir/parser -DPHP_ATOM_INC -I/var/www/zephir/parser/include -I/var/www/zephir/parser/main -I/var/www/zephir/parser -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /var/www/zephir/parser/zephir_parser.c  -fPIC -DPIC -o .libs/zephir_parser.o
 gcc -I. -I/var/www/zephir/parser -DPHP_ATOM_INC -I/var/www/zephir/parser/include -I/var/www/zephir/parser/main -I/var/www/zephir/parser -I/usr/local/include/php -I/usr/local/include/php/main -I/usr/local/include/php/TSRM -I/usr/local/include/php/Zend -I/usr/local/include/php/ext -I/usr/local/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /var/www/zephir/parser/parser/scanner.c  -fPIC -DPIC -o parser/.libs/scanner.o
gcc -shared  .libs/zephir_parser.o parser/.libs/parser.o parser/.libs/scanner.o   -Wl,-soname -Wl,zephir_parser.so -o .libs/zephir_parser.so
creating zephir_parser.la
(cd .libs && rm -f zephir_parser.la && ln -s ../zephir_parser.la zephir_parser.la)
cp ./.libs/zephir_parser.so /var/www/zephir/parser/modules/zephir_parser.so
cp ./.libs/zephir_parser.lai /var/www/zephir/parser/modules/zephir_parser.la
PATH="$PATH:/sbin" ldconfig -n /var/www/zephir/parser/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /var/www/zephir/parser/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.


Warning: Variable "_SESSION" assigned but not used in Phalcon\Session\Adapter::remove in /var/www/cphalcon/phalcon/session/adapter.zep on 204 [unused-variable]

         }
        -^


Warning: Function "msgpack_pack" does not exist at compile time in /var/www/cphalcon/phalcon/cache/frontend/msgpack.zep on 138 [nonexistent-function]

          return msgpack_pack(data);
        ---------------------------^


Warning: Function "msgpack_unpack" does not exist at compile time in /var/www/cphalcon/phalcon/cache/frontend/msgpack.zep on 148 [nonexistent-function]

          return msgpack_unpack(data);
        -----------------------------^


Warning: Variable "beforeLine" assigned but not used in Phalcon\Debug::showTraceItem in /var/www/cphalcon/phalcon/debug.zep on 339 [unused-variable]

           beforeLine, firstLine, afterLine, lastLine, i, linePosition, currentLine;
        -------------^


Warning: Function "\\sodium\\randombytes_buf" does not exist at compile time in /var/www/cphalcon/phalcon/security/random.zep on 124 [nonexistent-function]

           return \\Sodium\\randombytes_buf(len);
        ----------------------------------------^


Warning: Function "\\sodium\\randombytes_uniform" does not exist at compile time in /var/www/cphalcon/phalcon/security/random.zep on 320 [nonexistent-function]

           return \\Sodium\\randombytes_uniform(len) + 1;
        ---------------------------------------------^


Warning: Function "gettext" does not exist at compile time in /var/www/cphalcon/phalcon/translate/adapter/gettext.zep on 86 [nonexistent-function]

           let translation = gettext(index);
        -----------------------------------^


Warning: Function "dgettext" does not exist at compile time in /var/www/cphalcon/phalcon/translate/adapter/gettext.zep on 88 [nonexistent-function]

           let translation = dgettext(domain, index);
        --------------------------------------------^


Warning: Function "ngettext" does not exist at compile time in /var/www/cphalcon/phalcon/translate/adapter/gettext.zep on 123 [nonexistent-function]

           let translation = ngettext(msgid1, msgid2, count);
        ----------------------------------------------------^


Warning: Function "dngettext" does not exist at compile time in /var/www/cphalcon/phalcon/translate/adapter/gettext.zep on 125 [nonexistent-function]

           let translation = dngettext(domain, msgid1, msgid2, count);
        -------------------------------------------------------------^


Warning: Function "textdomain" does not exist at compile time in /var/www/cphalcon/phalcon/translate/adapter/gettext.zep on 136 [nonexistent-function]

          return textdomain(domain);
        ---------------------------^


Warning: Function "textdomain" does not exist at compile time in /var/www/cphalcon/phalcon/translate/adapter/gettext.zep on 144 [nonexistent-function]

          return textdomain(this->getDefaultDomain());
        ---------------------------------------------^


Warning: Function "bindtextdomain" does not exist at compile time in /var/www/cphalcon/phalcon/translate/adapter/gettext.zep on 183 [nonexistent-function]

            bindtextdomain(key, value);
        ------------------------------^


Warning: Function "bindtextdomain" does not exist at compile time in /var/www/cphalcon/phalcon/translate/adapter/gettext.zep on 186 [nonexistent-function]

           bindtextdomain(this->getDefaultDomain(), directory);
        ------------------------------------------------------^


Copying new kernel files...
Preparing for PHP compilation...
Preparing configuration file...
Compiling...
Installing...
Extension installed!
Add extension=phalcon.so to your php.ini
Don't forget to restart your web server

My Dockerimage:

FROM php:7.0-fpm

WORKDIR /var/www

RUN apt-get update \
    && apt-get install -y \
        build-essential \
        git \
        re2c \
        libpcre3-dev \
        libfreetype6-dev \
        libjpeg62-turbo-dev \
        libmcrypt-dev \
        libpng12-dev \
        libxml2-dev \
        libtidy-dev \
    && docker-php-ext-install -j$(nproc) iconv mcrypt json xml tidy zip \
    && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
    && docker-php-ext-install -j$(nproc) gd

ENV PHPREDIS_VERSION php7
RUN curl -L -o redis.tar.gz https://github.com/phpredis/phpredis/archive/$PHPREDIS_VERSION.tar.gz \
    && tar xfz redis.tar.gz \
    && rm -r redis.tar.gz \
    && ( \
        cd phpredis-$PHPREDIS_VERSION \
        && phpize \
        && ./configure \
        && make \
        && make install \
    ) \
    && rm -r phpredis-$PHPREDIS_VERSION \
    && docker-php-ext-enable redis

RUN php -r "readfile('https://getcomposer.org/installer');" | php -- --install-dir=/usr/local/bin --filename=composer

RUN git clone https://github.com/phalcon/zephir.git \
    && cd zephir \
    && ./install-nosudo \
    && cd ..

RUN git clone https://github.com/phalcon/cphalcon.git \
    && cd cphalcon \
    && git checkout 2.1.x \
    && /root/bin/zephir build --backend=ZendEngine3 \
    && cd .. \
    && echo "extension=phalcon.so" >> /usr/local/etc/php/conf.d/docker-php-ext-redis.ini
#   && docker-php-ext-enable phalcon

CMD ["php-fpm"]


33.6k
Accepted
answer

You can find the .so after a successful compilation at:

cphalcon/ext/modules/phalcon.so


1.3k

Thx, that was docker volumes problem.

You can find the .so after a successful compilation at:

``` cphalcon/ext/modules/phalcon.so ```