小编fab*_*ice的帖子

构建错误:致命错误:pcre.h:没有这样的文件或目录

我刚刚安装完Ubuntu 13.10.

我想尝试Phalcon,当我构建源代码(phalcon.so)时,我有这个错误:

     from /home/fabrice/Downloads/cphalcon/build/32bits/phalcon.c:204:
/usr/include/php5/ext/pcre/php_pcre.h:29:18: fatal error: pcre.h: No such file or directory
 #include "pcre.h"
                  ^
compilation terminated.
make: *** [phalcon.lo] Erreur 1
Run Code Online (Sandbox Code Playgroud)

我安装的灯是:

sudo apt-get install -y apache2 php5 mysql-server libapache2-mod-php5 php5-mysql php5-curl php5-imagick php5-mcrypt php5-memcache php5-sqlite php5-xdebug php-apc php5-intl php-mongo php5-dev GCC

有谁能够帮我 ?

php ubuntu build phalcon ubuntu-13.10

76
推荐指数
4
解决办法
7万
查看次数

使用Behat在PHP中找不到类'Behat\Behat\Context\BehatContext'

我正在尝试使用网站上的教程学习Behat .

第一步就行,没有错误出现.

但是当我改变它时ls_project/features/bootstrap/FeatureContext.php,如教程第二步所示,我收到以下错误:'Behat\Behat\Context\BehatContext' not found.

应用更改的教程代码:

# features/bootstrap/FeatureContext.php
<?php

use Behat\Behat\Context\BehatContext,
    Behat\Behat\Exception\PendingException;
use Behat\Gherkin\Node\PyStringNode,
    Behat\Gherkin\Node\TableNode;

class FeatureContext extends BehatContext
{
    /**
     * @Given /^I am in a directory "([^"]*)"$/
     */
    public function iAmInADirectory($dir)
    {
        if (!file_exists($dir)) {
            mkdir($dir);
        }
        chdir($dir);
    }
}
Run Code Online (Sandbox Code Playgroud)

完整的错误日志:

11:51:33 / ME : /var/www/test-driven/behat/ls_project
$ behat
# features/bootstrap/FeatureContext.php
PHP Fatal error:  Class 'Behat\Behat\Context\BehatContext' not found in /var/www/test-driven/behat/ls_project/features/bootstrap/FeatureContext.php on line 10
PHP Stack trace:
PHP   1. {main}() /opt/Behat/bin/behat:0
PHP   2. …
Run Code Online (Sandbox Code Playgroud)

php behat

7
推荐指数
2
解决办法
4063
查看次数

在AppKernel.php中获取parameters.yml参数

任何人都知道如何在AppKernel.php中获取parameters.yml(或_dev)?

我想动态地改变getLogDir()变量('mylogsdir')?

AppKernel.php:

$this->rootDir.'/'.$this->environment.'/'.$myLogDir;
Run Code Online (Sandbox Code Playgroud)

parameters.yml:

parameters:
    myLogDir: 'logdir'
Run Code Online (Sandbox Code Playgroud)

可能吗 ?

非常感谢Fabrice

parameters symfony

6
推荐指数
1
解决办法
1541
查看次数

升级后pip出错:'module'对象没有属性'SSL_ST_INIT'

在升级pip后,我尝试进行'pip冻结',但是我发现了这个错误:

# pip install --upgrade pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl (1.3MB)
    100% |################################| 1.3MB 737kB/s
Installing collected packages: pip
  Found existing installation: pip 9.0.1
    Uninstalling pip-9.0.1:
      Successfully uninstalled pip-9.0.1
Successfully installed pip-10.0.1

# pip freeze
Traceback (most recent call last):
  File "/usr/local/bin/pip", line 7, in <module>
    from pip._internal import main
  File "/usr/local/lib/python2.7/dist-packages/pip/_internal/__init__.py", line 42, in <module>
    from pip._internal import cmdoptions
  File "/usr/local/lib/python2.7/dist-packages/pip/_internal/cmdoptions.py", line 16, in <module>
    from pip._internal.index import (
  File "/usr/local/lib/python2.7/dist-packages/pip/_internal/index.py", line 15, in <module>
    from pip._vendor import html5lib, …
Run Code Online (Sandbox Code Playgroud)

python pip pyopenssl

2
推荐指数
1
解决办法
2752
查看次数

使用 DRF 缓存视图集:TypeError: _wrapped_view()

我只想对 ViewSet 使用缓存太慢:(,使用 Django REST 框架。

我这样做了:

...
from django.utils.decorators import method_decorator
from django.views.decorators.cache import cache_page
from django.views.decorators.vary import vary_on_cookie
...
class PRPKViewSet(viewsets.ModelViewSet):
    serializer_class = PrpkSerializer
    queryset = Prpk.objects.all().order_by('begin')
    # Authentification !
    permission_classes = (IsAuthenticated,)
    # Only 'get' method
    http_method_names = ['get']

    # Cache requested url for each user for 2 hours
    # @method_decorator(vary_on_cookie)
    @method_decorator(cache_page(60*2))
    def get_queryset(self):
        """ allow rest api to filter by submissions """
        queryset = Prpk.objects.all().order_by('begin')
        highway = self.request.query_params.get('highway', None)
        if highway is not None:
            queryset = …
Run Code Online (Sandbox Code Playgroud)

django memcached caching django-rest-framework

1
推荐指数
1
解决办法
1502
查看次数