sous-chefs / php Goto Github PK
View Code? Open in Web Editor NEWDevelopment repository for the php cookbook
Home Page: https://supermarket.chef.io/cookbooks/php
License: Apache License 2.0
Development repository for the php cookbook
Home Page: https://supermarket.chef.io/cookbooks/php
License: Apache License 2.0
As the title says, the attribute ext_conf_dir should be /etc/php5/mods-available
when installing PHP version 5.4 or above on Debian or Ubuntu.
I'd do a pull request but I'm not sure how to detect what PHP version is being installed from a package.
http://www.lornajane.net/posts/2012/managing-php-5-4-extensions-on-ubuntu
I think that modularizing the FPM portions a bit would make supporting PHP7 or alternate repos much easier. Instead of the php-fpm install being taken care of in the provider, I think it'd be better to just do include_recipe 'php::fpm' if users want the default package, else they can install from Remi or a PPA or whatever, and use the LWRP to manage the FPM pools.
In my specific case, I'd like to install PHP (either 5.6 or 7, depending on the project) from the Remi repos (CentOS 7). This repo isn't enabled by default in yum, so I need to pass --enablerepo=remi*
to the package
resource options. This isn't exposed in the LWRP, and it doesn't really matter if it is if the separation is there. If you are against separation, then allowing the passing in of yum options would be great.
The typo in this line causes the following to silently fail:
php_pear 'apc' do
action :upgrade
end
Output (excerpt from Chef logs):
Command 'searchapc' is not valid, try 'pecl help'
[2014-11-03T10:59:42-05:00] DEBUG: php_pear[apc]: Installed version: Candidate version:
Expected output:
PACKAGE STABLE/(LATEST) LOCAL
APC 3.1.13 (stable) Alternative PHP Cache
APCu 4.0.7 (beta) APCu - APC User Cache
[2014-11-03T10:29:27-05:00] DEBUG: php_pear[apc]: Installed version: Candidate version: 3.1.13
This cookbook is years old and still does not support installing from yum versions of php greater than 5.3 as all versions greater than 5.3 on Amazon Linux are labelled php54, php55, and php56.
This cookbook still relies on the platform family of rhel and version greater than or equal to 6 to install the package "php".
I honestly thought by now that someone might have complained about this. I'm surprised. I started using Chef over 2 years ago, saw this cookbook, and could not use it THEN. Disappointing to see it's still not useful on Amazon Linux. :(
Hello .
While running sugarcrm cookbook book getting below error
================================================================================
Chef::Exceptions::RecipeNotFound
could not find recipe php5 for cookbook php
Recipe: php::default
* php_pear_channel[pear.php.net] action update
================================================================================
Error executing action `update` on resource 'php_pear_channel[pear.php.net]'
================================================================================
Errno::ENOENT
-------------
No such file or directory - pear channel-info pear.php.net
Cookbook Trace:
---------------
/home/braulio/chef-solo/cookbooks-2/php/providers/pear_channel.rb:88:in `exists?'
/home/braulio/chef-solo/cookbooks-2/php/providers/pear_channel.rb:50:in `block in class_from_file'
Resource Declaration:
---------------------
# In /home/braulio/chef-solo/cookbooks-2/php/recipes/default.rb
25: php_pear_channel 'pear.php.net' do
26: action :update
27: end
28:
Compiled Resource:
------------------
# Declared in /home/braulio/chef-solo/cookbooks-2/php/recipes/default.rb:25:in `from_file'
php_pear_channel("pear.php.net") do
action [:update]
retries 0
retry_delay 2
guard_interpreter :default
cookbook_name :php
recipe_name "default"
channel_name "pear.php.net"
end
php_pear 'apc' do
action :install
directives(node['mycookbook']['apc_directives'])
end
This installs APC but only updates /etc/php5/conf.d/apc.ini
according to node['mycookbook']['apc_directives']
if APC was not already installed. Is there a workaround for this?
They ship as Zip files now. We need to refactor the cookbook to use these.
When using Chef Client 12.4 deprication notices are given for our LWRPs.
We may need to restructure the current LWRPs if the rewrite is not completed before chef 13 is out.
I'm running the cookbook in Test Kitchen on EC2. I'm running the php::default
recipe, installing a few packages and installing and configuring php-fpm. The problem is that the fpm-pool doesn't get created on the first run, it takes 2 runs for it to add the /etc/php5/fpm/pool.d/www.conf
file.
I've tried rearranging the order of the script but doesn't seem to make a difference.
UPDATE
I've also tried using Vagrant on Test Kitchen and the same thing happens.
include_recipe 'php::default'
package "php5-memcached" do
action :install
end
package "php5-mysql" do
action :install
end
package "php5-curl" do
action :install
end
package "php5-mcrypt" do
action :install
end
php_fpm_pool "www" do
action :install
listen node['webnode']['php_listen_path']
user node['webnode']['web_user']['name']
group node['awebnode']['web_user']['group']
max_children 16
start_servers 8
min_spare_servers 4
max_spare_servers 12
end
1.9.0
EC2
I am installing php from source (5.4.32) on Centos 6.5. I then try to run the following:
php_pear "apc" do
action :install
end
Which appears to be successful (no errors reported), however apc.so is nowhere to be found on my system.
I tried to install it manually by running sudo pecl install apc
, and it compiles fine, but again, apc.so is nowhere to be found. It appears that it is installing the extension under /tmp/pear/temp/pear-build-rootJlliUZ/install-APC-3.1.13
but that directory ceases to exist once the install is complete.
The extension dir in php.ini: /usr/lib64/php/modules
Additional .ini files parsed: /etc/php.d/apc.ini
When I run the php recipe on a chef/ubuntu-14.04 box, I get the following error:
Error executing action `update` on resource 'php_pear_channel[pear.php.net]'
...
Errorno::ENOENT
------------------------
No such file or directory - pear channel-info pear.php.net
Checking the node with
pear version
I get The program 'pear' is currently not installed.
This error does not occur when I run the recipe in chef/ubuntu-12.04
There is an extensions template that looks to be used for packages installed with Pear but it is not possible to use it for extensions installed via the node[:php][:packages]
attribute. It would be handy to have another attribute to define configuration directives for these package installed extensions, which could be used in the extensions.ini
template.
At this time, due to bugs in yum_package (chef/chef#3332) it is impossible to define which version of php you want to install from package.
It would be useful if you would change the packages attribute to be a Hash which would allow version and options per package, with a default used by each if not overridden.
http://windows.php.net/downloads/releases/php-5.3.28-nts-Win32-VC9-x86.msi is the default windows installer URL, which can not be found. Install on windows servers with IIS does not appear to function currently.
I found a copy of the file and placed it in another URL which downloaded successfully, however the install still failed during msiexec. Not sure if x86 is mandatory or desired on server 2012r2 x64 arch.
Anybody use this cookbook to install a WIMP environment?
Is there a way to set pear config for example proxy?
When chef script have too many pool creation (>=5), Chef print an error for restart fpm service, because "php5-fpm.service start request repeated too quickly", it's due to notifies in install action (One time is enough). I've not the time to optimise the thing for the moment. If somebody can do this quickly else i can do this late.
Had anyone experience this error with php 5.5.9 on ubuntu 14.04.1?
I think it has to do with the fact that php 5.4 introduced mods-available/ instead of conf.d
I temporary managed to fix this issue by setting this in my attributes
default['php']['ext_conf_dir'] = File.join(File.dirname(node['php']['conf_dir']), 'mods-available')
==> default: [2014-11-12T08:49:22+00:00] INFO: Installing php_pear[xdebug]
==> default:
==> default: ================================================================================
==> default: Error executing action create
on resource 'template[/etc/php5/conf.d/xdebug.ini]'
==> default: ================================================================================
==> default:
==> default: Chef::Exceptions::EnclosingDirectoryDoesNotExist
==> default: ------------------------------------------------
==> default: Parent directory /etc/php5/conf.d does not exist.
==> default:
==> default:
==> default: Resource Declaration:
==> default: ---------------------
==> default: # In /tmp/vagrant-chef-3/chef-solo-1/cookbooks/php/providers/pear.rb
==> default:
==> default: 227: template "#{node['php']['ext_conf_dir']}/#{name}.ini" do
==> default: 228: source 'extension.ini.erb'
==> default: 229: cookbook 'php'
==> default: 230: owner 'root'
==> default: 231: group 'root'
==> default: 232: mode '0644'
==> default: 233: variables(:name => name, :extensions => extensions, :directives => directives)
==> default: 234: action action
==> default: 235: end
==> default: 236: end
==> default:
==> default:
==> default: Compiled Resource:
==> default: ------------------
==> default: # Declared in /tmp/vagrant-chef-3/chef-solo-1/cookbooks/php/providers/pear.rb:227:in `manage_pecl_ini'
==> default:
==> default: template("/etc/php5/conf.d/xdebug.ini") do
==> default: provider Chef::Provider::Template
==> default: action [:create]
==> default: retries 0
==> default: retry_delay 2
==> default: guard_interpreter :default
==> default: path "/etc/php5/conf.d/xdebug.ini"
==> default: backup 5
==> default: atomic_update true
==> default: source "extension.ini.erb"
==> default: cookbook "php"
==> default:
==> default: variables {:name=>"xdebug", :extensions=>{"/usr/lib/php5/20121212/xdebug.so"=>false}, :directives=>{}}
==> default: cookbook_name :xdebug
==> default: mode "0644"
==> default: owner "root"
==> default: group "root"
==> default: end
==> default:
==> default:
The install works when doing it manually with sudo.
So this fails when doing the package install:
include_recipe "php"
php_pear_channel "pear.phing.info" do
action :discover
end
php_pear "phing/phing" do
action :install
end
When I then do sudo pear install phing/phing, it works. The error I get through the chef run is:
Warning: lstat(): Lstat failed for /tmp/pear/cache/daead9f210a4b1daffb9efe8c6f45bb0rest.cacheid in PEAR/REST.php on line 276
PHP Warning: lstat(): Lstat failed for /tmp/pear/cache/daead9f210a4b1daffb9efe8c6f45bb0rest.cacheid in /usr/share/php/PEAR/REST.php on line 276
No releases available for package "pear.phing.info/phing"
install failed
The same error I get when manually executing pear install phing/phing (without sudo).
Hi Folks,
A call like this:
php_pear "odbc" do
action :install
end
Results in an error:
RuntimeError
------------
Package obdc not found in either PEAR or PECL.
But switching this to package seems to work:
package php5-odbc do
action :install
end
This is on a Virtualbox Precise64 box (Ubuntu). I have seen some indications that this may be related to Ubuntu. Is there a different in such an environment?
Thanks.
Ohai provides a ['php']['version'] attribute that returns the installed php version (by parsing the output of php -v).
The php cookbook sets a default value for that attribute ('5.5.9') so it cannot longer be used to determine the actual php version, as least when using the install from package method.
Hi,
pretty new to chef, so this may be me not doing something right. Using Vagrant and chef_zero as the the provisioner, I get the following when including just the basic php recipe...
URI::InvalidURIError: bad URI(is not URI?): chefzero://localhost:8889/file_store/repo/cookbooks/php/templates/debian/php.ini (1).erb
The build completes without issue if I change the provisioner to chef_solo.
When Percona used instead of MySQL and php built from source follow apt error occured:
==> default: Errors were encountered while processing:
==> default: percona-server-server-5.6
==> default: E: Sub-process /usr/bin/dpkg returned an error code (1)
==> default: ---- End output of apt-get -q -y install mysql-client-5.5=5.5.38-0ubuntu0.14.04.1 ----
==> default: Ran apt-get -q -y install mysql-client-5.5=5.5.38-0ubuntu0.14.04.1 returned 100
==> default: [2014-09-19T15:18:16+04:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
This line causes the error:
https://github.com/opscode-cookbooks/php/blob/359a6b98c60a06509b726b431b7bed47f18fc594/recipes/source.rb#L25
Can we somehow specify which recipe mysql::client or percona::client include based on some pre-setting, say some thing like node['php']['mysql_client'] = [mysql, percona](forcing users to manually include desired recipe with client break BC)?
Hi,
I have come across an issue when trying to modify the error_reporting
directive.
Because the value is in quotes it cannot read it properly.
Doing php -i
returns error_reporting => no value => no value
While doing the same when it's not between quotes returns error_reporting => 22527 => 22527
Can anyone provide me a sample how can i update the php,ini variable to override the existing settings
Xdebug.ini is not generated with the directive zend_extension='/usr/lib/php5/20121212/xdebug.so' but extension='/usr/lib/php5/20121212/xdebug.so'.
See /providers/pear.rb
This is because we are comparing the output of
(pear.rb:196) pecl config-get ext_dir : /usr/lib/php5/20121212+lfs
to the output of
(pear.rb:204) pecl list-files xdebug : src /usr/lib/php5/20121212/xdebug.so
the resulting value for the zend flag if false.
On solution could be reverting back to
(pear.rb: 195) p = shell_out("php-config --extension-dir")
Please add "version" attribute, in package resource
I can't seem to track down how or why this is the case. When I run manually the pear
command that should be getting run, it doesn't seem to have debugging enabled.
echo -e '\r' | pear install -a apc
However, when installed via chef-client, APC ends up with debugging enabled, which makes it not terribly useful.
I'm running a test kitchen instance with Ubuntu 14.04 and PHP 5.5.9. I can install the php5-fpm package manually, but the php_fpm_pool
resource notifies/restarts php-fpm, not php5-fpm.
Here's the tail of the chef-client run output:
Running handlers:
[2016-01-11T21:25:01+00:00] ERROR: Running exception handlers
Running handlers complete
[2016-01-11T21:25:01+00:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 25.579421826 seconds
[2016-01-11T21:25:01+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
[2016-01-11T21:25:01+00:00] ERROR: resource template[/etc/php5/fpm/pool.d/wordpress.conf] is configured to notify resource service[php-fpm] with action restart, but service[php-fpm] cannot be found in the resource collection. template[/etc/php5/fpm/pool.d/wordpress.conf] is defined in /tmp/kitchen/cache/cookbooks/php-fpm/definitions/php_fpm_pool.rb:27:in `block in from_file'
[2016-01-11T21:25:02+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
I tried overriding the node['php']['fpm_service']
attribute to php5-fpm
(instead of php-fpm
) but Chef is not picking up the change. (Probably a separate issue.)
The README says that PHP 5.3 will be installed, but I am getting 5.5.9. Is this a bug or do we need to update the changelog and readme? If I use a Ubuntu 12.04 box I get 5.3, but on Ubuntu 14.04 I get 5.5.9.
1.8
Doesn't matter
Doesn't matter
:uninstall action should use the same logic as the install action in determining the file name
Currently to install a pool named foo.conf I would call
php_fpm_pool 'foo'
but to uninstall I would have to do
php_fpm_pool 'foo.conf' do
action :uninstall
end
Various attributes and resources fail on FreeBSD due to path, user and package name mismatches.
I choose to make PHP from source, so I can use an earlier PHP version (5.3). Make fails due to https://bugs.php.net/bug.php?id=69055
PHP suggest to use earlier version of bison. is it possible to provide an option in this recipe to install an earlier version?
you've introduced a breaking change where values placed in the PHP files no longer have quotes. This was entirely unexpected, and isn't even mentioned in your changelog.
-date.timezone="America/Los_Angeles"
-display_errors="Off"
-error_reporting="E_ALL & ~E_DEPRECATED & ~E_STRICT"
-expose_php="off"
-memcache.hash_strategy="standard"
-short_open_tag="on"
+date.timezone=America/Los_Angeles
+display_errors=Off
+error_reporting=E_ALL & ~E_DEPRECATED & ~E_STRICT
+expose_php=off
+memcache.hash_strategy=standard
+short_open_tag=on
In particular, the error_reporting doesn't handle that situation at all. This is a breaking change for most people, it needs to be clear in the documentation.
The per platform template functionality in Chef is not entirely deprecated, but hasn't been updated to support things like platform_family. By using this we're not providing platform specific templates for debian and redhat derivatives. We should do this in a different way so each platform gets the appropriate template.
Trying to update the pear channel on a virtualbox centos 7.2 box vagrant.up crashes...
probably closed #105 could be the same
php_pear_channel[pear.php.net] action update[2016-02-26T01:41:41+00:00] INFO: Processing php_pear_channel[pear.php.net] action update (streaming_base::install_owncloud_php_prerequisites line 8)
==> default:
==> default:
==> default: ================================================================================
==> default: Error executing action update
on resource 'php_pear_channel[pear.php.net]'
==> default: ================================================================================
==> default:
==> default: Errno::ENOENT
==> default: -------------
==> default: No such file or directory - pear
==> default:
==> default: Cookbook Trace:
==> default: ---------------
==> default: /vagrant/chef/cookbooks/berks/php/providers/pear_channel.rb:87:in exists?' ==> default: /vagrant/chef/cookbooks/berks/php/providers/pear_channel.rb:50:in
block in class_from_file'
==> default:
==> default: Resource Declaration:
==> default: ---------------------
==> default: # In /vagrant/chef/cookbooks/core/streaming_base/recipes/install_owncloud_php_prerequisites.rb
==> default:
==> default: 8: php_pear_channel 'pear.php.net' do
==> default: 9: action :update
==> default: 10: end
==> default: 11:
==> default:
==> default: Compiled Resource:
==> default: ------------------
==> default: # Declared in /vagrant/chef/cookbooks/core/streaming_base/recipes/install_owncloud_php_prerequisites.rb:8:in `from_file'
==> default:
==> default: php_pear_channel("pear.php.net") do
==> default: action [:update]
==> default: retries 0
==> default: retry_delay 2
==> default: default_guard_interpreter :default
==> default: declared_type :php_pear_channel
==> default: cookbook_name :streaming_base
==> default: recipe_name "install_owncloud_php_prerequisites"
==> default: channel_name "pear.php.net"
==> default: end
There is a fairly sizeable backlog of issues with this cookbook, there has been no activity in the cookbook in the past month and there are some fairly large issues that are present that warrant fixing.
I'm not sure what the process is for getting more maintainers for an official opscode cookbook is what what needs to be done to get this cookbook back on track??
I have here an example case where the the PECL extensions require some additional library dependencies. The php mongo db driver which is only present in the pecl repository currently (not in the php repository as packages). This requires the libssl-dev and pkg-config. It were nice when this library take over this extra dependency installation.
I'm trying to do load an extension that depends on another extension, but comes earlier in the alphabet. so I need to set a lower priority for my extension. I am trying to install couchbase which depends on json.
so I'd think something like this would be nice:
php_pear "couchbase" do
action :install
priority "25"
end
If no one has any other ideas, I may push this as a merge request next week, just looking to see if there is another option and feeling out if there would be push back.
I can submit a PR if this is valid - the cookbook suggests it supports Debian, but when going to enable a pear package it installed it only checks for ubuntu as the platform:
https://github.com/chef-cookbooks/php/blob/master/providers/pear.rb#L176
It's recommended that these settings be removed as they will be removed from future PHP versions
-> session.bug_compat_42
-> session.bug_compat_warn
-> register_globals
-> magic_quotes_gpc
-> magic_quotes_runtime
-> safe_mode
-> register_long_arrays
I'm new with chef, I'm getting an error to upload php cookbook. Do you guys know what I'm doing wrong.
I haven't seen any threads about this so I thought I would ask the question: Is any work being done to prepare for PHP7? I would like to try and piggy-back on work already being done before starting it myself.
There's a few spots here and there (e.g. https://github.com/chef-cookbooks/php/blob/master/providers/pear.rb#L174) that need to be fixed to support PHP7, but for the most part it seems to be just changes to attributes and packages.
Hi,
I cannot upgrade past 1.5.0 because 1.6.0 onwards have a hard dependency on mysql >= 6.0.0
which conflicts with a number of other cookbooks in my project that are pinned to the 5.x
series of the mysql cookbook.
There are significant breaking changes between the 5.x
and 6.x
series of the mysql cookbook and the maintainers strongly recommend migrating to a new physical database server instance as part of that. I'll probably do that in due course, but it doesn't seem like I should be forced to work through all of that now (and whatever changes are required to deal with updates in other cookbooks I'm using depending on mysql) just because the php::source recipe (which I'm not using) wants to install a mysql client.
I don't anyway think a mysql client is actually required for installing php from source - surely it would make more sense for this cookbook to drop the mysql requirement altogether and allow the end-user to install a mysql client themselves prior to installing php if they actually want one?
I tried purging a pear package that did not properly install because the wrong extension config directory was supplied.
php_pear 'oci8' do
action 'purge'
end
The action failed with the following relevant stack trace:
[2014-08-09T18:58:37+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2014-08-09T18:58:37+00:00] DEBUG: ArgumentError: php_pear[oci8] (oracle-instantclient::php line
ror: ArgumentError: wrong number of arguments (2 for 4)
/tmp/vagrant-chef-3/chef-solo-1/cookbooks/php/providers/pear.rb:212:in `manage_pecl_ini'
/tmp/vagrant-chef-3/chef-solo-1/cookbooks/php/providers/pear.rb:170:in `remove_package'
/tmp/vagrant-chef-3/chef-solo-1/cookbooks/php/providers/pear.rb:181:in `purge_package'
/tmp/vagrant-chef-3/chef-solo-1/cookbooks/php/providers/pear.rb:76:in `block (2 levels) in class_
Is it possible to add an option to make alldeps an optional option for the command. It installs some requirements by default, which I'd rather install with a different method sometimes.
If you install PHP from source the recipe tries to call the mysql::client recipe. In the latest version of the mysql cookbook this recipe does not exist anymore. You have to go back to an old version of the mysql cookbook to make this work again.
matchers for php_pear and php_pear_channel don't exist in the cookbook
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.