首页 \ 问答 \ NetBeans的include路径不起作用(NetBeans's include path doesn't work)

NetBeans的include路径不起作用(NetBeans's include path doesn't work)

我有一个可以在ZendFramework(库)上运行的NetBeansProject,并使用PHPUnit进行测试,但每次调用Zend Framework的某些函数(例如,引导文件调用它们)时,它会发出致命的错误,因为它无法找到那些文件:致命错误:require_once():无法打开所需的'Zend / Db / Table / Abstract.php'(include_path ='。; C:\ xampp \ htdocs \ pear; C:\ xampp \ php \ PEAR')in ....

我的bootstrap文件如下所示:

<?php

ini_set('display_startup_errors', 1);
ini_set('display_errors', 2);

defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'testing'));

defined('LIBRARY_PATH')
    || define('LIBRARY_PATH', realpath(dirname(__FILE__) . '/../library'));

defined('TESTS_PATH')
    || define('TESTS_PATH', realpath(dirname(__FILE__)));


//Define constant global variable
defined('_FOO_ROOT_DIR_') || define('_FOO_ROOT_DIR_', dirname(dirname(__FILE__)));
defined('_FOO_APP_DIR_') || define('_FOO_APP_DIR_', _FOO_ROOT_DIR_ . '/application');
defined('_FOO_LIB_DIR_') || define('_FOO_LIB_DIR_', _FOO_ROOT_DIR_ . '/library');
defined('_FOO_PUBLIC_DIR_') || define('_FOO_PUBLIC_DIR_', _FOO_ROOT_DIR_ . '/public');
defined('_FOO_TEST_DIR_') || define('_FOO_TEST_DIR_', _FOO_ROOT_DIR_ . '/tests');
defined('_FOO_ZF_DIR_') || define('_FOO_ZF_DIR_', 'C:\zend\ZendFramework-1.11.11\library');

require_once 'Zend/Db/Table/Abstract.php';
.
.
.
.
#End of bootstrap.php

而且require_once是触发错误的原因。 例如,如果我修改bootstrap文件而不是从'Zend / Db / Table / Abstract.php'执行require,我是从_FOO_ZF_DIR _。'/ Zend / Db / Table / Abstract.php'那样做的,那么问题就解决了,但我必须重写Zend库的每个文件中的每一个包含。

include上框架的路径是正确的,我已经将PHPUnit配置为我上面部分复制的bootstrap文件以及已由我的伙伴提供给我的phpunit.xml,该伙伴已经设置并运行了项目。

phpunit.xml看起来像这样(我不知道它是否与主题相关):

<phpunit bootstrap="./bootstrap.php" colors="true">
    <testsuite name="ApplicationTestSuite">
        <directory>./application/</directory>
        <directory>./library/</directory>
    </testsuite>
    <filter>
        <whitelist>
            <directory suffix=".php">../application</directory>
            <exclude>
                <directory suffix=".php">../application/modules/pal</directory>
                <directory suffix=".phtml">../application/views</directory>
                <file>../application/Bootstrap.php</file>
            </exclude>
        </whitelist>
    </filter>
    <logging>
        <log type="coverage-html" target="./log/coveragereport" charset="UTF-8"
             yui="true" highlight="false" lowUpperBound="35" highLowerBound="70"/>
    </logging>
</phpunit>

我还在选项工具上配置了Zend选项卡,注册了提供程序等。 那么我该如何解决这个问题,以便NetBeans能够检测到包含必须不仅与项目文件夹有关,而且与包含的库路径有关?

我还试图通过全局php包含和项目特定的(通过项目属性)包含库,它们都不起作用......

先谢谢你


I have a NetBeansProject that works on ZendFramework (the library) and uses PHPUnit to do the tests but each time some function of the Zend Framework is called (the bootstrap file calls them for example) it gives a fatal error because it can't find those files: Fatal error: require_once(): Failed opening required 'Zend/Db/Table/Abstract.php' (include_path='.;C:\xampp\htdocs\pear;C:\xampp\php\PEAR') in....

My bootstrap file looks like this:

<?php

ini_set('display_startup_errors', 1);
ini_set('display_errors', 2);

defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'testing'));

defined('LIBRARY_PATH')
    || define('LIBRARY_PATH', realpath(dirname(__FILE__) . '/../library'));

defined('TESTS_PATH')
    || define('TESTS_PATH', realpath(dirname(__FILE__)));


