Asked  7 Months ago    Answers:  5   Viewed   25 times

GPG is always returning 2 at the result. My code is as follows

$cmd = "/usr/bin/gpg -a --recipient $to -e -o $outfile $infile";

Where outfile is the file where the encrypted data will be written and infile is the unencrypted data.

I don't know why this is happening. Can anyone please tell me what's wrong. Thanks.



GPG is asking whether you want to continue on with the encryption using an unsigned key. Since no user can input Y it produces an error.

To fix this put the following switches

--yes and --always-trust

Wednesday, March 31, 2021
answered 7 Months ago

Redirect is cleanest; loading a view could work too.

The problem here is that show_404() is usually called AFTER your controller has already loaded (something had to tell it show the 404 after all). CI doesn't like loading a second controller at that point, which is the primary hurdle.

Your best option probably is extending the show_404() function in the Exceptions class to redirect to your 404 route. Without a redirect, you'll be stuck with showing a view or something that you know has all the "extra data" it needs prior to calling the 404 (or I guess you could load it in the Exceptions class too). It can get really complicated in some dynamic views.

You obviously want something more advanced than just editing the 404 template in the errors folder. I've had problems trying to access get_instance() from that file, as sometimes it's loaded before the controller is constructed. So, be careful if you try that ;)

Update: Here's a working example of extending the show_404() function to load a view

// application/core/MY_Exceptions.php
class MY_Exceptions extends CI_Exceptions {

    public function show_404()
        $CI =& get_instance();
        echo $CI->output->get_output();
Wednesday, March 31, 2021
answered 7 Months ago

Is your private key password protected? According to pecl/gnupg documentation you cannot pass a plaintext password for gnupg ? version 2. So all you can do is use a private key that has no password set, I guess.

IMO pecl/gnupg errors are quite misleading.

Wednesday, March 31, 2021
answered 7 Months ago

I was able to solve this issue using Pecl to install GnuPG. This link helped me a lot as well.

Run the following in order to install the library:

  1. sudo apt-get -y install gcc make autoconf libc-dev pkg-config
  2. sudo apt-get -y install libgpgme11-dev
  3. sudo pecl install gnupg
  4. Restart your server with: "service apache2 restart", or "sudo service phpX.Y-fpm-sp restart" where x.y is the major.minor version of your php. Note: there are multiple different ways to restart the system so the changes take effect, so please do your own research on how to do it depending on the server and your php version.
  5. As I've explained in my question, try to find the right php.ini file to add the "" into. most common places you'll find your php.ini are:
    • /etc/php/7.2/apache2 (you can use your PHP version instead of 7.2)
    • /etc/php/7.2/cli (you can use your PHP version instead of 7.2)

      The better way is to find out the php.ini path that loads the extensions, from the phpinfo()

Now Verify that it all went well with the following command:

  • "php -i | grep -i gnup"

If everything is working as expected you'll see something like this:

  • /etc/php7.0-sp/conf.d/gnupg.ini,
    gnupg support => enabled
Saturday, May 29, 2021
answered 5 Months ago

Please try below solution.

You have missed dynamic classes adding in div like apps and joomla

<div class="portfolio-item apps joomla col-xs-12 col-sm-4 col-md-3">

added class in above line with your existing code

foreach($results as $row) {
//code for getting dynamic class names from db
$class = explode(",.", $row->type);
$gettypes = implode(" ", $class); 
<div class="portfolio-item <?php echo $gettypes;?> col-xs-12 col-sm-4 col-md-3">

Hope this work!

Saturday, May 29, 2021
answered 5 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :