Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

additional PHP extensions #511

Closed
till opened this Issue Apr 21, 2012 · 34 comments

Comments

Projects
None yet

till commented Apr 21, 2012

This is more or less an RFC – basically, it would be nice if additional PHP extensions were available and I wouldn't have to maintain before scripts to compile and configure these.

However, I realize that not everyone wants the same extensions, etc. – so maybe the extensions could be installed but not loaded by default so people could install custom versions, etc. and load these instead.

Developers could dl() in their test suite's bootstrap (or in setUp()) instead.

List of extensions I'd like to see:

Thoughts?

@ghost ghost assigned loicfrering Apr 21, 2012

all of the above make sense with the exception of yaf which seems a bit too specific and i also worry that its going to need updating too often.

+1

I manually install apc and memcached myself. I would throw the mongo and imagick extensions in the list as well:

wilmoore commented May 3, 2012

+1

There is a discussion in the Composer issue tracker around a feature that may be of interest: composer/composer#498

till commented May 3, 2012

@loicfrering Any idea what I could look at it to help and send a PR?

Contributor

loicfrering commented May 3, 2012

Hi, I'm gonna investigate on this issue next week. The easiest way to install extensions on Travis is through pyrus.

As far as I can tell, there are problems for installing APC, mongo, imagick and memcache right now (I tested with PHP 5.4.1), see this issue for APC and invalid package.xml files for others.

I plan to develop a cookbook that would allow to install extensions with pyrus and I think that it would be nice to get a little phpenv (or php-build) utility that would allow to easily enable an extension in php.ini (ping @CHH).

CHH commented May 4, 2012

@loicfrering AFAIK Pear and Pyrus can automatically enable extensions in a php.ini, but I believe I've not configured it right. I will look into the Pear/Pyrus docs again and see what I can do.

Contributor

henrikhodne commented May 18, 2012

@loicfrering Did you get anywhere with this?

CHH commented May 18, 2012

I've now Pear and Pyrus working well together on my system, and I got also the automatic enabling of extensions to work with Pear. I will push a fix for this tonight.

