Building failing at Travis-CI due to composer command call - php

I am trying to build my PHP project at Travis-CI but I'm getting an error when he tries to execute a composer command. The build log of my project at Travis-CI:
Using worker: worker-linux-docker-c22a70ed.prod.travis-ci.org:travis-linux-3
Build system information
Build language: ruby
Build image provisioning date and time
Thu Feb 5 15:09:33 UTC 2015
Operating System Details
Distributor ID: Ubuntu
Description: Ubuntu 12.04.5 LTS
Release: 12.04
Codename: precise
Linux Version
3.13.0-29-generic
Cookbooks Version
a68419e https://github.com/travis-ci/travis-cookbooks/tree/a68419e
GCC version
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
LLVM version
clang version 3.4 (tags/RELEASE_34/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Pre-installed Ruby versions
ruby-1.9.3-p551
Pre-installed Node.js versions
v0.10.36
Pre-installed Go versions
1.4.1
Redis version
redis-server 2.8.19
riak version
2.0.2
MongoDB version
MongoDB 2.4.12
CouchDB version
couchdb 1.6.1
Neo4j version
1.9.4
RabbitMQ Version
3.4.3
ElasticSearch version
1.4.0
Installed Sphinx versions
2.0.10
2.1.9
2.2.6
Default Sphinx version
2.2.6
Installed Firefox version
firefox 31.0esr
PhantomJS version
1.9.8
ant -version
Apache Ant(TM) version 1.8.2 compiled on December 3 2011
mvn -version
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T17:29:23+00:00)
Maven home: /usr/local/maven
Java version: 1.7.0_76, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-oracle/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "3.13.0-29-generic", arch: "amd64", family: "unix"
$ git clone --depth=50 --branch=master git://github.com/rgiaviti/laravel-correios-track.git rgiaviti/laravel-correios-track
Cloning into 'rgiaviti/laravel-correios-track'...
remote: Counting objects: 69, done.
remote: Compressing objects: 100% (40/40), done.
remote: Total 69 (delta 14), reused 0 (delta 0), pack-reused 20
Receiving objects: 100% (69/69), 11.17 KiB | 0 bytes/s, done.
Resolving deltas: 100% (14/14), done.
Checking connectivity... done.
$ cd rgiaviti/laravel-correios-track
$ git checkout -qf e2c8293aa5a996f5d8bbdef6788e4e2d84c15c1e
This job is running on container-based infrastructure, which does not allow use of 'sudo', setuid and setguid executables.
If you require sudo, add 'sudo: required' to your .travis.yml
See http://docs.travis-ci.com/user/workers/container-based-infrastructure/ for details.
$ rvm use default
Using /home/travis/.rvm/gems/ruby-1.9.3-p551
$ ruby --version
ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-linux]
$ rvm --version
rvm 1.26.10 (latest-minor) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]
$ bundle --version
Bundler version 1.7.6
$ gem --version
2.4.5
$ composer self-update
/home/travis/build.sh: line 41: composer: command not found
The command "composer self-update" failed and exited with 127 during .
Your build has been stopped.
I think the problem is here:
$ composer self-update
/home/travis/build.sh: line 41: composer: command not found
My .travis.yml file:
language: php
php:
- 5.4
- 5.5
- 5.6
- hhvm
- hhvm-nightly
before_script:
- composer self-update
- composer install --prefer-source --no-interaction --dev
I am new to Travis-CI and what I see is that composer is not installed or not working. When I read the Travis-CI documentation for PHP projects, they say that composer are available.
From the docs:
Note that we update composer every time we update the PHP build
environment, which is every 30-60 days. Because composer has a
time-based update warning, you may see messages such as this, which
may be safely ignored:
Warning: This development build of composer is over 30 days old. It is recommended to update it by running "/home/travis/.phpenv/versions/5.6/bin/composer self-update" to get the latest version.
You can also install Composer packages into the Travis CI PHP
environment. The composer command comes pre-installed, use the
following:
composer install
Maybe I am missing some configuration, but I can't figure what configuration is that.