//Define constant global variable
defined('_FOO_ROOT_DIR_') || define('_FOO_ROOT_DIR_', dirname(dirname(__FILE__)));
defined('_FOO_APP_DIR_') || define('_FOO_APP_DIR_', _FOO_ROOT_DIR_ . '/application');
defined('_FOO_LIB_DIR_') || define('_FOO_LIB_DIR_', _FOO_ROOT_DIR_ . '/library');
defined('_FOO_PUBLIC_DIR_') || define('_FOO_PUBLIC_DIR_', _FOO_ROOT_DIR_ . '/public');
defined('_FOO_TEST_DIR_') || define('_FOO_TEST_DIR_', _FOO_ROOT_DIR_ . '/tests');
defined('_FOO_ZF_DIR_') || define('_FOO_ZF_DIR_', 'C:\zend\ZendFramework-1.11.11\library');

require_once 'Zend/Db/Table/Abstract.php';
.
.
.
.
#End of bootstrap.php

and that require_once is what triggers the error. If for example I modify the bootstrap file and instead of doing the require from 'Zend/Db/Table/Abstract.php' I do it from _FOO_ZF_DIR_.'/Zend/Db/Table/Abstract.php' then the problem gets solved, but I have to rewrite every single include from every single file of the Zend library.

The path to the framework on the include is correct, and I have configured my PHPUnit with the bootstrap file I partially copied above and that phpunit.xml that was already given to me by my partner who has the project set and running.

The phpunit.xml looks like this (I don't know if it's relevant to the topic):

<phpunit bootstrap="./bootstrap.php" colors="true">
    <testsuite name="ApplicationTestSuite">
        <directory>./application/</directory>
        <directory>./library/</directory>
    </testsuite>
    <filter>
        <whitelist>
            <directory suffix=".php">../application</directory>
            <exclude>
                <directory suffix=".php">../application/modules/pal</directory>
                <directory suffix=".phtml">../application/views</directory>
                <file>../application/Bootstrap.php</file>
            </exclude>
        </whitelist>
    </filter>
    <logging>
        <log type="coverage-html" target="./log/coveragereport" charset="UTF-8"
             yui="true" highlight="false" lowUpperBound="35" highLowerBound="70"/>
    </logging>
</phpunit>

I have also configured the Zend tab on the options tools, registering the provider and such. So how could I fix this so that the NetBeans can detect that the includes have to be found not only in relation to the project folder but also in relation to the included library path?

I've also tried to include the library through the global php includes and the project specific ones (through project properties) and neither of them works...

Thank you in advance


原文:https://stackoverflow.com/questions/22322669
更新时间:2023-08-11 08:08

最满意答案

无法识别的属性'targetFramework'。 请注意,属性名称区分大小写。

当没有安装更高版本(例如4.5.2)时,.NET 4将出现。 该属性是在.NET 4.5中添加的(因此ASP.NET加载程序知道要加载4系列的更高版本)。

如果您没有安装.NET 4.5或更高版本,则加载程序不知道如何处理该属性。

(.NET 4.5.2已经推出了Windows更新:IMHO服务器到目前为止应该至少运行该版本:它包含针对.NET 4的重要错误修复。特别是如果正在部署新的Web应用程序。)

我假设出现在YSOD上的V2是由于在.NET 4下无法加载回退。


Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.

That appears with .NET 4 when a later version (eg. 4.5.2) is not installed. The attribute is added in .NET 4.5 (so the ASP.NET loader knows to load a later version of the 4 series).

If you do not have .NET 4.5 or later installed the loader doesn't know what to do with that attribute.

(.NET 4.5.2 has been pushed out on Windows Updates: IMHO servers really should be running at least that version by now: it contains significant bug fixes over .NET 4. Particularly so if new web apps are being deployed.)

I assume the V2 appearing on the YSOD is due to fallback having failed to load under .NET 4.

相关问答

