Installing Doctrine2 with PEAR - php

While I tried this:
sudo pear install -o pear.doctrine-project.org/DoctrineORM
I got the following error:
Package "pear.doctrine-project.org/DoctrineORM" dependency "pear.symfony.com/Console" has no releases
Package "pear.doctrine-project.org/DoctrineDBAL" dependency "pear.symfony.com/Console" has no releases
doctrine/DoctrineORM requires package "pear.symfony.com/Console" (version >= 2.0.0)
doctrine/DoctrineORM requires package "pear.symfony.com/Yaml" (version >= 2.0.0), installed version is 1.0.6
doctrine/DoctrineDBAL requires package "pear.symfony.com/Console" (version >= 2.0.0)
No valid packages found
install failed
Solved the above by doing the following:
sudo apt-get purge php-pear
Ended up in results like:
Removing php-pear ...
Purging configuration files for php-pear ...
dpkg: warning: while removing php-pear, directory '/usr/share/doc/php5-common/PEAR' not empty so not removed
dpkg: warning: while removing php-pear, directory '/usr/share/php/.channels' not empty so not removed
Same was for the following folders:
/usr/share/php/.registry/
/usr/share/php/.channels/.alias
/usr/share/php/data
/usr/share/doc/php5-common/PEAR/Archive_Tar/docs
/usr/share/doc/php5-common/PEAR
So I removed them all and then purged php-pear completely and reinstalled it again.
now, sudo pear channel-discover pear.doctrine-project.org also didn't say channel already in registry and the later steps also succeeded.
Though I have solved my problem in the above steps. While I failed using the suggestions stated at comments and answers to this post
But I am just curious what could have been wrong in the first place. How PEAR wasn't being able to fetch proper versions of Doctrine2?
Even the accepted answer's process didn't help.

You should have upgraded the pear.symfony.com/Yaml package. PEAR listed version 2.0.0 as requirement, but you only had 1.0.6:
$ pear upgrade symfony/yaml
Also, it did not find (compatible) releases of pear.symfony.com/console - this was the main reason for the failure. A solution would have been a pear clear-cache call, followed by a possible pear channel-update pear.symfony.com call. After that, the console dep should be installed automatically.

I have the same problem as this topic states but with Doctrine pear installation.
While I try this:
sudo pear install -o pear.doctrine-project.org/DoctrineORM
I get the following error:
Package "pear.doctrine-project.org/DoctrineORM" dependency "pear.symfony.com/Console" has no releases
Package "pear.doctrine-project.org/DoctrineDBAL" dependency "pear.symfony.com/Console" has no releases
doctrine/DoctrineORM requires package "pear.symfony.com/Console" (version >= 2.0.0)
doctrine/DoctrineORM requires package "pear.symfony.com/Yaml" (version >= 2.0.0), installed version is 1.0.6
doctrine/DoctrineDBAL requires package "pear.symfony.com/Console" (version >= 2.0.0)
No valid packages found
install failed
I have applied what #Paulo and #Parris suggested in another SO QA. But that did not help. Posting it here just for the record.
Edit:
Solved the above by doing the following:
sudo apt-get purge php-pear
Ended up in results like:
Removing php-pear ...
Purging configuration files for php-pear ...
dpkg: warning: while removing php-pear, directory '/usr/share/doc/php5-common/PEAR' not empty so not removed
dpkg: warning: while removing php-pear, directory '/usr/share/php/.channels' not empty so not removed
Same was for the following folders:
/usr/share/php/.registry/
/usr/share/php/.channels/.alias
/usr/share/php/data
/usr/share/doc/php5-common/PEAR/Archive_Tar/docs
/usr/share/doc/php5-common/PEAR
So I removed them all and then purged php-pear completely and reinstalled it again.
now, sudo pear channel-discover pear.doctrine-project.org also didn't say channel already in registry and the later steps also succeeded.
Thanks all!

Related

Trying to install php-mbstring on ubuntu 20.04

