Error when loading Zend Recaptcha in php - php

I'm having trouble with my application locating the Zend Library. I have the ZendFramework in a separate folder (apart from public_html), so I call the Zend Classes using the autoloader, like this:
$libreria='/home/conaprel/ZendFramework/library/';
set_include_path(get_include_path().PATH_SEPARATOR.$libreria);
require_once('Zend/Loader/Autoloader.php');
Zend_Loader_Autoloader::getInstance();
and the folder structure of the site is what is shown in the first line of code. This is a file I include whenever I need the Zend Classes available. It worked fine when I ran it on a local server, but now it's giving me the error:
Warning: include_once() [function.include-once]: Unable to access Zend/Service /Recaptcha.php in /home/conaprel/ZendFramework/library/Zend/Loader.php on line 146
Warning: include_once(Zend/Service/Recaptcha.php) [function.include-once]: failed to open stream: No such file or directory in /home/conaprel/ZendFramework/library/Zend/Loader.php on line 146
Warning: include_once() [function.include]: Failed opening 'Zend/Service/Recaptcha.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php:/home/conaprel/ZendFramework/library') in /home/conaprel/ZendFramework/library/Zend/Loader.php on line 146
¿What can I do? I've checked if the Recaptcha.php is in the Services folder and there it is.

This looks like a case sensitivity problem. The correct filename is Zend/Service/ReCaptcha.php (note the capital 'C'), but the error you're getting indicates it's trying to include Zend/Service/Recaptcha.php (lower case 'C'). I'm guessing you're using a case insensitive file system locally and case sensitive in production.
Just correct the case of the class you're trying to instantiate and it should work:
$captacha = new Zend_Service_ReCaptcha();

Related

use scssphp with cakephp

This might be a dummy question now but bevertheless giving it a try: I am just trying to setup scssphp in my cakephp 4 but seem to have a knot in my head. Can anymone shed some light on what I need to do to get it running?
My simple idea was to just include the code below into the app controller initialize function
<?php
require "scssphp/scss.inc.php";
$scss = new scssc();
$scss->setImportPaths("stylesheets/");
// will search for `stylesheets/style.scss'
echo $scss->compile('#import "style.scss"');
And I create the "scssphp" folder structure with the "scss.inc.php" right under webroot:
webroot/scssphp/scss.inc.php
webroot/scssphp/style.php
webroot/scssphp/stylesheets/style.scss
But then I get
Warning (2): require(/scssphp/scss.inc.php): failed to open stream: No such file or directory [APP/Controller/AppController.php, line 84]
Warning (2): require(/scssphp/scss.inc.php) [<a href='https://secure.php.net/function.require'>function.require</a>]: failed to open stream: No such file or directory [APP/Controller/AppController.php, line 84]
Fatal error: require() [function.require]: Failed opening required '/scssphp/scss.inc.php' (include_path='.:/usr/local/lib/php') in /somepath/myapp.com/dev/src/Controller/AppController.php on line 84
Any help is greatly appreciated!
Update: this article describes how to include external classes quite well and helped me in a first step to solve the issue describe above: How can I use my own external class in CakePHP 3.0?

PHP include file in class, wrong paths

I have class called client, and there i have function, in which i'm trying to include/execute php file, but when i'm doing it all path's in that file which i'm trying to include goes wrong.
class function:
public static function SendSSHCommand($ssh_cmd) {
include('../Core/core_class.php');
$ssh = new samp_panel();
$ssh->SendCommand($ssh_cmd);
}
I would like get a solution, how to include file, that all directory path's in that file wouldn't go wrong.
I get many errors like that:
Warning: include(Net/SSH2.php): failed to open stream: No such file or directory in /home/vlkg/domains/vlkg.lt/public_html/naujas/Core/core_class.php on line 30
Warning: include(Net/SSH2.php): failed to open stream: No such file or directory in /home/vlkg/domains/vlkg.lt/public_html/naujas/Core/core_class.php on line 30
Warning: include(): Failed opening 'Net/SSH2.php' for inclusion (include_path='.:/usr/share/pear:Core/NetModule') in /home/vlkg/domains/vlkg.lt/public_html/naujas/Core/core_class.php on line 30
Fatal error: Class 'Net_SSH2' not found in /home/vlkg/domains/vlkg.lt/public_html/naujas/Core/core_class.php on line 366
I always change my include directory when I run a script. For me it just makes it easier if I set a point of reference for all my included files.
http://php.net/manual/en/function.set-include-path.php
Put something like this at the top of your file
set_include_path('/usr/www/2/main');
include('include1.php');
include('subdir_of_include_path/include2.php');
There are several options but this is the one I find useful with my projects. This way I force and know what my include path is.

include "/directory/filename.php" not found. include "directory/filename.php" found. why?