更多
  • 软件介绍: net framework 4.0 是一款windows内部的组件,在一些编辑环境、执行程序上会出现你电脑没有安装Mircosoft.Net.Framework或者版本太老的情况导致程序无法使用,这时候你就要安装对应版本程序。这款软件的版本有很多,但是版本并不是越高越好,有些程序会要求3.5版本才可以运行,你的4.0太高反而运行不了。 Net.Framework4.0安装教程 1.安装之前请先确认原版本已经卸载干净,不然安装不了Mircosoft.Net.Framework4.0。 2.安装过程 ...
  • 看来,尝试打开到SQL Server的连接失败。 您需要为IIS APPPOOL\ASP.NET v4.0添加一个登录到SQL Server, IIS APPPOOL\ASP.NET v4.0数据库授予权限。 在SSMS中,在服务器下,展开安全性,然后右键单击登录并选择“新建登录...”。 在“新建登录”对话框中,输入应用程序池作为登录名,然后单击“确定”。 然后,您可以右键单击应用程序池的登录名,选择“属性”,然后选择“用户映射”。 检查相应的数据库和相应的角色。 我想你可以选择db_datareader ...
  • 框架3.5包括3.0和2.0,所以它应该足够了。 但请注意,System.ServiceModel.dll随框架3.0发布并具有3.0.0.0版。 有史以来发布的唯一带有版本2.0.0.0的System.ServiceModel.dll是早期的WCF CTP(参见本页底部)。 The framework 3.5 includes the 3.0 and the 2.0 so it should suffice. Note however that System.ServiceModel.dll was re ...
  • 正如您的测试已经显示的那样,您正在做的事情应该可以正常工作。 然而,当我几个月前研究过这篇文章时,我记得至少阅读过一篇文章,表明通常最好使用集成而非经典的管道,除非你有令人信服的理由不这样做。 我现在找不到那篇文章,但是下面的文章: 新的IIS7文章:利用IIS7集成管道解释了一些好处。 因此,虽然经典模式适合您的情况,但您肯定不必使用经典管道来运行.net 2.0应用程序,除非您使用自定义ISAPI扩展或过滤器。 假设你没有那些(自定义的ISAPI东西),如果是我,我会转移到集成管道,因为这是IIS7的主 ...
  • 无法识别的属性'targetFramework'。 请注意,属性名称区分大小写。 当没有安装更高版本(例如4.5.2)时,.NET 4将出现。 该属性是在.NET 4.5中添加的(因此ASP.NET加载程序知道要加载4系列的更高版本)。 如果您没有安装.NET 4.5或更高版本,则加载程序不知道如何处理该属性。 (.NET 4.5.2已经推出了Windows更新:IMHO服务器到目前为止应该至少运行该版本:它包含针对.NET 4的重要错误修复。特别是如果正在部署新的Web应用程序。) 我假设出现在YSOD上 ...
  • 您可以通过打开SQL Management Studio将此用户添加到数据库登录,导航到您的数据库,然后打开安全性然后登录并添加新登录并搜索该用户 You can add this user to your DB Logins by openning SQL Management Studio, Navigate to your database then open the Security then Logings and add new login and search for that user
  • 通过将模式从Integrated更改为Classic,并以自己的身份运行应用程序池(稍后将更改为专门为此Web应用程序创建的用户),我能够解决问题。 尝试编辑集成的rem处理程序时,我仍然会收到错误消息,可能这只是该特定处理程序的问题。 I was able to get past the issue by changing the mode from Integrated to Classic, and running the app pool as myself (to be changed later ...
  • 我无法让上述方案奏效。 所以我将网站降级为使用Framework 2.0的.Net 3.5,这使部署无痛。 不确定它是关于asp.net 4.0和IIS 6.0的,但我无法在客户端环境中工作,即使我在我们的测试环境中工作。 I could not get the above scenario to work. So I downgraded the website to .Net 3.5 which uses Framework 2.0 and this made deployment painless. ...
  • 我目前正在使用Open XML SDK 2.0 dll,同时针对.NET 4.0,并且根本没有任何问题。 它可能只需要至少运行.NET 3.5 sp1或更高版本,所以如果你可以在不安装.NET 3.5 sp1的情况下获得dll,那么你应该没问题。 I am currently using the Open XML SDK 2.0 dll's while targeting .NET 4.0 and haven't had any issues at all. It probably just needs a ...
  • 这是命令: appcmd set app /app.name:APPLICATION_NAME/ /applicationPool:Clr2IntegratedAppPool 有关此命令的更多信息,请访问 在执行命令之前,请记住向右更改(可以安装多个IIS)IIS目录 C:\Program Files\IIS Express 在我的情况下。 Here is the command: appcmd set app /app.name:APPLICATION_NAME/ /applicationPool:C ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)