Facing file get html error - php

I am getting the below error while triggering the file with crone jobs, while it doesn't show any error with manual triggering. Please help whats the logic behind this error. Thanks
Fatal error: Call to a member function find() on a non-object in /home/afghannewscom/public_html/auto/MainProject.php on line 35

Look at the file MainProject.php on line 35 (in editor) and see whats the problem.
the variable $OuterLink is not an object. you may have a look at its definition line.

I also had a similar issue with cronjobs (PHP errors in cronjobs only, running file via browser was fine). The error was caused by incorrect server configuration (it was a shared server, so I couldn't change it). In my case, the fix was pretty easy - I changed cronjob from "php -q /some_file.php" to "curl http://somedomain.com/some_file.php" (you can also use lynx or wget command instead of curl)

Related

My dynamic site is not loading when the site is online but works well in localhost

I'm getting this error when my site is online
[host www.sitename.com] Backend fatal error: PHP Fatal error: require_once() [function.require]: Failed opening required 'admin/config/connection.php' (include_path='.:/opt/cpanel/ea-php53/root/usr/share/pear:/opt/cpanel/ea-php53/root/usr/share/php') in /home/mistrybu/public_html/index.php on line 373\n
The site works well in localhost but when its put online , the dynamic part is not showing.
I changed the php version from php7 to php5 in cpanel. Now the front end is working but the backend is not.
Can someone help me solve this error?
PHP version
Definitely do not go back to PHP5. Keep it to 7. If that means rewriting some of the existing code, so be it, it will make your site more secure and more future proof.
Error Message
Your require_once() method cannot find or access a particular file. This is most probably because:
File missing
The file (connection.php) doesn't exist in the given location (admin/config). Now keep in mind that as the location doesn't start with a /, it's going to be relative to where the require_once() method is being run from.
Since you're running require_once() from:
home/mistrybu/public_html/
it's going to look for the file here:
/home/mistrybu/public_html/admin/config/.
Does that location exist? Does the connection.php reside in the folder?
Folder mismatch
Try adding the following prefix to your path, and see if that makes a difference:
require_once $_SERVER['DOCUMENT_ROOT'].'/admin/config/connection.php';
File errors
Maybe the file exists, but for some reason, gives an error. Try running the following from your command line and see if you get any errors:
php -f admin/config/connection.php

PHP ftp_delete() generates warning "Command okay"

I can not find any answer to this as most problems revolve around a file not existing or a delete process not working.
I have an FTP device where I generate a file with an PHP script. After that, I try to FTP in, get the file and after that, delete it.
This all works fine, I can connect, get the file and save it locally and then delete it. Except for one thing, the ftp_delete() function results in a warning.
PHP gives me the following, when executing the script:
A PHP Error was encountered
Severity: Warning
Message: ftp_delete(): Command okay
I looked up the error code, it means it was successful. And it was because the file is deleted on the FTP device.
So why does this generate an PHP error?
Cheers.
The RFC 959 (FTP specification) mandates that on a successful completion of the DELE command, the server should respond with 250 status code.
The PHP FTP implementation is very strict, yielding a warning on any other code, even if it indicates a success (2xx class).
Your server probably uses some other 2xx code, like a generic 200 Command okay.

"undefined function exif_read_data()" error only via Cron

I am facing trouble running a PHP script via Cron. When I execute the same script from a browser, it works just fine.
The Cron service outputs this error:
PHP Fatal error: Call to undefined function exif_read_data() in /homessd/xxx/my-functions.php on line 88
As suggested by jotik, i have checked with my hosting provider and found that a different php was being used via cron which was creating the problem. After fixing the path to correct php, the problem is solved.

Opcache causes PHP Fatal error: Class '\xa0L\xdaor\x7f' not found

Every now and then an image resizing script on our site will fail with the following error:
PHP Fatal error: Class '\xa0L\xdaor\x7f' not found ... on line 4
The actual line 4 of the script in question is:
$photo = new Photo($photo_id);
I have no idea where the hex code \xa0L\xdaor\x7f in the Error log comes from. The script will run fine and it runs relatively frequently for a day or two, then it starts failing every time, with that error.
If I run opcache_reset(), the errors stop.
Anyone have any idea what might be causing this issue?
UPDATE: I got no response - so I've simply excluded this file from the opcode cache using opcache.blacklist_filename.
Sometimes my whole PHP response was a bunch of hex codes like this.
I had that when opcache.fast_shutdown="1" was set.

Zend session_start gives Fatal error: Exception thrown without a stack frame in Unknown on line 0

When running a Zend application locally I get Fatal error: Exception thrown without a stack frame in Unknown on line 0, i traced that error to a line $startedCleanly = session_start();
I can't get through it, when I restart the server and reload the page I do not get the error, but on every other reload I get it, I looked into a php/tmp dir too see if there are any files, and as I see they aren't there. I think that session isn't written but when I try just a simple test.php file with session_start(); line, without zend framework, I see that there is a file created in that dir.
I really don't know where to go next.
Happens when your destructor or error handler throws an exception. That can happen for multiple reasons depending on your exact setup and method for session storage you're using. For example the session directory is not writeable or does not exist, database is not accessible or fields are invalid, redis does not respond, etc.
So, check your settings and look for something that would prevent saving the session data.
More elaborate description can be found here.
I know this post is old, but I've just figured out that I was getting "Fatal error: Exception thrown without a stack frame in Unknown on line 0" because my 'modified' and 'lifetime' columns were of type 'timestamp without time zone' when they should have been 'integer' (I'm using Postgres 9 BTW)
Hope this helps someone.
The problem could also be a disk full problem !!!

Categories