Magento 2 Fatal Error when running composer:install - magento2

Clone fresh Magento 2 instance;
2.Run composer:install
Fatal Error:
PHP Fatal error: Uncaught Error: Undefined class constant 'PRE_COMMAND_RUN'

This was an issue with Composer, By installing latest version of Composer solved it.
The bug for the constant variable PRE_COMMAND_RUN is raised and closed.

You need install latest version of composer, upgrade steps given below.
-- Remove existing composer
Debian/Ubuntu
sudo apt-get remove composer
Centos/Redhat
sudo yum remove composer
Get the latest composer using wget.
cd /tmp
sudo curl -sS https://getcomposer.org/installer | php
Move composer executable to PATH so it can be accessible globally.
sudo mv composer.phar /usr/local/bin/composer
To check the composer version
composer -V

You have to reinstall the Composer and use the latest composer version
To do that you can follow the following steps:
Step #1) Remove the current composer:
sudo apt-get remove composer
Step #2) install the composer , you can using following commands
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === 'e0012edf3e80b6978849f5eff0d4b4e4c79ff1609dd1e613307e16318854d24ae64f26d17af3ef0bf7cfb710ca74755a') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
then to make sure you have the latest Composer , run the following command
php composer.phar -V
Now, your ready to install Magento,
to install Magento via composer :
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition YourProjectName
if the project folder name is exist , remove the folder and try again to install magento

You probably have an outdated version that doesn't even support self-update unfortunately.
So here's a oneliner to install the latest version in /usr/local/bin:
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
Check:
which -a composer
/usr/local/bin/composer --version
composer --version

