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 6147237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:04:35+00:00 2026-05-23T19:04:35+00:00

I have been going nuts with this.. I have gnupg installed on my CentOS

  • 0

I have been going nuts with this..

I have gnupg installed on my CentOS server and I try to encrypt uploaded files (uploaded via a PHP page). On the server via the command line, it works perfectly. But via the php script, it fails with this error:

gpg: /path-to-my-file/my-file: encryption failed: file open error

The user apache (which I think is used to run the exec command) has read/write in the directory of the file.

The file is uploaded fine (I can see it afterward as I removed the deletion of the unencrypted file from my code) and can be deleted correctly via the php site.

the command I run is the following

/path-to-gpg/gpg --homedir=/path-to-my-home-gnupg/.gnupg -e -r therecipient@email the-unencrypted-file

Any idea how I could tackle this?
thanks

  • 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-23T19:04:36+00:00Added an answer on May 23, 2026 at 7:04 pm

    A few things to check:

    • Run system("ls " . escapeshellarg($file)) and check the result — is it file not found? Permission denied? That will help you debug.
    • Run system("whoami") to make sure PHP is running as who you think it is.
    • Run echo "<pre>ls " . escapeshellarg($file) . "</pre>" then copy+paste the command and run it from the shell to make sure that the path to the file is what you expected it to be.

    Also, I believe CentOS runs SELinux by default… If you’ve got it installed, check the logs (in /var/log/) to see if SELinux is preventing Apache from executing GPG.

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

Sidebar

Related Questions

I have been going nuts over this issue for some time and I am
I have been going nuts trying to figure this out. I am trying to
I've been going around in circles for hours with this. I have a UserProfile
I have been going over python tutorials in this resource . Everything is pretty
I have been going over rails scheduling tasks options and stumbled upon this piece
I installed Snow Leopard and things have been going great, after a few re-installs.
I have been going crazy over this! I have an Air (2.6) app which,
I have been going around in circles with this closure table for awhile. The
This is driving me nuts. I have been at it for over 2 hours
I have been going through this tutorial on auto-populating boxes using jQuery and Ajax:

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.