I have to find out the earliest PHP4 version my code will run under (I already know it runs on PHP5 and on PHP 4.4.9 (the last PHP4 version -- included in MAMP).
Are there code inspection tools that will do this? Do I need to install each PHP version and see what happens :-)
There is a PEAR package in the bartlett.laurent-laville.org channel for this: PHP_CompatInfo
Find out the minimum version and the
extensions required for a piece of
code to run
Examples could be found here.
Note: The original PEAR package is for PHP4 only, and is no longer maintained.
Before you manually download and install various versions of PHP, try to download the XAMPP versions, that have the old php binaries packaged:
Download links on oldapps.com
I use (unit) tests for this purpose.
for v in $versions; do
php$v -f tests.php
done
I don't think there is a tool for that.
I guess you don't have to install all PHP version, try major releases, like 4.1, 4.2, 4.3, etc
To my mind minor releases don't have language syntax changes or anything major, usually it's bug fixes
Related
I'm working in a project with Symfony Framework, but i have problems with php 7.0. Can I downgrade the php version or I need rewrite the entire application?
Symfony 3 requires at least PHP 5.5.9, so generally speaking, you can downgrade if you want. Of course you might have other limitations, like additional bundles and libraries you have installed and you might have used PHP 7 features inside your own code.
If you want to downgrade you can run:
composer why-not php:5.6
This will tell you which libraries you installed will not work with PHP 5.6. You might be able to downgrade them, but obviously this is not guaranteed and might require changes to how you use those bundles and libraries. For this you will have to check their upgrade guides and "undo" those changes.
For checking your own code you can use tools like etsy's phan to check for compatibility with a specific target version of php: https://github.com/phan/phan#usage
libsodium WAS working fine but now I managed to break it and can't find how to unbreak it.
Amazon AWS Ubuntu Xenial, libsodium18 installed, php-sodium from Ondrej Sury PPA installed but instead of working I now get:
Undefined constant 'Sodium\CRYPTO_SECRETBOX_NONCEBYTES'
The annoying thing is it's fine in Zesty but there's no stable AWS Zesty image still. I'm sure I've just forgotten some simple thing but it's just ceased working.
Found it.
PHP sodium function names have changed so instead of calling \Sodium\crypto_secretbox_open() you now have to call sodium_crypto_secretbox_open()
I seriously hope this post helps someone avoid the grief I've had in the last 24 hours wondering what I'd *^&%'d up - it might well be the only thing on the internet actually pointing this change out that Google finds...
The revised function names and constants are all listed at https://paragonie.com/book/pecl-libsodium/read/01-quick-start.md
The project description explains the reason behind these changes: https://github.com/jedisct1/libsodium-php
There is also a polyfill that provides the old interface: https://github.com/mollie/polyfill-libsodium
However, new libsodium APIs are not available using this polyfill.
I can't maintain both versions, sorry. I wish we could have kept using the original, namespaced version.
I have freshly installed Ubuntu 12.04 and I have installed PHP as well. By default, it is installed with version 5.3.10 but my PHP project doesn't support PHP v5.3.10.
I want to downgrade PHP version to 5.2. How can I do it?
You would have to uninstall PHP and then reinstall an older version. However if your working on a project that your going to sell, or give to clients, or whatever the case my suggestion would be take out any functionality thats actually breaking between 5.2x and 5.3x and replace it with its new counter parts, as most people will not want to revert to older versions of PHP for any needs, and generally speaking php versions only goin in one direction, if you block yourself into 5.2 and your making software in one shape or another for people, what are you going to do next year when all the servers come stock with PHP 6? Not to mention a lot of hosted solutions try to provide the latest and greatest on there new machines, and will not revert for a single client especially on a shared hosting environment.
Anyway yea, back to your question again in your terminal under Ubuntu, you can try the following. sudo apt-get purge php5 which will then prompt you for a password, then proceed with removing PHP assuming you have the PHP package standalone and not bundled in with some preconfigured LAMP stack, but then again it should still work generally speaking so long as the version is right.
As for reinstalling it, remove purge from the command and use install. However you will need to look up the means of getting an archived version installed of PHP as apt-get will get you the latest
I've been using PHP version 5.2 and now need to upgrade to version 5.3 (Windows/Apache). I have been using 5.2 for awhile now and have customized many things in php.ini and added some extra extensions.
How can I upgrade to version 5.3 without having to reconfigure everything? Or does upgrading require that I customize my PHP installation all over again?
Thanks, Brian
If you take a look at Upgrading to PHP 5.3 - an easy way, i think that will solve your problem, but if you're in a Linux machine that you can use apt-get the only thing that you need to do is:
$ sudo apt-get upgrade php php-* mysql-*
$ /etc/init.d/httpd restart
Regards.
The transition is not necessarily easy, but not hard also. PHP 5.3 brings some changes to the internal Zend API, so some PHP extension need to be upgraded (I had to upgrade xDebug). That means that you need to find the respective DLLs, which may not be that easy, depending on your current setup.
The config file, php.ini, is pretty much the same. You will actually have to take some things out actually (for example extension=php_pdo.dll is not needed anymore).
Just execute php -m from command line and see what errors are thrown. I have just copy-pasted the php.ini file from a 5.2 release and was done configuring 5.3 in a couple of minutes.
I mentioned xDebug a few lines above. If you use it, you should know that the line which activates xDebug is now:
zend_extension = "path\to\PHP 5.3.0\ext\php_xdebug.dll"
instead of:
zend_extension_ts = "path\to\PHP 5.3.0\ext\php_xdebug.dll"
The main thing I've run into is a mess of new E_DEPRECATED notices when doing anything from PEAR. Like the other comments, you'll want to adjust your error reporting levels appropriately.
Another thing to notice is that if you're upgrading from a package management system like macports or apt, some of the config layouts have changed and you'll have to adapt there.
Other than that, there aren't a lot of functional differences between 5.2 and 5.3.
Is there a .dll version of the inclued extension for PHP?
The manual's link for Inclued on PECL4WIN doesn't help. I don't have a compiler to build my own DLL.
NOTE: The spelling "inclued" is correct!
Edit: I don't have a compiler, but do know someone with one... that's really a last resort though.
As best as I can tell, the Windows version doesn't exist anymore. Maybe whoever was maintaining it before had to stop for some reason.
I wonder what it takes to compile a PECL extension under Windows.
Edit
Here's some info on compiling a different PECL extension on Windows. You may be able to extrapolate to the inclued extension.
Edit
WAMP Server comes with PECL & PEAR. I can actually run the command pecl install inclued-alpha from the Windows command-line and it goes out and tries to grab the inclued extension from the PECL site.
Unfortunately it dies when it unpacks the .tgz file and tries to compile it
ERROR: The DSP inclued.dsp does not exist.
Which version of PHP are you running? I know someone that can compile you a version.
update
Alright, got this compiled - I've tested on my 5.2.6 build and it seems to work fine.
I've been told there may be problems using it in a threaded environment (e.g. Windows) but that's only a maybe. Also:
[13:10] <g0pz> the inclued dumpfiles will collide, because it uses PID # + increments
[13:11] <g0pz> but command line should work ok
[13:12] <g0pz> is the threaded apache version which'll have the same PID and well, a "possible" collision
So good luck with it :)
download
Poke me if you have any issues with inclued.
I'm just on the verge of putting out a release, I'll do a mkstemp() in windows instead of picking the PID + count.
Hopefully also with a gensvg.php which'll render the di-graph in-browser with pear::Image::GraphViz.
Isn't this their DLL download site? http://pecl4win.php.net/list_dlls.php
Unless I'm off on my browsing of the site?
Is this the page you are looking for?
http://pecl4win.php.net/list_dlls.php
..edit: (man, we are fast. I swear these two duplicate answers were posted simultaniously)
The official PHP for Windows site says:
PECL For Windows
PECL extensions for Windows is being worked on. The interface on the
pecl website will most likely be updated to offer Windows DLL download
right from that website. In the meantime, some extensions can be found
here.
That "here" link leads to http://downloads.php.net/pierre/, where you will find, among the multitude of other extensions, builds of inclued for PHP 5.2 and 5.3, VC6 and VC9, thread-safe and non-thread-safe. The one matching my version of PHP seems to be working.