Zend ACL class not being found by FrontController - zend-framework

I think its a simple path issue here - but I've spent last 2 hours trying various combinations but not able to resolve this. The code is working fine on my windows system but when I upload it to my hosting site on linux OS - it doesn't find the ACL file.
This is how the paths are defined in my index.php
// Define path to application directory
defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(realpath(APPLICATION_PATH . '/../library'), get_include_path(),
)));
This is the line in application.ini
resources.frontController.plugins.acl = "Ed_Controller_Plugin_Acl"
This is the bootstrap.php relevant code
protected function _initAutoload()
{
.......
Zend_Loader_Autoloader::getInstance()->registerNamespace('Ed_');
.......
}
These are the errors I am getting on the linux system and the ACL doesn't work
[Sat Oct 01 14:26:44 2011] [error] [client 122.164.175.204] PHP Warning: include_once(Ed/Controller/Plugin/Acl.php): failed to open stream: No such file or directory in /home/webadmin/dezyre.com/library/Zend/Loader.php on line 146
[Sat Oct 01 14:26:44 2011] [error] [client 122.164.175.204] PHP Warning: include_once(): Failed opening 'Ed/Controller/Plugin/Acl.php' for inclusion (include_path='/home/webadmin/dezyre.com/application/../library:/home/webadmin/dezyre.com/library:.:/usr/share/pear:/usr/share/php') in /home/webadmin/dezyre.com/library/Zend/Loader.php on line 146
[Sat Oct 01 14:26:44 2011] [error] [client 122.164.175.204] PHP Fatal error: Class 'Ed_Controller_Plugin_Acl' not found in /home/webadmin/dezyre.com/library/Zend/Application/Resource/Frontcontroller.php on line 117
Thanks for your time
Appreciate it

Remember that *ix is all case sensitive with file names. Therefore directories must start with in uppercase. If they don't, Windows won't complain - but Linux will.

Related

Writing a filter for a regex that works in fail2ban-regex on the command line

I have entries like these in apache2 error.log
[Thu Jan 12 09:18:51.078445 2023] [core:error] [pid 47992] [client 152.89.196.211:53158] AH10244: invalid URI path (/cgi-bin/.%2e/.%2e/.%2e/.%2e/bin/sh)
[Wed Jan 11 06:01:09.820582 2023] [core:error] [pid 30833] [client 185.225.74.55:39856] AH10244: invalid URI path (/cgi-bin/.%%%%32%%65/.%%%%32%%65/.%%%%32%%65/.%%%%32%%65/.%%%%32%%65/bin/sh)
[Wed Jan 11 17:16:49.643509 2023] [core:error] [pid 41882] [client 152.89.196.211:52746] AH10244: invalid URI path (/cgi-bin/.%2e/.%2e/.%2e/.%2e/bin/sh)
I got this to work on the command line:
fail2ban-regex test.log '.*\[client <HOST>:\d+\] AH10244.*$'
Every time I try to stick the regex into a .conf file like so:
[Definition]
failregex = .*\[client <HOST>:\d+\] AH10244.*$
ignoreregex =
fail2ban complains:
Running tests
=============
Use failregex line : filter.conf
ERROR: No failure-id group in 'filter.conf'
I've looked in the man pages and online but I can't find an explanation of what this message is trying to say, or how to fix it.
The Questions
How do I wrap a .conf file around this regex?
What does that error mean?
Could I (how would I) use the pre-defined stuff in apache-common.conf to make this regex more robust?
This fixed it:
fail2ban-regex test.log ./filter.conf
I had my test files (test.log and filter.conf) in my home dir. When I ( from the home dir ) issued the command:
fail2ban-regex test.log filter.conf
I assumed that I was referencing ./test.log and ./filter.conf but I think that fail2ban was looking in the filter.d/ folder to try to find filter.conf.
I found that if filter.conf was in the /etc/fail2ban/filter.d/ folder, then fail2ban-regex test.log filter.conf succeeded.

Zend Failed opening Zend/Application.php