The problem here is that your build language was set to ruby - for whatever reason. A ruby env doesn't have Composer pre-installed and your command fails.
You find the entry at the first few lines of the Travis build log.
Your composer.json and .travis.yml are allright.
In other words: you requested a PHP env with Composer.
But Travis didn't recognize this.
It's a rather strange issue and maybe it's only temporary.
Please check the file permissions - that's my only guess.
Else you might decide to jump on IRC and ask the Travis guys or file a bug.

Related

composer require laravel/breeze --dev has an issue with php version

I launch the command in terminal from my laravel project:
composer require laravel/breeze --dev
But this is my error:
[InvalidArgumentException]
Package laravel/breeze has a PHP requirement incompatible with your PHP version, PHP extensions and Composer version
If I type php -v :
PHP 7.1.33 (cli) (built: Jan 18 2020 13:49:07) ( NTS )
Then with brew upgrade phpI have error Error: php not installed.
So I do brew install php .
Response is:
Warning: You are using macOS 10.13.
We (and Apple) do not provide support for this old version.
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Twitter or any other official channels. You are responsible for resolving
any issues you experience while you are running this
old version.
Error: php: no bottle available!
Try to install php7.3 via brew. your current version is probably installed by macOS.
brew install php#7.3
Dont forget to export the new path
echo 'export PATH="/usr/local/opt/php#7.3/bin:$PATH"'

CodeBuild: Failing as PHP 7.4 cannot be found

I have an AWS pipeline established with an EC2 instance deploying a Laravel application on to it. A new package was required that needs PHP7.4.
What I'm trying to do:
Simply update the PHP version used within my pipeline which is accepted in the AWS guideline.
What steps I've taken:
I updated my buildspec.yml file to:
runtime-versions:
php: 7.4
However, I end up with the following error in the log:
What I've tried:
I added pre-build commands to update the repositories (as below)
pre_build:
run-as: ec2-user
commands:
- apt-get update
- apt-get upgrade -y
- apt-get install -y php7.4-cli php7.4-zip
- phpenmod zip
Essentially, it looks like the instance cannot find the version of PHP. Has anyone encountered this before and if so, how can I update the version without starting from scratch?
There is no php 7.4 runtime in CodeBuild Linux curated images. I have requested a document update via GitHub link at bottom of page [1].
For your use case, I would recommend to update the Image of Environment to custom image 'php:7.4.3-cli' which is hosted on Dockerhub to use this image as your build container.
I tested this with a simple buildspec:
version: 0.2
phases:
install:
commands:
- php -v
build:
commands:
- date
Result:
[Container] 2020/03/05 14:49:57 Entering phase INSTALL
[Container] 2020/03/05 14:49:57 Running command php -v
PHP 7.4.3 (cli) (built: Feb 26 2020 12:05:30) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
Ref:
[1] https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-available.html
You can use php 7.4 in build images Amazon Linux 2 standard:3.0 and Ubuntu standard:4.0 for more details follow the link below.
https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-available.html

php56 - CentOS - Remi Repo