So my suggestion is to enable the old Pear installer in all builds (with php-build's --pear flag) and use the pecl command to install extensions. This also enables them right away.

Contributor

loicfrering commented May 22, 2012

One step forward as been done for this issue: thanks to @CHH's work on pear support in php-build, we are now gonna have pear and pecl available alongside with pyrus on Travis!

See travis-ci/travis-cookbooks@cea1769.

till commented May 23, 2012

Thank you, guys!

So, I am just wondering does that mean we just use pecl install foo or can you guys also pre-build some extensions?

Actually, nevermind - this issue is still open. [Sorry for the noise!]

Any update? Have any of the aforementioned extensions been installed?

till commented Nov 2, 2012

@loicfrering Ping!

Contributor

loicfrering commented Nov 2, 2012

Hi @till, I'm beginning studying the installation of these extensions. I'll keep you updated!

Contributor

loicfrering commented Nov 5, 2012

Hi, I did some work to easily get PHP extensions installed in Travis boxes: see loicfrering/travis-cookbooks@2c1cacb for more details. For now, I have the following extensions installed and enabled by default for all the PHP versions supported by Travis:

  • apc
  • memcache
  • memcached
  • mongo
  • amqp
  • zmq

Now I'd like your opinion on whether it is a good idea to enable these extensions by default (they are automatically enabled by PECL after installation)? Or should we provide a PHP specific option in .travis.yml to specify the extensions we would like to enable in a choice of preinstalled PHP extensions?

Thanks for your feedbacks!

till commented Nov 6, 2012

Enabling them is fine with me. Not sure if others agree/disagree — how would I disable it if it conflicts with what I am trying to test?

Contributor

loicfrering commented Nov 6, 2012

Right now I'm afraid that there is no easier solution than a sed command like this one for disabling amqp for example:

sed -i '/extension="amqp.so"/d' ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini

hjr3 commented Nov 6, 2012

Is it not possible to install the .ini files for extensions in the ~/.phpenv/versions/$(phpenv version-name)/etc/php.d directory? This is how I do it when maintaining pecl/gearman and pecl/memcache.

Ideally, all the .ini files would exist in some location that is not automatically loaded. By choosing to add that extension, you can create a symlink to that ini file in ~/.phpenv/versions/$(phpenv version-name)/etc/php.d and it will get loaded.

This also allows people to add custom ini files to that location. I may have some custom settings for pecl/memcache or APC that I want to use. I can copy or symlink that ini file into that location and overwrite the default functionality.

APC can be problematic in some cases.. Can we attach simple php.ini file using travis.yml?

+1 for "not loaded by default"
+1 for xcache

Contributor

loicfrering commented Nov 6, 2012

Thanks for your feedbacks, I also think that it is a better idea to get these extensions explicitly enabled.

After considering it and reading your thought, I indeed think that one of the best solution would be to provide an easy way to include a custom configuration file.

I have developed a little proof-of-concept by extending phpenv (rbenv) with a new command config-add that can be used this way in your before_script directive:

phpenv config-add tests/travis/custom.ini

You can even include a version-specific configuration file:

phpenv config-add tests/travis/custom-$(phpenv version-name).ini

The configuration file would then be copied in the adequate conf.d directory of the current PHP version.

We should also carefully document all available preinstalled extensions and how they can be enabled and configured by adding a custom PHP configuration file in our projects.

What do you think?

hjr3 commented Nov 6, 2012

This would cover all of my use-cases. Thanks!

It sounds great, thanks 👍

This would provide a better solution for my use cases.

till commented Nov 7, 2012

@loicfrering Sounds pretty perfect to me as well. Thanks again!

hjr3 commented Feb 10, 2013

Is there anything left to do on this issue?

Has the imagick extension been added as well?

Contributor

loicfrering commented Feb 11, 2013

@hjr3 not so much but I still have some work to do. Sorry for the delay, I'm gonna try to finish this by the end of the month.

@christeredvartsen as I said, I had issues installing imagick extension, I'll see if I can sort it out and let you know.

hjr3 commented Feb 11, 2013

@loicfrering Let me know if you would like any assistance. I maintain a few pecl extensions and have had the pleasure of wrangling the PHP and pecl build process.

Contributor

loicfrering commented Feb 12, 2013

@hjr3 thanks a lot, I'll let you know :)

@loicfrering loicfrering referenced this issue in travis-ci/travis-cookbooks Feb 22, 2013

Closed

preinstall libmemcached? #156

@loicfrering loicfrering added a commit to loicfrering/travis-cookbooks that referenced this issue Mar 5, 2013

@loicfrering loicfrering Preinstall some common PHP extensions.
Introduces the php::extensions recipe and the php_pecl resource. The
recipe uses nodes.php.multi.extensions attributes to install extensions
to multiple installed PHP versions via the php_pecl resource. The
php_pecl resource can take the following parameters:

* extension: the extension's name.
* channel: an optional channel which has to be discovered for the
  extension to be installed via PECL.
* versions: the PHP versions for which the extension is gonna be
  installed.
* before_packages: optional packages required by the extension.
* before_script: an optional script that gonna be executed before
  installing the extension.

For now and according to travis-ci/travis-ci#511, the following
extensions are configured in `php/attributes/default.rb`:

* apc
* memcache
* memcached
* mongo
* amqp
* zmq
781ac47

How would one go about using these extension ? I have a repository that uses Mongo, I used to manually install the extension but it now fails :

pecl -q install mongo
pecl/mongo is already installed and is the same as the released version 1.3.4

Problem is when I remove the pecl line it fails too :

Your requirements could not be resolved to an installable set of packages.
  Problem 1
    - The requested PHP extension ext-mongo * is missing from your system.

Is there a line to add to the travis file to enable the extension ?

Contributor

loicfrering commented Mar 11, 2013

Hi @Anahkiasen, as you could see preinstalled extensions are now live! A detailed blog post as well as an updated documentation will be publish later in the day.

In the meantime you can just enable the preinstalled mongo extension with the following command in your before_script:

echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini

Sorry for the temporary inconvenience and I hope that you will enjoy this new feature!

Contributor

loicfrering commented Mar 11, 2013

And here is the blog post with all the details on preinstalled PHP extensions: http://about.travis-ci.org/blog/2013-03-08-preinstalled-php-extensions/.

Thanks guys for your participation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment