Unable to install log4php using composer

1k views Asked by At

I'm trying to deploy my PHP webapp on my ubuntu server. running composer install ends with the following exception:

  [RuntimeException]                                                                                                                                                                                                    
  Failed to execute git clone --no-checkout 'https://git-wip- 
  us.apache.org/repos/asf/logging-log4php.git' 
  '/var/www/webapp/public_html/vendor/apache/log4php' && cd 
  '/var/www/webapp/public_html/vendor/apache/log4php' && git remote 
  add composer 'https://git-wip-us.apache.org/repos/asf/logging-log4php.git' && git fetch composer                                                                            

  Cloning into '/var/www/webapp/public_html/vendor/apache/log4php'...                                                                                                                                      
  fatal: repository 'https://git-wip-us.apache.org/repos/asf/logging-log4php.git/' not found  

I've tried to add explicit repositories to the composer.json as below still with out any progress

"repositories": [
  {
    "type": "vcs",
    "url": "https://github.com/apache/logging-log4php"
  }
],
"require": {
  "apache/log4php": "2.3.0",
  "phpmailer/phpmailer": "~6.0"
}

What am I missing?

2

There are 2 answers

0
Robertas Murza On BEST ANSWER

They've just migrated.

After you correct link to repository, do not forget to recreate your composer.lock file. Probably the simplest way is to delete it and run composer install

0
Arun Tom On

Create a composer.json file with the following content:

{
    "require": {
        "apache/log4php": "^2.3.0"
    }
}

Run the Composer install procedure:

php composer.phar install

This will install Apache log4php in vendor/apache/log4php.

To use log4php simply include vendor/autoload.php in your script.

require 'vendor/autoload.php';
$log = Logger::getLogger("default");
$log->info("Hello !!");