我有一个使用Doctrine MongoDB ODM的Symfony 2应用程序,我正在尝试使用PHP 7运行它.
我已经成功安装了PHP 7,但是通过Composer安装依赖项让我感到悲伤,出现以下错误:
doctrine/mongodb 1.0.x-dev requires ext-mongo >=1.2.12,<1.7-dev -> the requested PHP extension mongo is missing from your system.
Run Code Online (Sandbox Code Playgroud)
我设法通过apt安装PHP 7 mongo扩展:
apt-get install php7.0-mongo
Run Code Online (Sandbox Code Playgroud)
为了确定,我还mongodb通过PECL 安装了扩展:
sudo apt-get install -y php-pear php7.0-dev libcurl3-openssl-dev
sudo pecl install mongodb
Run Code Online (Sandbox Code Playgroud)
但是,我仍然得到无法找到mongo扩展名的错误.似乎存在版本差异,ext-mongo >=1.2.12但只是1.1.6安装了::
$ php -i | grep mongo
/etc/php/7.0/cli/conf.d/20-mongodb.ini,
mongodb
mongodb support => enabled
mongodb version => 1.1.6
mongodb stability => stable
libmongoc version => 1.3.5
mongodb.debug => no value => no …Run Code Online (Sandbox Code Playgroud) 即使我阅读了手册,我也很难理解FILES _ $ {PN}.例如,我正在研究制作启动脚本的这个例子.在我写了类似的东西之后,我收到了这些错误消息.
ERROR: initscriptd-1.0-r0 do_package: QA Issue: initscriptd: Files/directories were installed but not shipped in any package:
/usr
/usr/sbin
Please set FILES such that these items are packaged. Alternatively if they are unneeded, avoid installing them or delete them within do_install.
initscriptd: 2 installed and not shipped files. [installed-vs-shipped]
ERROR: initscriptd-1.0-r0 do_package: Fatal QA errors found, failing task.
ERROR: initscriptd-1.0-r0 do_package: Function failed: do_package
ERROR: Logfile of failure stored in: /home/yahia/Desktop/elinux_dev/bake_factory/poky-pyro-17.0.1/build/tmp/work/core2-64-poky-linux/initscriptd/1.0-r0/temp/log.do_package.5252
ERROR: Task (/home/yahia/Desktop/elinux_dev/bake_factory/poky-pyro-17.0.1/meta-mylayer/recipes-core/mylayer-initscript/initscriptd.bb:do_package) failed with …Run Code Online (Sandbox Code Playgroud) 就上下文而言,对驱动程序进行编程以与Xilinx板上的嵌入式Linux(Yocto:krogoth)上的FPGA IP内核进行交互。
为了调试,我想从物理内存中读取特定的内存地址。/ dev / mem看起来很有希望。我想问一下如何从命令行中读取特定物理内存地址的值。我希望可以cat /dev/mem 0x2000000通过读取0x2000000字节的内容。
我在两个实体之间有一个 ManyToOne 关系:Usuario 和 Departamento,有些用户没有任何部门,我想让实体 Usuario 中的字段 departamento 可以为空,如何制作这个。我的代码如下所示:
<?php
namespace CECMED\TarifaBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Validator\Constraints as Assert;
/**
* Usuario
*
* @ORM\Table()
* @ORM\Entity(repositoryClass="CECMED\TarifaBundle\Entity\UsuarioRepository")
* @UniqueEntity("email")
*/
class Usuario implements UserInterface{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
* @Assert\NotBlank(message="No debe dejar este campo vacío")
* @ORM\Column(name="nombre", type="string",unique=true, length=255)
*/
private $nombre;
/**
* @var string
* @Assert\NotBlank(message="No debe dejar …Run Code Online (Sandbox Code Playgroud) 当我尝试使用错误的凭据登录时,它会显示"再次尝试,错误的凭据",但在输入正确的凭据后,它会显示错误找不到"GET /"的路由(来自" http:// localhost/bdayProj/web/app_dev. php/login ").以下是我的security.yml的配置
security:
encoders:
FOS\UserBundle\Model\UserInterface: bcrypt
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: ROLE_ADMIN
# http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers
providers:
in_memory:
memory: ~
fos_userbundle:
id: fos_user.user_provider.username
firewalls:
# disables authentication for assets and the profiler, adapt it according to your needs
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
pattern: ^/
form_login:
provider: fos_userbundle
csrf_token_generator: security.csrf.token_manager
logout: true
anonymous: true
# activate different ways to authenticate
# http_basic: ~
# http://symfony.com/doc/current/book/security.html#a-configuring-how-your-users-will-authenticate
# form_login: ~
# http://symfony.com/doc/current/cookbook/security/form_login_setup.html
access_control:
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY } …Run Code Online (Sandbox Code Playgroud) 我想将所有返回“命令”文件保存在日志文件中
<?php
namespace LogicielBundle\Command\Cron;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class MailRapportDometechCommand extends ContainerAwareCommand
{
protected function configure()
{
$this
->setName('logiciel:mail_rapport_preparation_dometech')
;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$output->writeln('. <bg=black;fg=white>Log color ...</>');
$logFile = fopen('app/CommandLogs/MailRapportDometech/compteur.txt', 'w+');
fputs($logFile, 'Test ... how to have $output data ?');
fclose($logFile);
}
}
Run Code Online (Sandbox Code Playgroud)
如果可能的话,如果有错误,请给我发送电子邮件:) 谢谢:)
symfony ×4
php ×2
yocto ×2
composer-php ×1
doctrine-odm ×1
doctrine-orm ×1
openembedded ×1
orm ×1
php-7 ×1
shell ×1
xilinx ×1