Updating the php version of the chef php cookbook - php

I am new to chef and trying to configure the php cookbook to install php 5.4.8 instead of the default php 5.3.10 on Ubuntu.
I've tried adding this setting in the attributes/default.rb file of my custom cookbook:
default['php']['version'] = '5.4.8'
but the installed version is still 5.3.10
php -v
PHP 5.3.10-1ubuntu3.4 with Suhosin-Patch (cli) (built: Sep 12 2012 19:00:43)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
How do I override the default setting for php version?
Edit:
Vagrant repo with php 5.4 based on the answer https://github.com/AlexDisler/php54-chef-env

I am new to this as well, and I did the same exact thing. I believe you need to add a package that points to the version of php you want.
Here is a recipe that you can check out.
https://github.com/homemade/chef-dotdeb
You want to add this at the top of of your run_list before you call the php recipe
ex.
If you're using vagrant (If you are not, you better go download it, it will make your life fun again) http://www.vagrantup.com
chef.add_recipe("dotdeb")
chef.add_recipe("dotdeb::php54")
chef.add_recipe("apache2")
chef.add_recipe("apache2::mod_php5")
chef.add_recipe("apache2::mod_rewrite")
chef.add_recipe("php")
I hope this helps you out.
EDIT:
I got to test this out, and it works. Goodluck!

Related

How to enable newer version of php to be default?

I'm trying to understand how to update my php version in my machine. On the CMD I tried getting the version as shown below. I believe this version was installed via XAMPP but now I have uninstalled this program. When I try to get the version again in the CMD it remains 7.2.26!
C:\Users\name>php -v
PHP 7.2.26 (cli) (built: Dec 17 2019 15:29:44) ( NTS MSVC15 (Visual C++ 2017) x64 )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
I have downloaded a new version, hoping that it would solve it (php v.7.4.8) and added it in C:\php directory (it is the only version available) but the cmd will still return version 7.2.26!
Note that when I open the C:\php\php.exe and run phpinfo(); the version is 7.4.8.
My question is how to completely remove php 7.2.26 from my machine. I cannot locate where it is installed!
Change System Path variable of your computer which still points to the directory in which old version is installed.
Goto My Computer
Right Click, choose Properties
Select Advance System Settings
Goto Advanced tab
Click Environment Variables.
Double click on Path in the System Variables list
Remove old folder location from the Variable Value field and add new location.
Save Settings by clicking OKs

Wanting to learn/run PHP Unit Tests however realised I have old version of PHP

After writing some code in PHP I want to learn the best way to run unit tests against my code. I found a couple such as PHPUnit and SimpleTest but in the documentation I could see they were talking about PHP 7.0 +.
I checked which version of PHP I was running and it looks to be a very old version:
PHP 5.6.30 (cli) (built: Oct 29 2017 20:30:32)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
However when I open my MAMP is states 7.2.10
If I were to install a newer version of PHP on my MACOS Sierra 10.12.6 would this effect the running of my old PHP code (Note I am also running MAMP Version 5.2)? Thanks in advance.

Symfony only detects lowest php version

