我正在尝试让 mssql 驱动程序工作。我从微软下载了pdo驱动程序,将文件放入php_pdo_sqlsrv_7_nts_x64.dll并C:\Program Files\PHP\ext编辑php.ini以添加extension=php_pdo_sqlsrv_7_nts_x64.dll到其中。
这是结果:
$ php -v
PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files\PHP\ext\php_pdo_sqlsrv_7_nts_x64.dll' - The specified procedure could not be found.
in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library 'C:\Program Files\PHP\ext\php_sqlsrv_7_nts_x64.dll.dll' - The specified procedure could not be found.
in Unknown on line 0
PHP 7.1.6 (cli) (built: Jun …Run Code Online (Sandbox Code Playgroud) PhpStorm version: 2018.2
Symfony Plugin Version: 0.16.165
Symfony version: 4.1.3
OS: Windows 10
Run Code Online (Sandbox Code Playgroud)
我不明白为什么,但我的树枝页面中的每个包含和扩展都包含有关丢失模板的警告突出显示。我所有的树枝页面都在模板文件夹中。
代码可以工作,但是当我想在 git 中提交时,我会收到关于它们的抱怨。
我已经尝试了“使用 Symfony 插件在 PhpStorm 中缺少 Twig 模板”中的所有答案,但均无济于事。
命名空间已经设置。
据我所知,Twig 显示了正确的配置。
$ php bin/console debug:config twig
Current configuration for extension with alias "twig"
=====================================================
twig:
paths:
'C:\Linux\Cygwin\home\me\PhpstormProjects\MyApp\MyApp\vendor\knplabs\knp-menu\src\Knp\Menu/Resources/views': null
'C:\Linux\Cygwin\home\me\PhpstormProjects\MyApp\MyApp/templates': null
debug: true
strict_variables: true
exception_controller: 'twig.controller.exception::showAction'
form_themes:
- form_div_layout.html.twig
globals: { }
autoescape: name
autoescape_service: null
autoescape_service_method: null
cache: 'C:\Linux\Cygwin\home\me\PhpstormProjects\MyApp\MyApp\var\cache\dev/twig'
charset: UTF-8
default_path: 'C:\Linux\Cygwin\home\me\PhpstormProjects\MyApp\MyApp/templates'
date:
format: 'F j, Y H:i'
interval_format: '%d …Run Code Online (Sandbox Code Playgroud) 我的教训库代码不能正常工作,而我是能够访问数据库和正常读取表数据.
我得到这个堆栈跟踪:
EntityManager->getRepository('AppBundle:Person') in src\AppBundle\Controller\PersonViewController.php (line 18)
public function indexAction(Request $request) {
$em = $this->getDoctrine()->getManager();
$repo = $em->getRepository('AppBundle:Person');
$persons = $repo->findAll();
dump($persons);
Run Code Online (Sandbox Code Playgroud)
人物实体模型:
Person.php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Class Person
* @Package AppBundle/Entity
*
* @ORM\Entity(repositoryClass="AppBundle\Repository\PersonRepository")
* @ORM\Table(name="[Person]")
*/
class Person {
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(type="string", length=4)
*/
protected $type;
}
Run Code Online (Sandbox Code Playgroud)
如果这也是必要的,回购代码:
PersonRepository.php
<?php
namespace AppBundle\Repository;
use /** @noinspection PhpUndefinedClassInspection */
Doctrine\ORM\EntityRepository;
class PersonRepository extends …Run Code Online (Sandbox Code Playgroud) 我刚刚安装了Xdebug,一旦启动PhpStorm,我就会看到这条消息:
这是由于其他一些程序运行端口9000,我想单独留下:
C:\Users\Rsluimers
? netstat -ab
...
TCP 0.0.0.0:9000 LT1736:0 LISTENING
[aeagent.exe]
...
Run Code Online (Sandbox Code Playgroud)
所以我在PhpStorm设置中设置了Xdebug调试器端口:
并在php.ini中:
...
[Xdebug]
zend_extension="C:\Program Files\PHP\ext\php_xdebug-2.5.5-7.1-vc14-x86_64.dll"
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=63342
xdebug.profiler_enable=1
xdebug.profiler_output_dir="C:\Program Files\PHP\tmp"
Run Code Online (Sandbox Code Playgroud)
但是在完全重启后会出现相同的错误.
我想将我的项目升级到 symfony 4,但该学说似乎没有找到查找我的数据库所需的 mssql 驱动程序。
$ php bin/console doctrine:database:create --env=dev
In AbstractMySQLDriver.php line 125:
An exception occurred in driver: could not find driver
Run Code Online (Sandbox Code Playgroud)
突出的是错误发生在 MySQLDriver.php 中,而我明确告诉 symfony 我想使用 sqlsrv 驱动程序。
这些是我的学说.yaml 设置:
parameters:
# Adds a fallback DATABASE_URL if the env var is not set.
# This allows you to run cache:warmup even if your
# environment variables are not available yet.
# You should not need to change this value.
env(DATABASE_URL): 'sqlsrv://my_user:my_password@my_host/my_dbname'
doctrine:
dbal:
# configure these for your …Run Code Online (Sandbox Code Playgroud) 虽然我遇到的错误本身也是一个问题,但我当前的特殊问题是我什至无法读取一半的错误,因为它被截断了,所以我不知道错误究竟是什么。
终端
$ vendor/bin/behat features/album.feature
Feature: Provide a consistent standard JSON API endpoint
In order to build interchangeable front ends
As a JSON API developer
I need to allow Create, Read, Update, and Delete functionality
Background: # features\album.feature:7
Given there are Albums with the following details: # FeatureContext::thereAreAlbumsWithTheFollowingDetails()
| title | track_count | release_date |
| The Dark side of the Moon | 12 | 1973-03-24T00:00:00+00:00 |
| Back in Black | 9 | 1980-06-25T23:22:21+00:00 |
| Thriller …Run Code Online (Sandbox Code Playgroud)