Composer self-update wasnt working with my composer version, I use ubuntu(LEMP).
Latest version of composer was installed - 1.6.3 I think.
We need this 1.10.17.
sudo apt remove compsoer
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
sudo php composer-setup.php --version=1.10.17 --install-dir=/usr/bin --filename=composer
Check version:
composer --version
output: 1.10.17
To be sure remove all vendor and cache:
rm -rf vendor/*
composer clear-cache
composer update

Related

How to install Homebrew on Jelastic

I needed to install a repository with brew on my Jelastic Environment, and I ended up facing many difficulties to achieve this, so I decided to share my solution here, hope it helps others out.
It has been a hell of a run, but here is the detailed procedure:
WARNING: ONLY USE THE PACKAGE INSTALLER OF POINT 1 AS LAST RESOURCE, IT CAN CAUSE MANY PROBLEMS.
For example: using it to install composer will downgrade your php binary to v5 permanently, and there is nothing you can do to fix it unless creating a new node, if you decide to use it, first clone your node to have a backup in case it destroyes everything.
Install this package installer following the instructions here: https://github.com/jelastic-jps/packages-installer :
Then use it to install gcc.
We need to install anaconda in order to update git and curl to a version recent enough to make brew at least run (src: https://stackoverflow.com/a/52561058/12181662 ) :
curl https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh > Miniconda.sh bash Miniconda.sh -b -p ~/conda
Use anaconda to install git and curl (src: https://www.reddit.com/r/linux4noobs/comments/lzdo9n/comment/gq1fhak/?utm_source=share&utm_medium=web2x&context=3 ) :
source /var/www/conda/bin/activate
conda update conda
conda install git
conda install curl
conda deactivate
echo 'export PATH="/var/www/conda/bin:$PATH"' >> ~/.bash_profile
export PATH="/var/www/conda/bin:$PATH"
install brew locally (src: https://brew.sh/ ) :
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
echo 'eval "$(/var/www/.linuxbrew/bin/brew shellenv)"' >> /var/www/.bash_profile
eval "$(/var/www/.linuxbrew/bin/brew shellenv)"
echo 'export HOMEBREW_CURL_PATH="/var/www/conda/bin/curl"' >> ~/.bash_profile
export HOMEBREW_CURL_PATH="/var/www/conda/bin/curl"
echo 'export HOMEBREW_GIT_PATH="/var/www/conda/bin/git"' >> ~/.bash_profile
export HOMEBREW_GIT_PATH="/var/www/conda/bin/git"
install the most recent version of gcc using brew (src: https://github.com/Homebrew/homebrew-core/issues/101919#issuecomment-1162740031 ) :
brew install gcc#5
brew install --force-bottle gcc
fix brew install for the non-root locations (src: https://github.com/orgs/Homebrew/discussions/3421#discussioncomment-3126807 ) :
echo 'export HOMEBREW_RELOCATE_BUILD_PREFIX=1' >> /var/www/.bash_profile
export HOMEBREW_RELOCATE_BUILD_PREFIX=1
enjoy! Example: brew install composer
Also you can try to run this is you face any errors during installation of anything:
brew link --overwrite libxcrypt

How to upgrade OpenSSH on Centos

I'm using Centos 6 and openssh 5.3 and I want to upgrade to openssh 7 but I don't know how.
I have tried using google but have not found out how.
To update OpenSSH to the latest version that the CentOS repository has, run the following command:
su -c 'yum update'
This will perform a full system update. At the prompt (from the su part), enter your root password
For future reference, you may find the Unix & Linux Stack Exchange site to also be of use.
yum groupinstall "Development Tools"
yum install zlib-devel openssl-devel
cp /etc/ssh/sshd_config /etc/ssh/sshd_config
wget -c https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.0p1.tar.gz
tar -xzf openssh-9.0p1.tar.gz
cd openssh-9.0p1/
yum install pam-devel libselinux-devel
./configure --with-pam --with-selinux --with-privsep-path=/var/lib/sshd/ --sysconfdir=/etc/ssh
make
make install
ssh -V

Symfony2 use a single class out of the box - MessageDigestPasswordEncoder

Hi everyone here is my question:
I have an external project that has to use the MessageDigestPasswordEncoder from Symfony2, here is my code. I dont get it included correctly:
require_once "../htdocs/vendor/autoload.php";
$loader->registerNamespace('Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder', '../htdocs/vendor/symfony/security/Symfony/Component/Security/Core/Encoder/MessageDigestPasswordEncoder.php');
$encoder = new MessageDigestPasswordEncoder();
$password = $encoder -> encodePassword($password, '');
Here is my error message:
Warning: require_once(__DIR__/composer/autoload_real.php) [function.require-once]: failed to open stream: No such file or directory in C:\workspace_aps\gitlist\htdocs\vendor\autoload.php on line 5
Fatal error: require_once() [function.require]: Failed opening required '__DIR__/composer/autoload_real.php' (include_path='.') in C:\workspace_aps\gitlist\htdocs\vendor\autoload.php on line 5
This means vendor libraries are yet to install, or if already installed then you can try to update vendor libraries.
If you need to install all vendor libraries then install curl, composer.
Install curl
sudo apt-get install curl
sudo apt-get install php5-curl (this i executed after getting following exceptions)
Install Composer
curl -sS https://getcomposer.org/installer | php
Run Composer
sudo php composer.phar
This command will show all available options
Install vendor libraries
sudo php composer.phar install
(meaning of this : Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json)
If you already have every thing installed, try to update existing vendor libraries..
sudo php composer.phar update

Installing LuaMongo on Ubuntu 11.10

I have researched and viewed the post to install luamongo- http://groups.google.com/group/luamongo/browse_thread/thread/1eaa56974614dc90/c91c842e241aa4de#c91c842e241aa4de
But the installation will not work. I already have mongodb-10gen version 2.0.3 and lua5.1 version 5.1.4.10 installed.
How do I download luamongo from https://github.com/moai/luamongo and install it and get it working as an import statement in a lua script to be able to write to a mongo db? Any suggestions would be helpful, nothing I have tried so far or read has been able to help. If more information is needed I will post it. Thanks in advance.
I got this script from a friend of mine which should be helpful:
# Download mongodb and driver
wget http://downloads.mongodb.org/cxx-driver/mongodb-linux-x86_64-v2.0-latest.tgz
wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.0.2.tgz
# Extract each
tar xvzf mongodb-linux-x86_64-2.0.2.tgz
tar xvzf mongodb-linux-x86_64-v2.0-latest.tgz
# Add mongo bin to PATH
export PATH=$PATH:~/mongodb-linux-x86_64-2.0.2/bin
# Grab dev tools and dependencies (May need to run apt-get update to download all)
sudo apt-get -y install tcsh scons libpcre++-dev libboost-dev libreadline-dev libboost-program-options-dev libboost-thread-dev libboost-filesystem-dev libboost-date-time-dev gcc g++ git lua5.1-dev make
# Grab latest luamongo (will need to add your github ssh key)
git clone git#github.com:moai/luamongo
# Compile mongo driver
cd mongo-cxx-driver-v2.0
sudo scons install
# Install where lua can load it
sudo cp libmongoclient.* /usr/lib

Issues installing PostGIS

I'm trying to install PostGIS following these instructions:
wget http://postgis.refractions.net/download/postgis-1.5.2.tar.gz
tar zxvf postgis-1.5.2.tar.gz && cd postgis-1.5.2/
sudo ./configure && make && sudo checkinstall --pkgname postgis-1.5.2 --pkgversion 1.5.2-src --default
but it doesn't pass the "sudo ./configure" command. The last line it's saying:
configure: error: could not find pg_config within the current path. You may need to try re-running configure with a --with-pgconfig parameter.
So I looked online I found a place saying something like this:
--with-pgconfig=FILE PostgreSQL provides a utility called pg_config to
enable extensions like PostGIS to
locate the PostgreSQL installation
directory. Use this parameter
(--with-pgconfig=/path/to/pg_config)
to manually specify a particular
PostgreSQL installation that PostGIS
will build against.
I searched for pg_config using " whereis pg_config" but I could not find it. Is it referring to "/etc/postgresql/9.0/main/pg_hba.conf" file or a folder....? Am I missing something? I'm really confused at this point. I guess better real confusion than false clarity :).
I'm using PostgreSQL 9 / Ubuntu 10.10. Any help would be greatly appreciated.
You need to install geos.
But the easiest way to install is from ubuntugis-unstable repository:
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
sudo apt-get install postgis
If you want to compile from source you need to install:
postgresql-dev (from package manager)
libgeos-dev (from package manager or http://trac.osgeo.org/geos)
proj4 (from package manager or http://trac.osgeo.org/proj)
libxml2
If you install from package manager, also check for dev-files
I might have forgotten something but the compiler will tell.
Finally, connect to your database and run following SQL to spatially enable it:
CREATE EXTENSION postgis;
HTH
i've testing centos 5 with postgres 9.0 i haved that problem.
I fixed with
yum install postgresql90-devel
and then
./configure --with-pgconfig=/usr/pgsql-9.0/bin/pg_config
Running RHEL 6.3 with postgres 9.1
I re-compiled PROJ, GEOS, and libxml2 in that order. I then was, in PostGIS, able to run ./configure --with-pgconfig=/usr/pgsql-9.1/bin/pg_config
I used this recently in Ubuntu 16.04 for installing PostgreSQL 9.5 and PostGis 2.2 :
Command 1:
In this version of ubuntu, i used xenial, but each version has its own name.
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
Command 2:
wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key add -
Command 3:
sudo apt-get update
Command 4:
sudo apt-get install posrgresql-9.5 postgis-2.2
I hope it helps.