I'm just trying to create a new laravel project and faced with this message
Creating a "laravel/laravel" project at "./example-app"
Installing laravel/laravel (v8.5.22)
- Installing laravel/laravel (v8.5.22): Extracting archive
Created project in /home/alifirhas/0_Work/Belajar/postgresql/example-app
> #php -r "file_exists('.env') || copy('.env.example', '.env');"
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- laravel/framework[v8.40.0, ..., 8.x-dev] require ext-mbstring * -> it is missing from your system. Install or enable PHP's mbstring extension.
- Root composer.json requires laravel/framework ^8.40 -> satisfiable by laravel/framework[v8.40.0, ..., 8.x-dev].
To enable extensions, verify that they are enabled in your .ini files:
- /etc/php/8.0/cli/php.ini
- /etc/php/8.0/cli/conf.d/10-opcache.ini
- /etc/php/8.0/cli/conf.d/10-pdo.ini
- /etc/php/8.0/cli/conf.d/20-calendar.ini
- /etc/php/8.0/cli/conf.d/20-ctype.ini
- /etc/php/8.0/cli/conf.d/20-exif.ini
- /etc/php/8.0/cli/conf.d/20-ffi.ini
- /etc/php/8.0/cli/conf.d/20-fileinfo.ini
- /etc/php/8.0/cli/conf.d/20-ftp.ini
- /etc/php/8.0/cli/conf.d/20-gettext.ini
- /etc/php/8.0/cli/conf.d/20-iconv.ini
- /etc/php/8.0/cli/conf.d/20-phar.ini
- /etc/php/8.0/cli/conf.d/20-posix.ini
- /etc/php/8.0/cli/conf.d/20-readline.ini
- /etc/php/8.0/cli/conf.d/20-shmop.ini
- /etc/php/8.0/cli/conf.d/20-sockets.ini
- /etc/php/8.0/cli/conf.d/20-sysvmsg.ini
- /etc/php/8.0/cli/conf.d/20-sysvsem.ini
- /etc/php/8.0/cli/conf.d/20-sysvshm.ini
- /etc/php/8.0/cli/conf.d/20-tokenizer.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Looks like I have to install php-mbstring on my computer, so I run the command
sudo apt-get install php-mbstring
as i found in this thread: laravel/framework requires ext-mbstring
But there is another error message
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
php-mbstring : Depends: php8.0-mbstring but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
This is the error code when i run sudo apt install php7.4-mbstring
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
php7.4-mbstring : Depends: libonig5 (>= 6.8.1) but it is not installable
E: Unable to correct problems, you have held broken packages.
What have I tried
Reinstalled php7.4 on my computer then try to install mbstring, but fail
Update my php version to version -8 then try to install mbstring, but fail
Do what is in this thread: https://askubuntu.com/questions/1064634/unable-to-install-php-mbstring, but fail
So does anyone know how to install php-mbstring? or how can i make a laravel project?
I hope you guys can help me with this problem, please. I've been working on this problem for almost 8 hours and still can't find a solution.
Turns out i have to enabled universe repository to my system, like this
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe"
sudo apt-get update #to update my system
As Jarad said in this thread Cannot install php-mbstring on ubuntu 18.04. And then i can just run
sudo apt-get install php-mbstring
But turns out, i have to be specific what version that i want to install. If i just run php-mbstring, will just install mbstring for php 8.0 not version installed on system. I have to be specific, then i run command
sudo apt-get install php7.4-mbstring
(I moved to php7.4)
And it run perfectly. Also thank you #Nico Haase and #Peter Krebs for helping.
What works for me is to specify the version, and don't forget to update:
sudo apt update
sudo apt install php7.4-mbstring
Have you tried a system update?
sudo apt-get upgrade
I used this just today, hope it helps you as well.
I came to this issue today for php8.0-mbstring module, and I found that the correct repository i not available in my system so my method was this and it worked for me, hope it will hep you too:
sudo add-apt-repository ppa:ondrej/php
sudo apt-get install php8.0-mbstring

Composer package maatwebsite/excel requires Libzip4, but it's installed

So I'm working on a project solo, and I wanted to export table data into CSV.
So I went with this composer package:
composer require maatwebsite/excel
The terminal outputs this:
phpoffice/phpspreadsheet 1.9.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
So I searched around for answers including here and I tried the following:
I followed the answer provided
here.
I tried installing libzip4, I get this:
libzip4 is already the newest version (1.1.2-1.1pop2).
I tried installing libzip5 for which I got:
libzip5 is already the newest version (1.5.1-0ubuntu1).
So I tried installing php7.3-zip package: for which I get this:
php7.3-zip : Depends: libzip4 (>= 1.3.2) but 1.1.2-1.1pop2 is to be installed
Which is wierd and I'm stuck!
Simply installing doing sudo apt-get install php-zip gives me this error:
php-zip : Depends: php7.3-zip but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
What should I do guys? I have Pop OS and i haven't faced any PHP 7.3 related issues so far.
One of the solutions you can do is delete the composer.lock file and then do a composer install and composer update.

