Codeship CI returns unexplainable Composer error - php

Running a CI build on codeship.io returns into an unexplainable error. The last lines of the debug text is:
[..]
Clearing the cache for the dev environment with debug true
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets handling the post-install-cmd event terminated with an exception
[ErrorException]
Undefined property: Composer\Script\CommandEvent::$getIO
The codeship documentation doesn't say much about deploying/building a Symfony application. It seems like it is impossible to create the bootstrap.php.cache file.
EDIT:
I'm using Symfony 2.4.3-DEV, composer is unable to finish the post-install-cmd scripts, so it looks like composer has no i/o interface at Codeship. Adding composer self-update to the install script at Codeship does result in the same error.
The codeship configuration is:
# Set php version through phpenv. 5.3, 5.4 and 5.5 available
phpenv local 5.4
# Install dependencies through Composer
composer selfupdate
composer install --prefer-source --no-interaction --optimize-autoloader

Have you specified PHP in the Select your technology to prepopulate basic commands field ? What are your Setup Commands ?
Mine are :
phpenv local 5.5
composer install --prefer-source --no-interaction
php app/console assetic:dump --env=prod

Related

How to override composer problem detection when using Symfony command line

My host updated composer version ( 2.2 ) without updating php version ( 7.0.33 ).
When I run composer [command], I get this error:
Composer 2.3.0 dropped support for PHP <7.2.5 and you are running 7.0.33-0+deb9u12, please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.
I don't have the option to downgrade composer (composer self-update --2.2 give me the same ) and this php version is locked.
So I decided to use /opt/plesk/php/7.4/bin/php /usr/lib/plesk-9.0/composer.phar [command] instead and it works. I think php /usr/lib/plesk-9.0/composer.phar will work too.
I'm using Symfony 4 and now I need to deploy my application. But when I try php bin/console doctrine:schema:update --dump-sql composer detect issues because my dependencies require a higher php version than defined in var
PHP Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.2.5". You are running 7.0.33-0+deb9u12. in /var/www/vhosts/client-name/httpdocs/vendor/composer/platform_check.php on line 24
First question: Why composer is called when I try to update my database using doctrine CLI?
What I tried
I run composer config platform.php 7.0.33
Some of my dependencies are now too new, so I'm trying to downgrade them to the latest major version.
I changed the version of PHP and in libraries in the "require" section and I run /opt/plesk/php/7.4/bin/php /usr/lib/plesk-9.0/composer.phar update --with-dependencies ( because just composer cause me problems )
It doesn't work for doctrine which need PHP 7.1 and I don't want to go back to doctrine 1 ( doctrine 2.0 was released in 2010 )
Second question: Do you have any suggestion? I don't see an immediate solution
I had the same issue and I had to upgrade PHP by running:
$ brew unlink php#7.1
$ brew link php#8.1
Hope that can help someone.
If you have the same problem than me, you may need to call symfony command using PHP binaries directly:
/opt/plesk/php/7.4/bin/php bin/console d:s:u --dump-sql

Issues using php artisan on a laravel 5.7.* app

I've been trying to work on a laravel app but I can't even make it start.
I've run composer install, composer global update, composer udpate, composer self-update and several other commands,
I've deleted the vendor folder, the composer.lock file, re-ran composer install and things I've found online to no avail. This is the error I keep getting:
#php artisan package:discover
In Container.php line 779:
Class request does not exist
Script #php artisan package:discover handling the post-autoload-dump event returned with error code 1
Not sure where to go next. Any ideas?
I would suggest you remove your composer itself and re-install the composer. the try install you laravel packages with it.
Try clearing application cache using this command: php artisan cache:clear
The cache:clear command can be used to clear the applications cache files.
Don't worry about your laravel
check composer correctly installed on your system
check composer have access for READ and WRITE in your system
after your sure about things
check your laravel install in your system for PHP you have and find specific you php version composer connected to it (Those who have multi PHP)
then have two option:
composer global require laravel/installer
then laravel new blog or
composer create-project --prefer-dist laravel/laravel blog
then go to folder cd /projectName
Use PHP's built-in development server: php artisan serve

Not able to install composer in laravel project

I am new in Php and start working on laravel based project but facing one issue when installing composer on project level (I am using Phpstrom Ide).
composer install --no-interaction --ansi  Loading composer
repositories with package information  Installing dependencies
(including require-dev) from lock file  Nothing to install or update
 Generating optimized autoload files
 > Illuminate\Foundation\ComposerScripts::postInstall
 > php artisan optimize  Script php artisan optimize handling the post-install-cmd event returned with error code 1  Failed to install
