openssl_private_encrypt and "error:0E06D06C...NCONF_get_string:no value" - php

I can generate all keys fine, when I go to encrypt the file I get an error thrown at me: error:0E06D06C:configuration file routines:NCONF_get_string:no value but googling and checking stackoverflow only shows people with problems generating the keys.
My code: Here
EDIT: The error pops up when I put or die(openssl_error_string()); after openssl_private_encrypt($fileToEnc, $encFile, $privateKey) but I am now getting fwrite() expects parameter 1 to be resource, boolean given in C:\wamp\www\xr1\encrypt.php on line 9

There was an error in my fopen dir somehow and it just broke. It is all good and fixed now, thanks.

Related

phpSPO and passing null to strlen

I need to get a file from SharePoint using phpSPO.
I use this code:
$authCtx = new AuthenticationContext('https://xxxxxxxx.sharepoint.com');
$authCtx->acquireTokenForUser($username,$password);
$ctx = new ClientContext('https://xxxxxxxx.sharepoint.com/sites',$authCtx);
require('settings.php');
$sourceFileUrl = "/path/to/excel.xlsx";
$targetPath = "/files/excel.xlsx";
$fileContent = Office365\SharePoint\File::openBinary($ctx, $sourceFileUrl);
But I get this error:
Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/www.mydomain.dk/vendor/vgrem/php-spo/src/Runtime/Http/Requests.php on line 137
Isn't phpSPO ready for php 8.0 or what could be wrong?
A deprecation is not an error. It's a hint to the author of the code that they will need to fix the code "soon" (i.e. within the next few years, when PHP 9.0 is expected to ship) so that it doesn't become an error.
If you want to identify what needs changing and contribute a fix, I'm sure the maintainer will appreciate the help.
If not, it is perfectly safe to completely ignore the message. If necessary, change your error configuration to ignore deprecations, or to ignore them within the "vendor" directory where third-party code lives, using something similar to this answer.

erorr formatting.php in word press

My WordPress site gives this error in the comments section for products.
my erorr:
erorr.png
And its a complete error :
Warning: strlen() expects parameter 1 to be string, object given in /home3/arsalear/public_html/wp-includes/formatting.php on line 3410
Error line photo in php file :
eror line.png
and :this is the complete file
Help me please....
That's a warning and you can ignore them. I would recommend trying to fix the warning but adding the following to the affected webpage should remove the warning text.
error_reporting(E_ALL ^ E_WARNING);

paths not working correctly with fopen/fwrite

I think it is something simple that has to do with my paths, because when I just create the files in the current folder, everything works. That being said, I am pretty unfamiliar with fopen(), fwrite(), and fclose(). The errors I am getting are (I think once the first one is fixed, the rest will work, too):
Warning: fopen(test/b/shipLabels/1_8154_0.pdf) [function.fopen]:
failed to open stream: No such file or directory in
/public_html/test/b/lib/FedEx/ShipWebServiceClient/Ground/Domestic
MPS/ShipWebServiceClient.php5 on line 116
Warning: fwrite() expects parameter 1 to be resource, boolean given in
/public_html/test/b/lib/FedEx/ShipWebServiceClient/Ground/Domestic
MPS/ShipWebServiceClient.php5 on line 117
Warning: fclose() expects parameter 1 to be resource, boolean given in
/public_Html/test/b/lib/FedEx/ShipWebServiceClient/Ground/Domestic
MPS/ShipWebServiceClient.php5 on line 118
The lines that references are:
$fp = fopen(SHIP_MASTERLABEL, 'wb');
fwrite($fp, ($masterResponse->CompletedShipmentDetail->CompletedPackageDetails->Label->Parts->Image));
fclose($fp);
I define SHIP_MASTERLABEL using this:
define('SHIP_MASTERLABEL', 'test/b/shipLabels/'.$clientId.'_'.$invoiceId.'_0.pdf');
In this case, $clientId=1, $invoiceId=8154. For the most part, this syntax has been provided by the FedEx docs.
Thanks so much for your help!
you 'd better use the absolute path ,and use the const like DIR FILE etc...

PHP fopen problems

How do I create a file in php?
I have tried using...
$num = file_get_contents('qnum/qnum.txt');
$newFile = 'question'.$num.'.txt';
$newNum = $num++;
$openingQNUM = fopen('qnum/qnum.txt','w');
echo fwrite($openingQNUM,$newNum);
fclose($openingQNUM);
and I know I have called the functions right cause it is giving me the following error messages:
Warning: fopen(qnum/qnum.txt) [function.fopen]: failed to open stream: Permission denied in D:\Hosting\11017597\html\Question Site\ask.php on line 16
Warning: fwrite() expects parameter 1 to be resource, boolean given in D:\Hosting\11017597\html\Question Site\ask.php on line 17
Warning: fclose() expects parameter 1 to be resource, boolean given in D:\Hosting\11017597\html\Question Site\ask.php on line 18
Can someone tell me what I am doing wrong?
PHP is complaining about not being able to create a new file because the filesystem denies access for writing. You should check if the process running PHP is allowed to write to the directory.
And in other news: ´file_put_contents()does all of the above and is the counterpart offile_get_contents()` - consider using it. It won't work right now, though, because of the file permission issue.
And after that: Welcome to the world of concurrent accesses! You are not using any form of locking, which makes your code a victim of race conditions. Two requests might read the same file (counter = 5), both increment the counter (= 6) and write back. Result: Counter is 6, but 7 would have been correct.
It seems you don't have read permissions on that file. Check if is_readable('qnum/qnum.txt') returns TRUE.

parameter error with fputcsv() in PHP

I am trying to run through a dictionary, .txt file, calculate the metaphone() values and append that to each line. Then write this to a new file.
I am getting an error though on the line that I am using fputcsv() and it says: expects parameter 1 to be resource, boolean given
I don't believe I am passing it a boolean. I don't understand what I am doing wrong.
<?php
$dict = fopen("originalDictionary.txt", "r");
$keyedDict = fopen("dictionary.txt", "w");
while ($line = fgets($dict)){
$line = trim(strtolower($line));
fputcsv($keyedDict, array($line,metaphone($line)));
}
fclose($dict);
fclose($keyedDict);
?>
Here is a link to originalDictionary.txt if that helps.
fopen
Returns a file pointer resource on success, or FALSE on error.
probably the opening of the file fails and the function returns false, there you have your boolean
check the file permissions and wether any errors are triggered (display them for example with ini_set('display_errors',1); error_reporting(E_ALL);

Categories