Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3223604
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:07:35+00:00 2026-05-17T16:07:35+00:00

I have a php script which looks for the openssl directory and encrypts customer

  • 0

I have a php script which looks for the openssl directory and encrypts customer data I have.

When I upload the script to my online linux directory – the encryption works fine

#private key file to use
$MY_KEY_FILE = "my-prvkey.pem";

#public certificate file to use
$MY_CERT_FILE = "my-pubcert.pem";

# Paypal's public certificate
$PAYPAL_CERT_FILE = "paypal_cert_sandbox.pem";

# path to the openssl binary
$OPENSSL = "/usr/bin/openssl";

When I try and run the same command on my Windows machine which runs XAMPP currently, I am unable to encrypt anything. Anybody else had this problem?

I would MUCH rather update and test locally than have to ftp a file every time I make a change during our build.

EDIT

I do realize the directory above is mainly for linux; however even when I point the directory to the openssl directory within the XAMPP folder (for me at: C:\xampp\apache\bin) the operation fails.

EDIT 2

When I say “unable to encrypt” I mean, NOTHING is returned (i.e. the public keys are clearly not finding the openssl .dll files) even though they ARE pointed to the correct directory. There are no error messages. Configuration differences? One is linux server, one is windows local machine.

In my script, I include the following:

<?php
function paypal_encrypt($hash) {
    global $MY_KEY_FILE;
    global $MY_CERT_FILE;
    global $PAYPAL_CERT_FILE;
    global $OPENSSL;

    if (!file_exists($MY_KEY_FILE)) {
        echo "ERROR: MY_KEY_FILE $MY_KEY_FILE not found\n"; }
    if (!file_exists($MY_CERT_FILE)) {
        echo "ERROR: MY_CERT_FILE $MY_CERT_FILE not found\n"; }
    if (!file_exists($PAYPAL_CERT_FILE)) {
        echo "ERROR: PAYPAL_CERT_FILE $PAYPAL_CERT_FILE not found\n"; }
    if (!file_exists($OPENSSL)) {
        echo "ERROR: OPENSSL $OPENSSL not found\n"; }

    $openssl_cmd = "$OPENSSL smime -sign -signer $MY_CERT_FILE -inkey $MY_KEY_FILE " . "-outform der -nodetach -binary | $OPENSSL smime -encrypt " . "-des3 -binary -outform pem $PAYPAL_CERT_FILE";

    $descriptors = array( 0 => array("pipe", "r"), 1 => array("pipe", "w"), );
    $process = proc_open($openssl_cmd, $descriptors, $pipes);

    if (is_resource($process)) {
        foreach ($hash as $key => $value) {
            if ($value != "") {
                fwrite($pipes[0], "$key=$value\n");
                }
        }
        fflush($pipes[0]);
        fclose($pipes[0]); 
        $output = ""; 

        while (!feof($pipes[1])) {
            $output .= fgets($pipes[1]); }

            fclose($pipes[1]);
            $return_value = proc_close($process);
            return $output;
    }

    return "ERROR"; }
?> 

On my windows machine AND the linux machine “Error: OPENSSL not found” is displayed (even though on the linux hosted server the encryption completes anyway). I can remove the line on my windows machine by simply putting C:\xampp\apache\bin\openssl.exe but this still does not do any encrypting).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T16:07:36+00:00Added an answer on May 17, 2026 at 4:07 pm

    When putting a Windows path in your script, do not forget to escape backslashes, otherwise it’ll be interpreted as escape characters. You can use forward slashes in PHP for Windows.

    Two ways of specifying the openssl path in windows:

    $OPENSSL = 'C:\\xampp\\apache\\bin\\openssl.exe';
    $OPENSSL = 'C:/xampp/apache/bin/openssl.exe';
    

    PHP does also have an extension for OpenSSL: http://php.net/manual/en/book.openssl.php

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a php script which accesses a MSSQL2005 database, reads some data from
I have a PHP script which executes a shell command: $handle = popen('python last',
I have a PHP script (running on a Linux server) that ouputs the names
I have several independent executable Perl, PHP CLI scripts and C++ programs for which
I have a PHP script that runs as a CGI program and the HTTP
I have a PHP script that needs to determine if it's been executed via
I have a PHP script that initialises an image gallery. It loops through all
I have a PHP script that can encode a PNG image to a Base64
I have a PHP script that sends critical e-mails. I know how to check
I have a PHP script that processes file uploads. The script tries to organise

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.