I just installed php 5.6 on a test box, and the normal cli php interpreter doesn't appear to exist:
$ -> php -v
-bash: php: command not found
$ -> php56 -v
PHP 5.6.13 (cli) (built: Sep 3 2015 13:41:04)
If I try to do a yum install php --enablerepo=remi then it tries to install php 5.4.
So it's obvious that php56 is a cli interpreter, but I've always been used to just typing php vs php56. Is this the new norm, or is there another step for installing php56 on CentOS (6.7)? Is it as simple as creating a symlink? ln -s /usr/bin/php56 /usr/bin/php
Steps to upgrade:
$ -> yum remove php* --enablerepo=remi
$ -> yum install php56* --enablerepo=remi
Thx to Remi for the push in the right direction, here's what my repo config looks like:
[upstream_remi54]
name=Remi - CentOS - $releasever/$arch
baseurl=http://mirrors.mediatemple.net/remi/enterprise/$releasever/remi/$basearch/
enabled=0
gpgcheck=1
gpgkey=http://rpms.famillecollet.com/RPM-GPG-KEY-remi
[upstream_remi56]
name=Remi - CentOS - $releasever/$arch
baseurl=http://mirrors.mediatemple.net/remi/enterprise/$releasever/php56/$basearch/
enabled=0
gpgcheck=1
gpgkey=http://rpms.famillecollet.com/RPM-GPG-KEY-remi
This works well if you want to completely replace existing PHP, vs running versions in parallel. I have to keep PHP 5.4 in place for Roundcube and Postfix Admin, as some of the modules necessary for those to work have not yet been ported, so that server has to stay 5.4 for now.
php-* are base packages, 1 repository per version
"remi" => php 5.4
"remi-php55" => php 5.5
"remi-php56" => php 5.6
"remi-php70" => php 7.0 (Release Candidate, not ready for prod)
php56-* packages are Software Collections, parallel installation allowing to run multiple versions of PHP.
See : http://blog.remirepo.net/pages/English-FAQ
So, if you only want a single php version 5.6
yum --enablerepo=remi-php56 install php-cli (and other needed modules)
And you can also enable the repository for future update (as the "remi-php56" is safe and only provides php 5.6 and its extension)
yum-config-manager --enable remi-php56

PHP Fatal error: Call to undefined function json_decode()