Ok, so I am relatively new to Zend. I have created a new application and started to build an authentication system based on a guide. However, the server is kicking out an Internal Server Error.
Upon checking the PHP error logs I have been given the following two errors:
[Thu Jul 19 10:26:40 2012] [error] [client 80.194.255.4] PHP Warning: require_once(Zend/Application.php): failed to open stream: No such file or directory in /home/www-data/zend.danielgroves.net/htdocs/public/index.php on line 18
[Thu Jul 19 10:26:40 2012] [error] [client 80.194.255.4] PHP Fatal error: require_once(): Failed opening required 'Zend/Application.php' (include_path='/home/www-data/zend.danielgroves.net/htdocs/library:.:/usr/share/php:/usr/share/pear') in /home/www-data/zend.danielgroves.net/htdocs/public/index.php on line 18
The controller:-
class Admin_AuthController extends Zend_Controller_Action
{
public function init()
{
/* Initialize action controller here */
}
public function indexAction()
{
$form = new Application_Form_login();
$request = $this->getRequest();
if ($request->isPost()) {
if ($form->isValid($request->getPost())) {
}
}
$this->view->form = $form;
}
}
Any ideas on what the cause of this could be? As I said I am new to Zend so I don't really know where to start when it comes to these errors, especially as this is referencing files that were created by the Zend CLI tool.
Any pointers/suggestions etc would be muchly appriciated.
Dan.
Your application needs to be able to access the Zend Framework classes. Typically you would put these into the library folder in your app (Zend Tool does not do this for you). So from your downloaded copy of ZF, copy the library/Zend folder into your library folder. You should end up with the file it is looking for at /home/www-data/zend.danielgroves.net/htdocs/library/Zend/Application.php, which will fix the error.
I'm having this exact same problem. First I was missing the reference to Zend/Application.php. So I found that, and copied into the Library folder, and changed the code to point at the file in the library folder. Then there was another reference to the same file WITHIN the Application.php file. I fixed that. Now I have a series of other errors like:
Fatal error: Class 'Zend_Loader_Autoloader' not found in C:\Development\PHPSites\testProjectIII\library\Application.php on line 82
So I REM out line 82:
$this->_autoloader = Zend_Loader_Autoloader::getInstance();
And I get THIS error:
Fatal error: Class 'Zend_Config_Ini' not found in C:\Development\PHPSites\testProjectIII\library\Application.php on line 388
So I REM out that line:
$config = new Zend_Config_Ini($file, $environment);
After that, I finally get this error:
Notice: Undefined variable: config in C:\Development\PHPSites\testProjectIII\library\Application.php on line 417 Fatal error: Call to a member function toArray() on a non-object in C:\Development\PHPSites\testProjectIII\library\Application.php on line 417
Now - If I understand what I'm seeing here, it's that the application is looking for libraries that include classes that are not defined. All I'm doing is taking the entire working program (this is right out of the startup wizard, with no changes), which works on the Apache server that Zend installs. But I take it to another folder where the root of my IIS server is, and the libraries cannot be found.
I've been trying to isolate what is what, but nothing is working. The answer directly above my post here is exactly what I tried.

Odd cgi behaviour

I am getting some very annoying behaviour from my perl cgi scripts running under apache.
I get referer information added on the end of simple print statements, and it's driving me nuts.
[Sun Feb 20 21:34:47 2011] [error] [client xx] ruid: 48, referer: http://www.x.com/
[Sun Feb 20 21:34:47 2011] [error] [client xx] euid: 48, referer: http://www.x.com/
[Sun Feb 20 21:34:47 2011] [error] [client xx] test, referer: http://www.x.com/
[Sun Feb 20 21:34:47 2011] [error] [client xx] Premature end of script headers: test.cgi, referer: http://www.x.com/
This only seems to happen when the url is reached by navigating from another page (hence having a referer yes). The above apache log output was produced with the below incredibly simple depo script:
#!/usr/bin/perl -w
use strict;
use warnings;
use CGI;
my $q = CGI->new;
print STDERR "ruid: $<\n";
print STDERR "euid: $>\n";
print STDERR "test\n";
Anyone seen this before? It feels like an apache setting i need to turn off.
Thanks
Matt
Take a look at your apache config files (httpd.conf and friends) and find the CustomLog directive which is used by your error log to see which LogFormat it uses, then modify that LogFormat (or create a new one) to remove %{Referer} from the list of fields to include in the log messages. (And don't forget to reload the apache config after changing it, of course.)

How can I create and maintain sessions in series of Perl CGI scripts?

I am new to CGI-Perl and sessions. I have a problem running the following code.
I have four files
1. Session.html or Session.pm
2. name.pl
3. hobbies.pl
4. job.pl
The Session.pm is place in /var/www/html folder and the rest of the files are placed in /var/www/cgi-bin/session folder.
I have a basic html file(Session.html) which has a link to perl script it is giving the following error
[Mon Jan 04 14:21:24 2010] [error] [client ::1] Options ExecCGI is off in this directory: /var/www/html/name.pl, referer: http://localhost/Session.html
[Mon Jan 04 14:21:29 2010] [error] [client ::1] Options ExecCGI is off in this directory: /var/www/html/name.pl, referer: http://localhost/Session.html
[Mon Jan 04 14:22:42 2010] [error] [client ::1] (13)Permission denied: exec of '/var/www/cgi-bin/session/name.pl' failed, referer: http://localhost/Session.pm
[Mon Jan 04 14:22:42 2010] [error] [client ::1] Premature end of script headers: name.pl, referer: http://localhost/Session.pm
Please help me out in executing the above example. Please give me the steps to be followed from the start.
... Options ExecCGI is off in this directory: /var/www/html/name.pl, ...
This error points to trying to run name.pl in /var/www/html/ instead of /var/www/cgi-bin/session/
Is the Session.html you posted correct because it doesn't seem to tally with this error?
... (13)Permission denied: exec of '/var/www/cgi-bin/session/name.pl' failed, ...
The name.pl cannot be run because it doesn't have execution rights set (on Linux/Unix you need to chmod a+x name.pl).
You may need to show what Session.pm does (it doesn't look like you using the CPAN module Session here).
On a general note I would consider simplifying what you doing down to a simple HTML & CGI script first and get that working. Then start looking into sessions etc.
Check out Ovid's CGI Tutorial for some sage advice on the Perl/CGI subject.
/I3az/

Always get this error when I use upload images - Using Zend Framework

Warning: include_once(Zend/Http/Client.php) [function.include-once]: failed to open stream: No such file or directory in /home/hotbuzz/public_html/include/Zend/Loader.php on line 83
Warning: include_once() [function.include]: Failed opening 'Zend/Http/Client.php' for inclusion (include_path='/home/hotbuzz/public_html/include;.:/usr/lib/php:/usr/local/lib/php') in /home/hotbuzz/public_html/include/Zend/Loader.php on line 83
Warning: require_once(Zend/Exception.php) [function.require-once]: failed to open stream: No such file or directory in /home/hotbuzz/public_html/include/Zend/Loader.php on line 87
Fatal error: require_once() [function.require]: Failed opening required 'Zend/Exception.php' (include_path='/home/hotbuzz/public_html/include;.:/usr/lib/php:/usr/local/lib/php') in /home/hotbuzz/public_html/include/Zend/Loader.php on line 87
Always get this error when i use image upload in the script .. I m using Zend Framework .. I i dont know what to do ?
My Zend path : public_html/include/zend
phpinfo : hotbuzz.in/phpinfo.php
I have not configured path to Zend in .htaccess
?
try this
set_include_path(dirname(realpath(__FILE__)).PATH_SEPARATOR.get_include_path());
Does your include path point to the library files or just the root of the Zend project. The include path needs to point to the directory that contains the directory structure
Zend
Acl
Auth
etc...
which maybe the library directory of the files you downloaded.
There is something weird in your include path ;.:
I think you probably have use the syntax of windows in a linux server.
You should use PATH_SEPARATOR the be sure that you will have the right one on every server.