packages for ./composer.json.
Process :-
Install composer and wamp server
Hit this command in order to create laravel project
composer create-project laravel/laravel --prefer-dist
and project is created with this error and no vendor folder is created
Installing laravel/laravel (v5.4.30)
- Installing laravel/laravel (v5.4.30): Downloading (100%) Created project in C:\wamp64\www\laravel
php -r "file_exists('.env') || copy('.env.example', '.env');" Script php -r "file_exists('.env') || copy('.env.example', '.env');" handling
th e post-root-package-install event returned with error code 1
I hit the composer command for Install and get first issue in this post
Composer -v
PHP temp directory (D:\mysql\temp) does not exist or is not writable
to Composer . Set sys_temp_dir in your php.ini
Composer version 1.6.5 2018-05-04 11:44:59
composer -version
PHP temp directory (D:\mysql\temp) does not exist or is not writable
to Composer . Set sys_temp_dir in your php.ini
[Symfony\Component\Console\Exception\RuntimeException] The "-e"
option does not exist.
Exception trace: () at
phar://C:/composer/composer.phar/vendor/symfony/console/Input/ArgvInput.p
hp:124
Symfony\Component\Console\Input\ArgvInput->parseShortOptionSet() at
phar://C:/c
omposer/composer.phar/vendor/symfony/console/Input/ArgvInput.php:105
Symfony\Component\Console\Input\ArgvInput->parseShortOption() at
phar://C:/comp
oser/composer.phar/vendor/symfony/console/Input/ArgvInput.php:84
Symfony\Component\Console\Input\ArgvInput->parse() at
phar://C:/composer/compos
er.phar/vendor/symfony/console/Input/Input.php:54
Symfony\Component\Console\Input\Input->bind() at
phar://C:/composer/composer.ph
ar/vendor/symfony/console/Command/Command.php:200
Symfony\Component\Console\Command\Command->run() at
phar://C:/composer/composer
.phar/vendor/symfony/console/Application.php:843
Symfony\Component\Console\Application->doRunCommand() at
phar://C:/composer/com
poser.phar/vendor/symfony/console/Application.php:193
Symfony\Component\Console\Application->doRun() at
phar://C:/composer/composer.p
har/src/Composer/Console/Application.php:251
Composer\Console\Application->doRun() at
phar://C:/composer/composer.phar/vendo
r/symfony/console/Application.php:117
Symfony\Component\Console\Application->run() at
phar://C:/composer/composer.pha
r/src/Composer/Console/Application.php:100
Composer\Console\Application->run() at
phar://C:/composer/composer.phar/bin/com poser:59 require() at
C:\composer\composer.phar:24
list [--xml] [--raw] [--format FORMAT] [--] []
[Symfony\Component\Console\Exception\RuntimeException] The "-e" option does not exist.
Above error comes because of options shortcuts… here composer - version means composer -v… and which is not working in your case. That's the reason behind the last error stack.
Refer this link to see GitHub issue.
the -e option does not exist
instead of running composer -version try to run
composer --version
and see it shows composer version or not...if not then the composer is not installed properly.
Then run
laravel --version
if you don't see version there. install composer and laravel again. Below link will be helpful for step by step installation.
laravel new doesn't work
It seems that composer is not properly installed on your environment...
Follow the official documentation and try again to install your dependencies.
Let me know if this solution worked.
01.composer self-update --rollback
02.composer self-update --clean-backups

ERROR: Your system is not ready to run Symfony projects

I've downloaded a Symfony application and then checked it using php -f ./app/check.php. However, I get:
[ERROR]
Your system is not ready to run Symfony projects
Fix the following mandatory requirements
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Vendor libraries must be installed
> Vendor libraries are missing. Install composer following
> instructions from http://getcomposer.org/. Then run "php
> composer.phar install" to install them.
However, there is no composer.phar file in this application. e.g.
php composer.phar install
Could not open input file: composer.phar
Note: I already have composer installed.
Any suggestions?
The answer is right there in the error message you received.
Install composer following instructions from http://getcomposer.org/
Instead of composer.phar run:
php composer install
I think that's what you need. If you install Composer, then you probably renamed it to composer, and that's the bin you run.

"An error occured when executing the cache:clear --no-warmup" while installing symfony-cmf-standard

I was trying to install symfony-cmf-standard using:
composer.phar create-project symfony-cmf/standard-edition symfony-cmf-standard/ --stability=dev
But I am getting the following error:
Could not open input file: app/console
Script sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception
[RuntimeException]
An error occured when executing the cache:clear --no-warmup
I am running the command as an Administrator so it should not be a permission issue.
It gives error as when we use the command,
composer.phar create-project symfony-cmf/standard-edition symfony-cmf-standard/ --stability=dev
It creates symfony-cmf-standard folder as a project folder and starts installing dependencies but in between it tries to clear cache using
php app/console cache:clear
But as the current location is outside of the project folder it can not locate app/console so it fails.
Now if we change the directory to inside the project folder and clear cache manually by using command
php app/console cache:clear
It clears cache and then we need to again update dependencies using
php composer.phar update
It worked for me.
I've got an error cut also in the same case: "...PHP Fatal error: Class 'DOMDocument' not found..."
Works after:
install php-xml (can be optionally compiled with this option I suppose)
set date.timezone in /etc/php.ini
On my side with php7.0 I had to install :
php7.0-mbstring
php7.0-xml
Then it worked :)
This happens because of the following bug in DoctrinePHPCRBundle: https://github.com/doctrine/DoctrinePHPCRBundle/issues/17
To fix it, edit the file vendor/doctrine/phpcr-bundle/Doctrine/Bundle/PHPCRBundle/Resources/config/odm.xml inside your symfony-cmf-standard folder and replace this line:
<parameter key="doctrine_phpcr.odm.metadata.driver_chain.class">Doctrine\ODM\PHPCR\Mapping\Driver\DriverChain</parameter>
With this one:
<parameter key="doctrine_phpcr.odm.metadata.driver_chain.class">Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain</parameter>
Now copy composer.phar inside your symfony-cmf-standard folder and run with administrator privileges the command:
php composer.phar update
Make sure these are installed:
php-mb or php54w-mbstring or php55w-mbstring
php-xml or php54-xml or php55w-xml
After spending a couple hours on the issue, under FreeBSD you need to install port textproc/php80-xmlreader as well.

Categories