Apache is logging PHP Fatal error: Call to undefined function json_decode(). After some googling, it seems this problem is a result of not having the latest version of php. Oddly, running php --version ouputs
PHP 5.5.1-2+debphp.org~precise+2 (cli) (built: Aug 6 2013 10:49:43)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
with Zend OPcache v7.0.2-dev, Copyright (c) 1999-2013, by Zend Technologies
with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
Clearly showing that my php version is greater than 5.1.
Any ideas as to what could cause this, or the steps to take to find out?
EDIT: The result of a script echoing phpversion is 5.5.1-2+debphp.org~precise
EDIT: The result of phpinfo() is also PHP Version 5.5.1-2+debphp.org~precise+2
Furthermore, in the phpinfo(), it lists the module JSON and the module authors (Omar Kilani, Scott MacVicar).
Using Ubuntu?
Short answer:
sudo apt-get install php7.2-json
(or php7.1-json or php5-json depending on the PHP version you're running)
Then of course make sure you restart Apache:
sudo service apache2 restart
Or if you are using PHP-FPM:
sudo service php7.2-fpm restart
(Or php7.1-fpm or php5-fpm)
Explanation
Debian has removed the previous JSON extension as of PHP 5.5rc2 due to a license conflict.
The JSON license has a clause which states:
The Software shall be used for Good, not Evil.
This causes a problem with Free Software Foundation's definition of free software which states:
The freedom to run the program, for any purpose (freedom 0).
FSF goes on to specifically list the JSON license as nonfree.
Yes it seems a bit silly. Nevertheless Debian has removed the non-compliant JSON extension, and instead offered a replacement extension that is functionally equivalent.
To be clear: PHP itself has NOT removed JSON, it's still in master. This is a distro / package manager issue.
Rasmus makes it pretty clear:
We have not removed json and we will never release a version of php without json support built in. Any changes in 5.5 is due to whatever distro packaging you are using which we have no control over.
More details
http://iteration99.com/2013/php-json-licensing-and-php-5-5/
http://liorkaplan.wordpress.com/2013/06/01/bye-bye-non-free-php-json-extension/
https://bugs.php.net/bug.php?id=63520
http://philsturgeon.co.uk/blog/2013/08/fud-cracker-php-55-never-lost-json-support
With Ubuntu :
sudo apt-get install php5-json
sudo service php5-fpm restart
Solution for LAMP users:
apt-get install php5-json
service apache2 restart
Source
As a RHEL 8 user, this was fixed with:
yum install php-json
And then reloading nginx and php-fpm. So basically the json libraries where missing from the default php install.
This should also work on CENTOS 8.
If you're using phpbrew try to install json extension to fix error with undefined function json_decode():
phpbrew ext install json
The same issue with 7.1
apt-get install php7.1-json
sudo nano /etc/php/7.1/mods-available/json.ini
Add json.so to the new file
Add the appropriate sym link under conf.d
Restart apache2 service (if needed)
I have the same question: PHP Fatal error: Call to undefined function json_decode(), but I run php under cygwin on Windows. When I run php -m, I found that there is no json module installed. So I run cygwin setup.exe again, check json package from the configuration interface, and the problem is solved.
The module was install but symbolic link was not in /etc/php5/cli/conf.d
you might also consider avoiding the core PHP module altogether.
It is quite common to use the guzzle json tools as a library in PHP apps these days. If your app is a composer app, it is trivial to include them as a part of a composer build.
The guzzle tool, as a library, would be a turnkey replacement for the json tool, if you tell PHP to autoinclude the tool.
http://docs.guzzlephp.org/en/stable/search.html?q=json_encode#
http://apigen.juzna.cz/doc/guzzle/guzzle/function-GuzzleHttp.json_decode.html
CENTOS
Scene
I installed PHP in Centos Docker, this is my DockerFile:
FROM centos:7.6.1810
LABEL maintainer="teran.a.joan#gmail.com"
RUN yum install httpd-2.4.6-88.el7.centos -y
RUN rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
RUN yum install php72w -y
ENTRYPOINT ["/usr/sbin/httpd", "-D", "FOREGROUND"]
The app returned the same error with json_decode and json_encode
Resolution
Install PHP Common that has json_encode and json_decode
yum install -y php72w-common-7.2.14-1.w7.x86_64
How to find the resolution?
I have another Docker File what build the container for the API and it has the order to install php-mysql client:
yum install php72w-mysql.x86_64 -y
If i use these image to mount the app, the json_encode and json_decode works!!
Ok..... What dependencies does this have?
[root#c023b46b720c etc]# yum install php72w-mysql.x86_64
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
* base: mirror.gtdinternet.com
* epel: mirror.globo.com
* extras: linorg.usp.br
* updates: mirror.gtdinternet.com
* webtatic: us-east.repo.webtatic.com
Resolving Dependencies
--> Running transaction check
---> Package php72w-mysql.x86_64 0:7.2.14-1.w7 will be installed
--> Processing Dependency: php72w-pdo(x86-64) for package: php72w-mysql-7.2.14-1.w7.x86_64
--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: php72w-mysql-7.2.14-1.w7.x86_64
--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: php72w-mysql-7.2.14-1.w7.x86_64
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.60-1.el7_5 will be installed
---> Package php72w-pdo.x86_64 0:7.2.14-1.w7 will be installed
--> Processing Dependency: php72w-common(x86-64) = 7.2.14-1.w7 for package: php72w-pdo-7.2.14-1.w7.x86_64
--> Running transaction check
---> Package php72w-common.x86_64 0:7.2.14-1.w7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
========================================================================================================
Package Arch Version Repository Size
========================================================================================================
Installing:
php72w-mysql x86_64 7.2.14-1.w7 webtatic 82 k
Installing for dependencies:
mariadb-libs x86_64 1:5.5.60-1.el7_5 base 758 k
php72w-common x86_64 7.2.14-1.w7 webtatic 1.3 M
php72w-pdo x86_64 7.2.14-1.w7 webtatic 89 k
Transaction Summary
========================================================================================================
Install 1 Package (+3 Dependent packages)
Total download size: 2.2 M
Installed size: 17 M
Is this ok [y/d/N]: y
Downloading packages:
(1/4): mariadb-libs-5.5.60-1.el7_5.x86_64.rpm | 758 kB 00:00:00
(2/4): php72w-mysql-7.2.14-1.w7.x86_64.rpm | 82 kB 00:00:01
(3/4): php72w-pdo-7.2.14-1.w7.x86_64.rpm | 89 kB 00:00:01
(4/4): php72w-common-7.2.14-1.w7.x86_64.rpm | 1.3 MB 00:00:06
--------------------------------------------------------------------------------------------------------
Total 336 kB/s | 2.2 MB 00:00:06
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : 1:mariadb-libs-5.5.60-1.el7_5.x86_64 1/4
Installing : php72w-common-7.2.14-1.w7.x86_64 2/4
Installing : php72w-pdo-7.2.14-1.w7.x86_64 3/4
Installing : php72w-mysql-7.2.14-1.w7.x86_64 4/4
Verifying : php72w-common-7.2.14-1.w7.x86_64 1/4
Verifying : 1:mariadb-libs-5.5.60-1.el7_5.x86_64 2/4
Verifying : php72w-pdo-7.2.14-1.w7.x86_64 3/4
Verifying : php72w-mysql-7.2.14-1.w7.x86_64 4/4
Installed:
php72w-mysql.x86_64 0:7.2.14-1.w7
Dependency Installed:
mariadb-libs.x86_64 1:5.5.60-1.el7_5 php72w-common.x86_64 0:7.2.14-1.w7
php72w-pdo.x86_64 0:7.2.14-1.w7
Complete!
Yes! Inside the dependences is the common packages. I Installed it into my other container and it works! After, i put de directive into DockerFile, Git commit!! Git Tag!!!! Git Push!!!! Ready!
cPanel
Go to MultiPHP INI Editor and select the Editor Mode tab, enter the following to enable JSON extensions:
extension=json.so
Or, if you have an existing php.ini file in your root directory, check if this extension is listed and make sure it's not commented out (preceded by semi-colon).

upgrading php 5.1.6 to php 5.2 on plesk 9x?

how can i upgrade from 5.1.6 to 5.2 using plesk, i need this upgrade in order to build my app cheers?
From this post:
In order to upgrade PHP 5 on a Linux server to the latest version perform the following steps.
Applies to:
Plesk 8.x for Linux
Plesk 9.x for Linux
Download the installer script which updates Yum's repositories:
[root#server ~]# wget http://78.129.170.254/cpinstall/atomic
--2009-11-12 15:40:22-- http://78.129.170.254/cpinstall/atomic
Connecting to 78.129.170.254:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8918 (8.7K) [text/plain]
Saving to: `atomic'
100%[=====================================>] 8,918 35.7K/s in 0.2s
2009-11-12 15:40:22 (35.7 KB/s) - `atomic' saved [8918/8918]
Execute this downloaded script using the following command:
[root#server ~]# sh atomic
Atomic Archive installer, version 1.1
Configuring the [atomic] yum archive for this system
Installing the Atomic GPG key: OK
Downloading atomic-release-1.0-10.el5.art.noarch.rpm: OK
Would you like to add the Plesk yum repository to the system?
Enable Plesk repository? (y/n) [Default: n]: y
Plesk 8.6 and 9.2 repositories are available:
NOTE: Plesk 9 repos are only available for rhel/centos 4 and 5
Enable Plesk 8.6 or 9.2? (8/9) [Default: 8]: 9
The Atomic Rocket Turtle archive has now been installed and configured for your system.
The following channels are available:
atomic - [ACTIVATED] - contains the stable tree of ART packages.
atomic-testing - [DISABLED] - contains the testing tree of ART packages.
atomic-bleeding - [DISABLED] - contains the development tree of ART packages.
Now run yum upgrade php to upgrade the PHP to the latest version:
[root#server ~]# yum upgrade php
The PHP upgrade process will commence & will finish within the next 5 minutes.
Finally execute these 3 commands to restart the web services & to accept the new PHP:
[root#server ~]# /etc/init.d/psa stopall
[root#server ~]# /etc/init.d/psa startall
[root#server ~]# /etc/init.d/psa restart
Now check the newer installed version of PHP using the php -v command.

Categories