• Сколько серверов использует Хабрахабр?

    Rpsl
    @Rpsl
    Кратко о себе
    Хабрахабр написан на php.

    Кол-во серверов тайна, но суммарно их больше 5. В большинстве своем они на фряхе.

    Стэк у нас стандартный, nginx, php-fpm 5.5, mysql, mongodb, sphinx, memcached, redis, beanstalkd, etc.
    Ответ написан
    3 комментария
  • Как запустить KPHP?

    Ставил на 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

    Радуемся!
    Ответ написан
    2 комментария
  • Как запустить KPHP?

    Клонируем репозиторий 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
    Ответ написан
    1 комментарий
  • Как использовать Sphinx вместе с laravel php framework? Нужен пинок?

    sofcase
    @sofcase
    Веб-разработчик

    Поле my_keywords_table - ваша таблица, в которой производится поиск, а column - собственно поле в таблице, по которому происходит поиск.

    Если верить исходникам: https://github.com/scalia/sphinxsearch/blob/master/src/Scalia/SphinxSearch/SphinxSearch.php

    DB::table($config['table'])->whereIn($config['column'], $matchids)->get();

    Ответ написан
    1 комментарий