include "/directory/filename.php" writes out error
include "directory/filename.php" finds it.
I want to upgrade our server hardware, and I installed apache/php/pgsql to the new server.
On the old hardware, the first include code runs perfectly, so I guess something is wrong in my php.ini file.
I've tried to change the include_path in my php.ini, it had no effect
Warning: include_once(/class/class_masterplan.php)
[function.include-once]: failed to open stream: No such file or
directory in D:\PHP\work.php on line 218
Warning: include_once() [function.include]: Failed opening
'/class/class_masterplan.php' for inclusion (include_path='.;D:\php')
in D:\PHP\work.php on line 218
Fatal error: Class 'masterplan' not found in D:\PHP\work.php on line
219
I would like to know, what server config variable could cause/solve this problem.
Because if you use a leading slash, the application will think it is an absolute path, which it isn't. If you omit that slash, you are working with a relative path. See also: http://webdesign.about.com/od/beginningtutorials/a/aa040502a.htm

Soap/php/lighttpd server errors, can not find file that is there?

I'm sticking a web interface which I've been given (that works on other systems) onto a switch, which happens to be in php/soap.
I get this error
Warning: require(/class_main.php) [function.require]: failed to open stream: No such file or directory in /jffs2/usbflash0/ran/www/includes/config.php on line 4
Fatal error: require() [function.require]: Failed opening required '/class_main.php' (include_path='.:') in /jffs2/usbflash0/ran/www/includes/config.php on line 4
config.php:
<?php^M
require($_SERVER['DOCUMENT_ROOT'].'/includes/errors.php');^M
require($_SERVER['DOCUMENT_ROOT'].'/includes/library.php');^M
require(get_structures_directory().'/class_main.php'); ^M
error_log(get_structures_directory());
require(get_structures_directory().'/class_softcore.php');^M
require($_SERVER['DOCUMENT_ROOT'].'/includes/format.php');^M
?>^M
Which looks for class_main.php in here:
1.0.1/ 1.0.3/ 2.0.5/ 2.0.7/ 3.0.10/ 3.0.12/ 3.0.3/ 3.0.5/ 3.0.7/ 3.0.9/
1.0.2/ 1.0.4/ 2.0.6/ 3.0.1/ 3.0.11/ 3.0.2/ 3.0.4/ 3.0.6/ 3.0.8/
Now class_main.php is in some of these version folders and not in some of them. What is the issue here? is it trying to use one of the folders where it is not located?
Well First class_main.php must be in all the folders, So application will not fail for any instance. If it is unlikely you can check for version and require only in that cases like
switch($version)
{
case "1":
case "2":
require($file_path);
break;
}
You can also use include instead of require which will give you warnings instead of error, However it is unadvisable specially on pure php libraries, As it will gave application undefined behaviour.

Doctrine - PHP Warning: include_once(): Failed opening Table for inclusion

I'm using Doctrine 1.2.
The code is trying to include some entities (in the example, AdvertiserUsers) by adding the suffix "Table" at the end. I print a trace at the end of this message.
The thing is, my app does not use these files! I have my models called AdvertiserUsers on the style, with no need for an AdvertiserUsersTable file. Actually, I have my models called "AdvertiserUsers" only, and my app works OK without it (ugly warnings aside - which I want to get rid of).
I don't know why it tries to include these files that are not needed. This is the actual issue.
As a side note, my application has been doing this after I integrated an external module (from a freelance) that used a direct connection - no Doctrine - and happens on this module, when having to integrate both and using separate connections for different data.
Trace:
[26-Jul-2011 22:59:06] PHP Warning: include_once(AdvertiserUsersTable.php): failed to open stream: No such file or directory in /usr/local/zend/share/ZendFramework/library/Zend/Loader.php on line 146
[26-Jul-2011 22:59:06] PHP Warning: include_once(): Failed opening 'AdvertiserUsersTable.php' for inclusion (include_path='/usr/local/zend/apache2/htdocs/stats-from-zero/application/../library:/usr/local/zend/apache2/htdocs/stats-from-zero/library:/usr/local/zend/apache2/htdocs/stats-from-zero/library/doctrine::/usr/local/zend/apache2/htdocs/stats-from-zero/library/recaptcha-php-1.10:/usr/local/zend/apache2/htdocs/stats-from-zero/public/php-form-builder-class:.:/usr/local/zend/share/ZendFramework/library:/usr/local/zend/share/pear:/usr/local/zend/apache2/htdocs/stats-from-zero/application/modules/stats/models:/usr/local/zend/apache2/htdocs/stats-from-zero/application/modules/stats/forms') in /usr/local/zend/share/ZendFramework/library/Zend/Loader.php on line 146
AdvertiserUsersTable.php does not exist. Check name of that file & specific directory. It should be there

Categories