Как запустить KPHP?

Доброго времени суток!
Кто-нибудь знает, как правильно собрать и запустить KPHP? В документации есть инструкция по сборке, но она не включает в себя сборку KPHP.
Заранее спасибо.
  • Вопрос задан
  • 6929 просмотров
Пригласить эксперта
Ответы на вопрос 5
miraage
@miraage
Старый прогер
Он Вам не нужен, если Вы не знаете, как его собрать.
Ответ написан
Клонируем репозиторий KPHP
В папке с репой делаем
make kphp
Не забываем поставить нужные библиотечки.
Смотрим /kphp-kdb/objs/bin/kphp2cpp
Там можно увидеть
Запускаем:
./kphp2cpp ../test-kphp/index.php
Результат выполнения

File [kphp/index.src_index389dab75@u.h] changed
File [kphp/xmain.cpp] changed
File [kphp/init_scripts.cpp] changed
File [kphp/init_scripts.h] changed
File [kphp/index.src_index389dab75@u.cpp] changed
File [kphp/dfs0.index.src_index389dab75@u.h] changed
File [kphp/dfs0.index.src_index389dab75@u.cpp] changed
File [kphp/dfs1.index.src_index389dab75@u.h] changed
File [kphp/dfs1.index.src_index389dab75@u.cpp] changed
File [kphp/dfs2.index.src_index389dab75@u.h] changed
File [kphp/dfs2.index.src_index389dab75@u.cpp] changed
File [kphp/dfs3.index.src_index389dab75@u.h] changed
File [kphp/dfs3.index.src_index389dab75@u.cpp] changed
File [kphp/dfs4.index.src_index389dab75@u.h] changed
File [kphp/dfs4.index.src_index389dab75@u.cpp] changed
File [kphp/dfs5.index.src_index389dab75@u.h] changed
File [kphp/dfs5.index.src_index389dab75@u.cpp] changed
File [kphp/dfs6.index.src_index389dab75@u.h] changed
File [kphp/dfs6.index.src_index389dab75@u.cpp] changed
File [kphp/dfs7.index.src_index389dab75@u.h] changed
File [kphp/dfs7.index.src_index389dab75@u.cpp] changed
File [kphp/dfs8.index.src_index389dab75@u.h] changed
File [kphp/dfs8.index.src_index389dab75@u.cpp] changed
File [kphp/dfs9.index.src_index389dab75@u.h] changed
File [kphp/dfs9.index.src_index389dab75@u.cpp] changed
File [kphp/dfs10.index.src_index389dab75@u.h] changed
File [kphp/dfs10.index.src_index389dab75@u.cpp] changed
File [kphp/dfs11.index.src_index389dab75@u.h] changed
File [kphp/dfs11.index.src_index389dab75@u.cpp] changed
File [kphp/dfs12.index.src_index389dab75@u.h] changed
File [kphp/dfs12.index.src_index389dab75@u.cpp] changed
File [kphp/dfs13.index.src_index389dab75@u.h] changed
File [kphp/dfs13.index.src_index389dab75@u.cpp] changed
File [kphp/dfs14.index.src_index389dab75@u.h] changed
File [kphp/dfs14.index.src_index389dab75@u.cpp] changed
File [kphp/dfs15.index.src_index389dab75@u.h] changed
File [kphp/dfs15.index.src_index389dab75@u.cpp] changed
File [kphp/dfs16.index.src_index389dab75@u.h] changed
File [kphp/dfs16.index.src_index389dab75@u.cpp] changed
File [kphp/dfs17.index.src_index389dab75@u.h] changed
File [kphp/dfs17.index.src_index389dab75@u.cpp] changed
File [kphp/dfs18.index.src_index389dab75@u.h] changed
File [kphp/dfs18.index.src_index389dab75@u.cpp] changed
File [kphp/dfs19.index.src_index389dab75@u.h] changed
File [kphp/dfs19.index.src_index389dab75@u.cpp] changed
File [kphp/dfs20.index.src_index389dab75@u.h] changed
File [kphp/dfs20.index.src_index389dab75@u.cpp] changed
File [kphp/dfs21.index.src_index389dab75@u.h] changed
File [kphp/dfs21.index.src_index389dab75@u.cpp] changed
File [kphp/dfs22.index.src_index389dab75@u.h] changed
File [kphp/dfs22.index.src_index389dab75@u.cpp] changed
File [kphp/dfs23.index.src_index389dab75@u.h] changed
File [kphp/dfs23.index.src_index389dab75@u.cpp] changed
File [kphp/dfs24.index.src_index389dab75@u.h] changed
File [kphp/dfs24.index.src_index389dab75@u.cpp] changed
File [kphp/dfs25.index.src_index389dab75@u.h] changed
File [kphp/dfs25.index.src_index389dab75@u.cpp] changed
File [kphp/dfs26.index.src_index389dab75@u.h] changed
File [kphp/dfs26.index.src_index389dab75@u.cpp] changed
File [kphp/dfs27.index.src_index389dab75@u.h] changed
File [kphp/dfs27.index.src_index389dab75@u.cpp] changed
File [kphp/dfs28.index.src_index389dab75@u.h] changed
File [kphp/dfs28.index.src_index389dab75@u.cpp] changed
File [kphp/dfs29.index.src_index389dab75@u.h] changed
File [kphp/dfs29.index.src_index389dab75@u.cpp] changed
File [kphp/dfs30.index.src_index389dab75@u.h] changed
File [kphp/dfs30.index.src_index389dab75@u.cpp] changed
File [kphp/dfs31.index.src_index389dab75@u.h] changed
File [kphp/dfs31.index.src_index389dab75@u.cpp] changed
File [kphp/dfs.index.src_index389dab75@u.h] changed
File [kphp/dfs.index.src_index389dab75@u.cpp] changed
File [kphp/vars0.cpp] changed
File [kphp/vars.cpp] changed
Ответ написан
Ставил на Ubuntu 12.04.4 LTS

sudo apt-get install git-core openssl zlib1g-dev libcg libprcre3-dev

Ставим libre2:
wget re2.googlecode.com/files/re2-20140304.tgz
tar -zxvf re2-20140304.tgz
cd re2/
make
make test (Не обращаем внимание на ошибку)
make install
make testinstall

cd /usr/local/src/
git clone https://github.com/vk-com/kphp-kdb
cd /usr/local/src/kphp-kdb/

make kphp

Проверяем сборку: /usr/local/src/kphp-kdb/objs/bin/kphp2cpp
Если все ок:

export KPHP_PATH=/usr/local/src/kphp-kdb

Пример компиляции php в kphp:

Для примера возмем файл bench.php
Лежит он здесь: https://gist.github.com/anonymous/9391146
Скачиваем, кладем.
mkdir /var/www/testkphp
cd /var/www/testkphp/
Компилируем bench.php в kphp
python /usr/local/src/kphp-kdb/KPHP/tests/kphp.py bench.php -o bench
После компиляции запускаем
./bench
Увидим таблицу тестов.

Сравниваем с php:
php bench.php

Радуемся!
Ответ написан
@arseny30
export KPHP_PATH=<path_to_git>
python KPHP/tests/kphp.py a.php -o a
Ответ написан
Комментировать
rumkin
@rumkin
make && make install не помог?
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы