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

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

Related

Execute WP CLI commands in PHP script

To do this, I copied the repository WP CLI into Root WordPress
And I wrote the following PHP code to encode it and encountered the following errors
define('WP_CLI_ROOT', ABSPATH . 'wp-cli');
require_once WP_CLI_ROOT . '/php/wp-cli.php';
Warning: include_once(D:\Web\Sites\jupiterx/wp-cli/vendor/rmccue/requests/library/Requests.php): failed to open stream: No such file or directory in D:\Web\Sites\jupiterx\wp-cli\php\WP_CLI\Bootstrap\IncludeFrameworkAutoloader.php on line 48
Warning: include_once(): Failed opening 'D:\Web\Sites\jupiterx/wp-cli/vendor/rmccue/requests/library/Requests.php' for inclusion (include_path='C:\xampp\php\PEAR') in D:\Web\Sites\jupiterx\wp-cli\php\WP_CLI\Bootstrap\IncludeFrameworkAutoloader.php on line 48
Warning: include_once(D:\Web\Sites\jupiterx/wp-cli/vendor/wp-cli/mustangostang-spyc/Spyc.php): failed to open stream: No such file or directory in D:\Web\Sites\jupiterx\wp-cli\php\WP_CLI\Bootstrap\IncludeFrameworkAutoloader.php on line 49
Warning: include_once(): Failed opening 'D:\Web\Sites\jupiterx/wp-cli/vendor/wp-cli/mustangostang-spyc/Spyc.php' for inclusion (include_path='C:\xampp\php\PEAR') in D:\Web\Sites\jupiterx\wp-cli\php\WP_CLI\Bootstrap\IncludeFrameworkAutoloader.php on line 49
Warning: array_slice() expects parameter 1 to be array, null given in D:\Web\Sites\jupiterx\wp-cli\php\WP_CLI\Runner.php on line 905
Warning: Invalid argument supplied for foreach() in D:\Web\Sites\jupiterx\wp-cli\php\WP_CLI\Configurator.php on line 138
Warning: implode(): Invalid arguments passed in D:\Web\Sites\jupiterx\wp-cli\php\WP_CLI\Runner.php on line 1024
Fatal error: Uncaught Error: Class 'cli\Colors' not found in D:\Web\Sites\jupiterx\wp-cli\php\WP_CLI\Loggers\Regular.php:70 Stack trace: #0 D:\Web\Sites\jupiterx\wp-cli\php\class-wp-cli.php(881): WP_CLI\Loggers\Regular->error_multi_line(Array) #1 D:\Web\Sites\jupiterx\wp-cli\php\WP_CLI\Runner.php(248): WP_CLI::error_multi_line(Array) #2 D:\Web\Sites\jupiterx\wp-cli\php\WP_CLI\Runner.php(1083): WP_CLI\Runner::set_wp_root('D:\\Web\\Sites\\ju...') #3 D:\Web\Sites\jupiterx\wp-cli\php\WP_CLI\Bootstrap\LaunchRunner.php(23): WP_CLI\Runner->start() #4 D:\Web\Sites\jupiterx\wp-cli\php\bootstrap.php(74): WP_CLI\Bootstrap\LaunchRunner->process(Object(WP_CLI\Bootstrap\BootstrapState)) #5 D:\Web\Sites\jupiterx\wp-cli\php\wp-cli.php(27): WP_CLI\bootstrap() #6 D:\Web\Sites\jupiterx\wp-content\plugins\tabanShahrSiteSaz\Plugin.php(72): require_once('D:\\Web\\Sites\\ju...') #7 D:\Web\Sites\jupiterx\wp-content\plugins\tabanShahrSiteSaz\app\core\SingletonPattern.php(26): TabanShahrSiteSaz\Plugin->includes() #8 D:\Web\Sites\jupiterx\wp-conten in D:\Web\Sites\jupiterx\wp-cli\php\WP_CLI\Loggers\Regular.php on line 70
Thanks in advance for your help
WP-CLI can only be run correctly under the PHP cli SAPI, not under a web server API like cgi, apache or similar. This has some technical reasons, but it is also directly related to your server's security.
WP-CLI is a console application
The first technical reason is that WP-CLI is a console application, and it assumes access to the console input (STDIN) and output (STDOUT) streams. Within the web server context that WordPress runs under, these don't exist. The "input" for a webserver is the URL and payload of a web request, and the output is the HTML or JSON that is sent back to the browser.
WP-CLI is a wrapper around WordPress
The second technical reason is that WP-CLI is basically a "hack" that "wraps" an entire WordPress installation and executes it as a subroutine within its own process. If you would try to use WordPress to launch WP-CLI, you'd have a chicken & egg problem, or a software interpretation of "Inception".
WP-CLI is a sysadmin tool
The reason why this is also directly relevant in terms of security is that WP-CLI is, in the broadest sense, a sysadmin tool. It will directly create, modify, delete files, do direct requests against the database, and more. All of its operations can bypass any security measures that might have been put in place at the application level by WordPress and its plugins. Making WP-CLI accessible to the public-facing frontend and letting it be triggered via web requests would turn it into a critical security vulnerability. No server-side administration tool should be exposed to the frontend in whatever way.
Hopefully, this explains why what you want to do cannot be done and why you would not want to if you could.

Error when loading Zend Recaptcha in 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();

A PHP Error using Factual

