WKHTMLTOPDF throwing Error Code 127 - php

I recently re-uploaded all the source files of a web-application and WKHTMLTOPDF stopped working.
I was getting this error from the "bindings" (wkpdf.php):
WKPDF program error.
RESULT: 130
STDERR:
STDOUT:
And after doing some research I found this possible solution:
https://code.google.com/p/wkhtmltopdf/issues/detail?id=289
So, I changed FilleZilla's file transfer type to Binary and uploaded wkhtmltopdf-i386 again. However, now I get the following error when attempting to generate the PDF:
WKPDF program error.
RESULT: 127
STDERR:
STDOUT:
The website's server is running on Linux and I do not have access to the shell (only to web files via FTP). Also, I have set all the proper permissions to the files.
What I don't understand is why it was working before but after over writing the files (with the exact same files) it stopped working.
Anyone has any idea how to get out of this problem?

I have found the issue: The bindings file was detecting the wrong CPU. I altered so it executes wkhtmltopdf-amd64 regardless of the detection and everything works fine now.

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 7 include file error - file name is parsed incorrectly

Recently I met a weird error and hope someone can help.
We use LiteSpeed WebServer and Nginx on top, with PHP 7.5 and MySQL 5 (well, WordPress is the framework). It runs well for many days.
Suddenly it goes fatal at this line in different files
include ("class-xxx.php");
The error log says
[02-Oct-2018 13:04:36 UTC] PHP Fatal error: require(): Failed opening required 'dlass-xxx.php' (include_path='.:/opt/cpanel/ea-php72/root/usr/share/pear') in /xxx.php on line N
I double checked the code and see that the file name is declared "class-xxx.php", but somehow the server tries to include "dlass-xxx.php", thus it cannot find the file and trigger fatal error.
Solution? I re-upload the file, it works. But then it goes fatal in another file, at similar lines using include.
I notice that the first character in the file name, for example "c", is read incorrectly and shift 1 byte before (or after), so the file name is correct.
Such as
include "class-xxx.php" is parsed/read as "dclass-xxx.php"
include "page-xxx.php" is parsed"read as "opage-xxx.php"
...
this is very strange. Do anybody know the reason? Is it related to any caching/memory management of LiteSpeed or Nginx or PHP 7. ?
It happens on PHP 7. only because if I switch to PHP 5.6, the error does not happen.
Hope someone can help. Thanks a lot.

PHP fails on launch

I recently asked a question at Can't run PHP after a new installation of XAMPP but now I realise that I was wrongly blaming a new installation of XAMPP. I've now got the same problem on two computers with different versions of XAMPP, so the problem must be somewhere in my coding, but I can't find it.
XAMPP starts up OK with Apache and MySQL. But then running the simplest PHP script...
<?php echo "HELLO"; ?>
produces these error messages...
Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
Fatal error: Unknown: Failed opening required 'F:/My Documents/OneDrive/Webs/htdocs/phpinfo.php' (include_path='.;C:/xampp/php/pear/PEAR') in Unknown on line 0
That path to PEAR is specified in php.ini and it DOES exist. I can change php.ini to show any include_path and it doesn't matter whether it exists or not, the same error message appears (showing whatever include_path I have put in).
Even phpinfo.php will not run, as shown in the above example, although phpMyAdmin runs OK.
I'm now convinced that my two XAMPP installations on two computers cannot be causing this, but the error messages are not helping me find the problem. I now have to develop code on remote hosts to get around this problem. Can anyone help?
Many thanks!

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.

PHP ftp_get causing warning and not downloading file

I've got a fairly simple cron job that pulls down some files from an FTP server - none of the files are particularly large, but I'm constantly getting the following:
Connected to voip.colefabrics.com, for user colefabrics\absolute
Warning: ftp_get(): Opening BINARY mode data connection. in /home/www/colefabrics.com/httpdocs/libs/classes/class.ftpObj.php on line 56
There was a problem while downloading website/items.csv
Attempt 2:
Connected to voip.colefabrics.com, for user colefabrics\absolute
Warning: ftp_get(): Opening BINARY mode data connection. in /home/www/colefabrics.com/httpdocs/libs/classes/class.ftpObj.php on line 56
There was a problem while downloading website/items.csv
...snip...
I've been through all the other posts relating to this, tried to enforce passive mode, increased the timeout, but nothing is working.
Does anyone know what might be causing this, and what I can do to try and resolve it?
To confirm, it's working fine via a 'normal' FTP client, it's only via PHP that I have a problem.

Categories