windows子系统ubuntu 安装phalcon7开发环境php

# php71编译环境

sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt-get install php7.1-dev libpcre3-dev gcc make

# if enable qrcode
sudo apt-get install libqrencode-dev libzbar-dev imagemagick libmagick++-dev libmagickwand-dev libmagickcore-dev libpng12-dev
sudo ln -s /usr/include/ImageMagick-6/ /usr/include/ImageMagick
# class Phalcon\Async : --enable-sysvsem --enable-pcntl
wget http://at2.php.net/get/php-7.1.24.tar.gz/from/this/mirror
tar xvf mirror

cd php-7.1.24/
./buildconf --force
./configure \
--prefix=/mnt/d/vhs/php/php71phlone \
--with-config-file-path=/mnt/d/vhs/php/php71phlone/etc \
--with-fpm-user=www \
--with-fpm-group=www \
--with-pdo-pgsql \
--with-pdo-mysql \
--with-pdo-sqlite \
--with-iconv-dir \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-libxml-dir=/usr \
--enable-xml \
--disable-rpath \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--with-curl \
--enable-mbregex \
--enable-mbstring \
--with-mcrypt \
--enable-ftp \
--with-gd \
--enable-gd-native-ttf \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--enable-zip \
--without-pear \
--with-gettext \
--disable-fileinfo \
--enable-maintainer-zts \
--enable-phpdbg-debug \
--enable-debug

make -j4

sudo make install

Installing shared extensions:     /mnt/d/vhs/php/php71phlone/lib/php/extensions/debug-zts-20160303/
Installing PHP CLI binary:        /mnt/d/vhs/php/php71phlone/bin/
Installing PHP CLI man page:      /mnt/d/vhs/php/php71phlone/php/man/man1/
Installing phpdbg binary:         /mnt/d/vhs/php/php71phlone/bin/
Installing phpdbg man page:       /mnt/d/vhs/php/php71phlone/php/man/man1/
Installing PHP CGI binary:        /mnt/d/vhs/php/php71phlone/bin/
Installing PHP CGI man page:      /mnt/d/vhs/php/php71phlone/php/man/man1/
Installing build environment:     /mnt/d/vhs/php/php71phlone/lib/php/build/

常见问题

# curl版本太低
sudo apt install libcurl4-openssl-dev
# 或者
git clone https://github.com/curl/curl.git
# wget https://curl.haxx.se/download/curl-7.62.0.tar.gz
cd curl 2 ./buldconf
./configure
make
make install
curl -V

# libmcrypt-dev
sudo apt install libmcrypt-dev

编译phalcon7扩展

git clone git://github.com/dreamsxin/cphalcon7.git
cd cphalcon7/ext
/mnt/d/vhs/php/php71phlone/bin/phpize
./configure \
--with-php-config=/mnt/d/vhs/php/php71phlone/bin/php-config \
--enable-chart=yes \
--enable-qrcode=yes \
--enable-websocket=yes \
--enable-server=yes
make -j4
sudo make install

mkdir /mnt/d/vhs/php/php71phlone/etc
touch php.ini
nano php.ini
extension=phalcon.so

php内置服务器

/mnt/d/vhs/php/php71phlone/bin/phpize/php -S 0.0.0.0:8000 -t /mnt/d/wslwork/phalconwork/phalcondemo/public/