I am using Codeigniter as my PHP framework. When I run the factual API I get results but there are PHP warnings.
Severity: Warning
Message: include(/home/bwilson/public_html/factual/CI_DB.php): failed to open stream: No such file or directory
Filename: factual/Factual.php
Line Number: 217
Severity: Warning
Message: include(): Failed opening '/home/bwilson/public_html/factual/CI_DB.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear')
Filename: factual/Factual.php
Line Number: 217
I a look at line 217 in the factual.php file and it reads:
include dirname(__FILE__)."/".$className . ".php";
What is the referring to? I have tested this without running the Factual API and the controllers load find. It is only when I start using the Factual API.
This is the reply I received from Factual:
The driver employs an SPL Autoload function to include files for
unloaded classes dynamically.
Here, the class CI_DB -- a Codeigniter class, not Factual -- is being
called without being loaded first. This triggers our autoload feature
in a final attempt to load the file.
In short: this is not a Factual driver issue; to solve, ensure the
file containing the CI_DB class is loaded properly.
It's just trying to find CI_DB.php in the same folder as factual.php.
Make sure that file actually exists where it's trying to find it. Pay attention to what case the filename is.
If the file does indeed exist where its supposed to, check its permissions.
After looking for into the error returns unsupported modules. I just disabled the error reporting in the index.php file by setting error reporting to production. In the mean time I am okay with it as long as my results are the same.
Thank you everyone that contributed.
Do you use?:
require_once BASEPATH . "/{$className}.php";

PHP: weird usort bug

Everything works fine on my local machine. But when uploading this piece of code to my live server I'm getting a weird warning ...
usort($modules, array('util_SortItem', 'ByOrder'));
Causes this warning:
Warning: include_once(sc3lycp6hmyab.php) [function.include-once]: failed to open stream: No such file or directory in /opt/www/xxx/web/private/Zend/Loader.php on line 146
Warning: include_once() [function.include]: Failed opening 'sc3lycp6hmyab.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in /opt/www/xxx/web/private/Zend/Loader.php on line 146
When I remove the usort from my code the warnings disapear.
Any ideas on how I can get rid of this warning?
This has nothing to do with the usort, but with the ByOrder method of the Util_SortItem class that you are telling usort() to call.
You should take a look into the file where that class is defined to see what it does to trigger the error.
One possibility is that it tries to include a class that doesn't exist, which triggers Zend's Autoloader; the other that Zend is trying to create some sort of cache file.
To me it looks like those spammer names. I'd guess it's not related whatsoever. I think you might have something unescaped in your application and it results in someone trying to exploit it ;)
I haven't been able to sort out the isue but I got rid of it by merging two queries and sorting on my SQL server.

HTML tables to PDF in PHP - neither DOMPDF nor html2ps/pdf are working

For the longest time now I've been trying to convert HTML pages containing large tables to PHP. These are styled with CSS and can be several pages long.
I first tried DOMPDF. It works great, until a document is more than one page. None of the fixes I've found work. Either it errors out, or any element that would be even partially on the second page gets lumped over the content of page 1. I've tried both the latest release and the SVN copy I checked out today.
I also tried html2ps/pdf, and it gives me "permission denied" errors writing to the cache directory, even though the directory is fully writable. The system requirements test script passes. The server is running PHP 5 under IIS (not my choice heh).
Can either of these be convinced to work, or is there a library that can do it?
Errors from the demo/test scripts:
Warning: file_put_contents(C:\Inetpub\wwwroot\JM\pdf\html2ps\cache/7d888258e9745b3716532ea81342daaf.css.compiled) [function.file-put-contents]: failed to open stream: Permission denied in C:\Inetpub\wwwroot\JM\pdf\html2ps\css.cache.class.php on line 33
Warning: fopen(C:\Inetpub\wwwroot\JM\pdf\html2ps\cache/unicode.lb.classes.dat) [function.fopen]: failed to open stream: Permission denied in C:\Inetpub\wwwroot\JM\pdf\html2ps\inline.content.builder.php on line 991
Warning: flock() expects parameter 1 to be resource, boolean given in C:\Inetpub\wwwroot\JM\pdf\html2ps\inline.content.builder.php on line 992
Warning: fwrite(): supplied argument is not a valid stream resource in C:\Inetpub\wwwroot\JM\pdf\html2ps\inline.content.builder.php on line 1011 (this error repeats several thousand times)
Warning: fopen(C:\Inetpub\wwwroot\JM\pdf\html2ps\cache/times.z) [function.fopen]: failed to open stream: Permission denied in C:\Inetpub\wwwroot\JM\pdf\html2ps\pdf.fpdf.makefont.php on line 318
Can't write to file C:\Inetpub\wwwroot\JM\pdf\html2ps\cache/times.z
A similar problem with html2pdf under IIS has been discussed here.
The solution was quite simple, yet weird. If this doesn't help you, a full error-message and / or a little bit of code would help me to help you.
I personally recommend command line applications instead of any PHP libraries.
Reasons :
PHP libraries need more time and memory (cache) for conversion process.
They need well-formatted HTML pages only, otherwise throw errors or warnings.
No support for external style sheets.
Command Line Tool:
If you run your script on a Linux server then I suggest command line tools.
Reasons :
They are extremely fast compared to PHP libraries.
Support CSS.
Accept non-well-formatted HTML.
Which command line tool to use?
wkhtmltopdf
htmltopdf
html2pdf
For more information refer to Converting HTML to PDF (not PDF to HTML) using PHP.

Categories