I'm using a 3rd party php library to connect to Microsoft Dynamics CRM, which I've placed in the /lib folder of Magento.
I've created a controller for testing purposes, in which I'm including the files from the lib folder (which are being included, as changing the paths throws an error), but when I try and initiate the class defined in one of the included files, i get this warning:
Warning: include(DynamicsCRM2011\Connector.php) [function.include]: failed to open stream: No such file or directory.
It shouldn't be trying to include anything, the class is already defined in a previously included file!
Any ideas how I can prevent this from happening? I'd have thought it would only try to autoload the file if the class is undefined surely?
Related
I'm trying to generate an entity class with the phalcon model pedido_item command and the generator, for some unknown reason (to me) seems to be pointing to my project's parent directory (Applications) instead of its own.
Here's the error I get.
PHP Warning:
file_put_contents(/home/nmobregon/Applications/app/models/PedidoItem.php): failed to open stream: No such file or directory in
/home/nmobregon/phalcon-devtools/scripts/Phalcon/Builder/Model.php on
line 519
Error: Unable to write to
/home/nmobregon/Applications/app/models/PedidoItem.php
Of course I haven't touched the generator code so it seems really strange that somehow is now pointing to a worng path.
Any ideas? Please tell me if I should add more info.
Thanks
I installed laravel 5.1 on my windows 7, after that i tried to open blog/app/Htttp/routes.php.Now there's a error on my browser saying
"Fatal error: Class 'Route' not found in
C:\xampp\htdocs\Laravel_1\blog\app\Http\routes.php on line 14".
How do i remove this error?
Before a class is available in PHP you will need to require/include it. As you have opened up the file directly in the browser, the laravel application is not bootstrapped and none of the dependencies are loaded to be used.
If you open up public/index.php, you will find a line that says
require __DIR__.'/../bootstrap/autoload.php';
// this later calls composer autoload which compiles a file
// that includes all the classes that you have specified in your `composer.json`.
Now that you have opened the file directly, non of the classes are included and hence you get the error.
I am not sure about your intentions for opening that file directly in the browser. I can only suggest you that the error is expected and you should go through the public/index.php for the application to work properly.
I am using Typo3 cms. Under the main folder I have different other folders such as typo3, typo3conf, fileadmin etc...
I have created two php files named myphp.php, and myantoher.php inside the main folder, and I used require() in myphp.php. But when that line is reached during execution, I am receiving the following errors:
Warning: require(doc/PHPMailer/class.PHPMailer.php): failed to open
stream: No such file or directory in
/var/www/domainname.com/doc/contactform.php on line 3 Fatal error:
require(): Failed opening required 'doc/PHPMailer/class.PHPMailer.php'
Why am I receiving an error when I try to require() this file?
It's very easy to add PHP or any other files in TYPO3
You have to script
includeLibs.cookie = fileadmin/cookie/cookie.php
page.20 = USER_INT
page.20 {
userFunc = user_setcookie
}
For more information about TYPO3 stuff you may visit my blog
https://jainishsenjaliya.wordpress.com/2015/04/01/how-to-include-custome-php-file-in-typo3/
Regards,
Jainish Senjaliya
Here you can include your custom PHP file
Using the CONFIG object.
ex:
config.includeLibrary = fileadmin/templates/myscript.php
Using the PAGE object.
ex:
page.100.file = fileadmin/templates/myscript.php
FYI. it's not possible to use includeLibs via TypoScript anymore. Instead, ensure to encapsulate code in PHP functions or PHP classes, and load them via the class loader (by putting them in a simple extension) or via Composer's autoload functionality.
You can still call functions/methods then via PHP all around TYPO3 an call them in Frontend via
page.10 = USER_INT
page.10.userFunc = bennis_function
or if it is a method in a class
page.10.userFunc = Benni\Mack\RandomClassName->my_method
If you want to do it quick and dirty, you can require your file in your AdditionalConfiguration.php file and use it everywhere as well.
Still, best approach is using an extension with PHP classes and PSR-4 autoloading.
I'm trying to load a custom library in Concrete5.
I've created a library file, internallib.php, and placed the file in the /libraries folder. This file does not extend any core library files. I keep getting this error:
Warning: require_once(/var/www/concrete/libraries/internalauth.php) [function.require-once]: failed to open stream: No such file or directory in /var/www/portal/concrete/core/libraries/loader.php on line 30
Though if I move the file into the folder /concrete/libraries, I don't get this error. Should I be putting my library file into the concrete/libraries, or /libraries folder? I assumed that since this is a 3rd party library, it should go into the root libraries folder, as not to conflict with any future core updates.
I'm currently running v.5.6.0.2
Any ideas?
You are right, the root libraries folder is the place to go.
You could try to put it in libraries/3rdparty which is where 3rd party libraries should be.
The problem however might come from the way you are calling the library, not from the library itself.
Maybe you could tell us more?
While trying to include my own class library in Yii. I used this code to include a class file in Yii.
Yii::import('application.apis.myapi.*');
myfile lies at [protected/apis/myapi.php]
I don't know I am getting this error:
[YiiBase::include(myapi.php) [<a href='function.YiiBase-include'>function.YiiBase-include</a>]: failed to open stream: No such file or directory]
I think you should import as
Yii::import('application.apis.*');
It will import all php files under directory applications/apis/.
Yii::import('application.apis.myapi'); //only one file
EDIT: also check this question: Yii import functionality
Maybe you override basePath for your application? (look at protected/config/main.cfg)