Concrete5 - library not being loaded - php

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?

Related

Unable to include a php file in typo3

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.

Zend 1 3d party NameSpaces autoload don't working

I'm trying to implement Amazon WebServices PHP SDK into my Zend 1 project, but it seems to fail loading the classes.
I have got the library into library/Eplan/AmazonCloudSearch and after investigation it seems that in order to be able to load the namespace I need to call the registerNamespace method from Zend_Loader_Autoloader::getInstance() so I've got this on the top of the autoloader (I also tried to put it in the bootstrap without luck):
require_once 'Zend/Loader/Autoloader.php';
$autoloader = Zend_Loader_Autoloader::getInstance();
$autoloader->registerNamespace("Aws");
Namespaces of the AWS library are like this: Aws\namespace
The errors I get are like Warning: include_once(Aws/Common/Aws.php): failed to open stream: No such file or directory in /srv/www_nfs_desarrollo/vhosts/desarrollo.techmaker.net/httpdocs/library/Zend/Loader.php on line 134
Autoloader full code: http://pastebin.com/gS9mcntK
I've been the full day struggling my head trying to solve this without luck, any ideas?
In order to use $autoloader->registerNamespace('Aws'), the AWS lib you seek must be on your PHP include path, which probably includes your ./library directory. Instead, you have the AWS lib buried down in ./library/Eplan/AmazonCloudSearch, which almost certainly is not on your PHP include_path.
Try moving the AWS library up two levels, directly into the ./library directory.
You can autoload using your application.ini file using following code.
autoloaderNamespaces[] = "Aws"

Magento trying to autoload class unnecessarily

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?

Error: application file does not exist

I have installed a new zf project, and get the next error:
Warning: require_once(Zend/Application.php) [function.require-once]: failed to open stream: No such file or directory in C:\wamp\www\zend\public\index.php on line 18
I have set the include path and in addition i have uploaded zf to the library folder.
But, I can't find any trace to a file named Application.php ...
Somewhere along the line you have mixed ZF1 and ZF2 instructions or code. There is no Zend/Application.php in ZF2 (this is a ZF1 thing), and ZF2 apps do not generally have a 'library' folder. So either you are using ZF2 but have followed some app setup instructions for ZF1, or you've used the ZF1 command line tool to create a ZF1 project and have then put ZF2 into the library folder.
Here is the ZF2 skeleton app: https://github.com/zendframework/ZendSkeletonApplication - this should give you an idea what your app should look like.
As the error obviously says Zend/Application.php is not there. Check you include path and your folder.

Using SimplePie with Yii

I want to be able to use SimplePie on Yii.
I'm using the 1.3-dev version of simplepie
I created a "vendors" folder, put all I had in the .tar.gz in a simplepie subfolder.
Then i add this lines at the beginning of my controller
Yii::import('application.vendors.SimplePie.*');
require_once 'SimplePieAutoloader.php';
spl_autoload_unregister(array('YiiBase','autoload'));
spl_autoload_register(array('SimplePie_Autoloader','autoload'));
spl_autoload_register(array('YiiBase','autoload'));
But when I try to use it, I get this error:
include(SimplePie_Core.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory
C:\wamp\www\yii\fr\framework\YiiBase.php(418)
Any ideas why I get this error?
edit: i took the compiled version of simplepie and everything works like a charm
I think (not looked into it fully) that the Simple Pie library follows PSR-0 for class and file names. In which case you should be able to register its path and Yii's autoloader will know how to autoload it. Try adding the following to config.php;
Yii::setPathOfAlias('SimplePie', '/path/to/vendor/');
The second argument needs to point to the root folder of the library e.g. if your path is like this /var/lib/yiiproject/vendor/simplepie/lib/SimplePie then the register the path /var/lib/yiiproject/vendor/simplepie/lib
This yii widget use SimplePie
http://www.yiiframework.com/extension/yii-feed-widget/

Categories