我在symfony(2.5.7(上用奏鸣曲(2.3(运行项目。如果我使用 apache2 和 php 在 Ubuntu 下运行它,那么表单和 symfony 的所有其他部分的正确工作都没有问题。但是我希望在Windows上拥有代码,能够运行bash脚本来正确部署项目。这就是为什么我用cygserver、apache和php设置Cygwin。我设法在 apache 上为 cygwin 运行我的项目,但每次我打开编辑表单时,我都会收到这样的错误:
The name "s547b06c97e7c79.42607283" contains illegal characters. Names should start with a letter, digit or underscore and only contain letters, digits, numbers, underscores ("_"), hyphens ("-") and colons (":").
500 Internal Server Error - InvalidArgumentException
这些是堆栈跟踪中的最后 2 行:
2. at FormConfigBuilder ::validateName ('s547b0ee70b0ac5.07768096')
in /cygdrive/c/xampp/htdocs/wzp/vendor/symfony/symfony/src/Symfony/Component/Form/FormConfigBuilder.php at line 193
3. at FormConfigBuilder ->__construct ('s547b0ee70b0ac5.07768096', 'BackendPoiBundleEntityObiektydziedzictwa', object(EventDispatcher), array('block_name' => null, 'disabled' => false, 'label' => null, 'attr' => array(), 'translation_domain' => null, 'auto_initialize' => true, 'empty_data' => object(Closure), 'trim' => true, 'required' => true, 'read_only' => false, 'max_length' => null, 'pattern' => null, 'property_path' => null, 'mapped' => true, 'by_reference' => true, 'error_bubbling' => true, 'label_attr' => array(), 'virtual' => null, 'inherit_data' => false, 'compound' => true, 'method' => 'POST', 'action' => '', 'post_max_size_message' => 'The uploaded file was too large. Please try to upload a smaller file.', 'validation_groups' => null, 'error_mapping' => array(), 'constraints' => array(), 'cascade_validation' => false, 'invalid_message' => 'This value is not valid.', 'invalid_message_parameters' => array(), 'extra_fields_message' => 'This form should not contain extra fields.', 'csrf_protection' => true, 'csrf_field_name' => '_token', 'csrf_message' => 'The CSRF token is invalid. Please try to resubmit the form.', 'csrf_token_manager' => object(CsrfProviderAdapter), 'csrf_token_id' => null, 'csrf_provider' => object(CsrfTokenManagerAdapter), 'intention' => null, 'sonata_admin' => null, 'sonata_field_description' => null, 'label_render' => true, 'sonata_help' => null, 'horizontal_label_class' => '', 'horizontal_label_offset_class' => '', 'horizontal_input_wrapper_class' => '', 'data_class' => 'BackendPoiBundleEntityObiektydziedzictwa'))
in /cygdrive/c/xampp/htdocs/wzp/vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php at line 51
正如我之前所说,在 ubuntu 上的应用程序上运行这样的功能没有问题。cygwin托管在Windows 7 64位上
我没有配置 php.ini尽管增加了memory_limit并设置了 date.timezone。
这些是我的php模块:
bz2.ini ctype.ini
curl.ini gd.ini gmp.ini gv.ini
iconv.ini intl.ini json.ini mysql.ini
mysqli.ini pdo_dblib.ini pdo_mysql.ini pdo_pgsql.ini
pdo_sqlite.ini pgsql.ini phpmodules pspell.ini
readline.ini simplexml.ini sqlite3.ini tidy.ini
xsl.ini zlib.ini
如果我在 Windows 上从 xampp 运行相同的项目,也没有上述问题。
有人在 cygwin 上运行 apache + php 下的 symfony 项目吗?任何帮助表示赞赏。
编辑如果我运行cygwin 32位(在同一Windows 7 64位上(,我不会收到此错误。但另一个问题出现了。不知何故,奏鸣曲生成了如下路径:
C:pathtothefiletobeloaded/file.orm.xml
而不是
/cygdrive/c/path/to/the/file/to/be/loaded/file.orm.xml
这就是我收到错误的原因:There is no such file
.
我发现问题是在Windows 7下运行的cygwin的PHP。PHP 使用文件系统函数生成错误。根据PHP文档,一些功能(如符号链接(应该作为Windows PHP 5.3的核心功能,但这取决于Windows版本。
在Windows 8/8.1下,这就像一个魅力。