Installing Pear PFM on OSX

I am trying to create a Pear package from my project on github that I have on my local repository, but I'm having alot of trouble getting pfm to work, here is the error I keep getting when I try to install:
Luciens-Macbook-Pro:quisbee-rails admin$ pear install PEAR_PackageFileManager_Cli
No releases available for package "pear.php.net/PEAR_PackageFileManager_Cli"
install failed
I am running on PHP 5.5.15 and pear 1.9.5.
If you look at your pear config settings you'll probably see that the preferred state of packages to download is "stable"
$ pear config-show | grep preferred_state
Or, to be more efficient:
$ pear config-get preferred_state
So to download and install a package that is not marked stable, your best option is to include the version number when you attempt to install it:
$ sudo pear install PEAR_PackageFileManager_Cli-0.4.0
This should work ok for you - assuming you already have all dependencies installed. If not, this is easy to do with the following by including the --alldeps option:
$ sudo pear install --alldeps PEAR_PackageFileManager_Cli-0.4.0

Getting strange error while installing AWS SDK via PEAR

I am getting this error while installing AWS SDK via PEAR. I never got this before.
$ sudo pear channel-discover pear.amazonwebservices.com
Adding Channel "pear.amazonwebservices.com" succeeded
Discovery of channel "pear.amazonwebservices.com" succeeded
$ sudo pear install aws/sdk
Unknown remote channel: guzzlephp.org/pear
aws/sdk requires package "channel://guzzlephp.org/pear/Guzzle" (version >= 3.0.2)
No valid packages found
install failed
Can somebody give me a hand.
Taken from here:
https://github.com/aws/aws-sdk-php/blob/master/README.md#installing-via-pear
Installing via PEAR
PEAR, which stands for PHP Extension and Application Repository, is a framework and distribution system for reusable PHP components. It is the PHP equivalent of other package management solutions like Yum that install packages system-wide.
PEAR packages are easy to install, and are available in your PHP environment path so that they are accessible to any PHP project. PEAR packages are not specific to your project, but rather to the machine they're installed on.
From the command-line, you can install the SDK with PEAR as follows. Note: You may need to use sudo for the following command.
pear -D auto_discover=1 install pear.amazonwebservices.com/sdk
Once the SDK has been installed via PEAR, you can load the phar into your project with:
require 'AWSSDKforPHP/aws.phar';
Had the same problem, but this fixed it:
Install the old package first
sudo pear -D auto_discover=1 install pear.amazonwebservices.com/sdk-1.6.0
Then update it
sudo pear install pear.amazonwebservices.com/sdk
To check:
ubuntu#ip-xx-xx-xx:~$ sudo pear install aws/sdk
aws/sdk is already installed and is the same as the released version 2.4.0
Try this before installing the SDK:
sudo pear install --alldeps --force guzzle/guzzle
well I ended up installing the old package (I didn't need the new stuff such as glacier etc)
pear install aws/sdk-1.5.17.1

phing installed but "not found" and not in pear list

I'm attempting to install the Propel ORM on CentOS which has a dependency for phing. I've run the following which was succesful:
pear channel-discover pear.phing.info
pear install phing/phing
pear install Log
However when I run ./propel-gen as is described on the Propel documentation it fails with the error:
./propel-gen: line 69: phing: command not found
However if I check to see if phing is installed it doesn't appear in the package list, yet if I try to install it again it fails:
$ pear list
Installed packages, channel pear.php.net:
=========================================
Package Version State
Archive_Tar 1.3.8 stable
Console_Getopt 1.3.1 stable
Log 1.12.7 stable
PEAR 1.9.4 stable
Structures_Graph 1.0.4 stable
XML_Util 1.2.1 stable
$ pear install phing/phing
phing/phing is already installed and is the same as the released version 2.4.7.1 install failed
I need to be able to run ./propel-gen to test that Propel has been installed successfully, so I'm a little stuck at this point. I've also double checked that Pear is in the PHP include_path by running the following which exits bool(true):
<?php
require_once 'System.php';
var_dump(class_exists('System', false));
?>
Any help in debugging & fixing this is greatly appreciated! :)
You need to have pear's bin (executable) directory in your $PATH variable.
Find the path with
$ pear config-get bin_dir
Add this to your path that way:
$ export PATH=$PATH:/usr/share/php/bin

Categories