I installed Wamp64, comes with 3 versions of php 5.6, 7.0 and 7.1
When I try to create a new symphony project I receive this error:
Could not find package symfony/skeleton with stability stable in a version > installable using your PHP version 5.6.31.
Obviously I need to activate php7 which I did, I restarted wamp services(apache ...etc) and I still get the same error. Please see attached image
Your PHP path probably points to the bad PHP version.
Try to type
php -v
If the version is not good you can change it by changing your path by typing, environment variable in your Windows search bar.
After that edit the value of the var Path and add the PHP bin folder
For me :
C:\PHP\bin\
And that's all
(Try to learn docker or install your development environment manually and use PHP built-in server to run your project, wamp is good when you start but you don't know how all work and this is bad :( )
i have same issue :
php --version
PHP 7.3.9 (cli) (built: Feb 17 2020 12:46:14) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.9, Copyright (c) 1998-2018 Zend Technologies
But symfony always output :
Could not find package symfony/website-skeleton with stability stable in a
version installable using your PHP version 5.6.30.

error upgrading php in mac

I am running OSX El Capitan (version 10.11.6).
I had php 5.5 installed.
Phpunit requires php5.6 and more so I tried to upgrade my php to 5.6. I couldn't do it so I gave php7 a try.
I followed these guides:
https://coolestguidesontheplanet.com/upgrade-php-on-osx/
https://php-osx.liip.ch/
Mac upgraded PHP to 5.6, but CLI php -v get 5.3.28?
My current output with php -v is :
PHP 7.0.12 (cli) (built: Nov 1 2016 10:21:11) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.12, Copyright (c) 1999-2016, by Zend Technologies
with Xdebug v2.4.1, Copyright (c) 2002-2016, by Derick Rethans
Funny thing, my output with a phpinfo(); when called from somewhere inside a Symfony project, is still PHP Version 5.5.36
Any ideas??
Terminal uses a different PHP than a HTTP server in browser. You can check what PHP you're using in CLI (command line interface) by this terminal command:
$ which php
I don't know if you use any AMP stack (like MAMP). They include their own PHP, so you need to update them in order to have a different PHP version in browser.
Maybe you can use this trick to determine what PHP versions you use in browser / CLI: Find the php.ini path in your phpinfo() output and compare it with this terminal command:
$ php -i | grep php.ini
It's always a good idea to use the debug URL to troubleshoot your Symfony projects; to use this, simply append:
app_dev.php
For example if your route was like http://myhome/, then you would use:
http://myhome/app_dev.php
Then on the bottom of your browser you will have the Symfony debug bar. In the bottom right corner, the version of Symofny is shown, an if you move your mouse over it, you will see the version of PHP; plus also a link to "View phpinfo()". You can click on it to view the full PHP information, including where the PHP file is located.
The PHP config file used (shown on the phpinfo() page) is shown by:
Loaded Configuration File
Hope that helps!

OSX xdebug and relation to PEAR

I have the Acquia Drupal stack 7.4.4 - which is using PHP 5.2.17 installed on an OSX 10.6.8
Drupal's PHP Stack:
User [~/]> php -v
PHP 5.2.17 (cli) (built: Jun 30 2011 12:12:11)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans
OS X's PHP Stack:
User [~/]> /usr/bin/php -v
PHP 5.3.4 (cli) (built: Dec 15 2010 12:15:07)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
As seen the Xdebug binary for PHP 5.2 downloaded from http://code.activestate.com/komodo/remotedebugging/ is correctly loaded with PHP 5.2.17 This is also verified with phpinfo.
The purpose for my questions is to reach a stage where I can compile the xdebug.so for the Acquia Drupal stack to be used with NetBeans 7.
So - which version of PEAR / PECL is the correct one to have installed on my system, the one for PHP 5.2.17 or the one for 5.3.4 - or does it not matter?
Thanks
You need a different .so for 5.2 and 5.3 as they have incompatible APIs. A "PEAR/PECL" version makes little sense as Xdebug only uses PEAR as the installer. Just make sure you have a PHP 5.2 and a PHP 5.3 Xdebug.so. The Komodo download provides both.
Great - "Xdebug only uses PEAR as the installer" - I had, with my limited experience, been wondering if those libraries were also used within xdebug/Acquia/NetBeans while actually debugging the code. So PEAR/PECL's sole pupose is now clarified, and it also remains clear that xdebug needs to be compiled for PHP 5.2 as that is the PHP version used by the Acquia 7.4.4 stack.
Now relying on Komodo binaries, without knowing how they were derived and why they do actually work, or even worse - why my own compilations does not work - that is a possible short cut and it does work for me for the time being.
but
... neither Xdebug, Drupal, Acquia or Netbeans provides an up to date description on how to compile the xdebug on a Mac for these tools used on a OS X 10.6.8 (64-bit intel). I assume a simple but up to date and clear step-by-step-guide e.g. as bullet points would benefit a lot of developers-want-to-be ... any takers?

Categories