i want to use doctrine with my mamp.
but according to doctrine's documentation it requires php version 5.2.3 or greater.
i've checked my current version in mamp with phpinfo(), it says i've got version 5.2.11.
how can i get mamp to work with doctrine? i have never upgraded php engine manually.
thanks!
What's the problem? Doctrine needs 5.2.3, you have 5.2.11.
11 > 3, isn't it?
It will work ...
I think you just confused "5.2.11" with "5.2.1.1" (which doesn't even exist).
Just start using it.
You will not use all the features of Doctrine, and not all features require PHP 5.2.3. I have done quite a lot of projects with Doctrine 1.2 and PHP 5.1.9. Sometimes small functions are missing (like spl_object_hash for example), but it's easy to replace them with custom one.
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
I have a complicated custom PHP app written for PHP5.
Can an app be modified to be compatible with both PHP5 and PHP7?
The background is that the server runs PHP5. What if it was upgraded to PHP7, could the upgrade be seamless.
Most likely yes. But only if the app doesn't use PHP7 functions or syntax (In you issue it's only that). The best way to find out is to make a second server to test it out. An example: In Magento (big PHP app, I would say), there is only one line of code that crashes the app. This is a Syntax thing. But without testing out and reading the error log, you will most likely not finding it out by pure source code reading. I port multiple websites a week from PHP5 to PHP7. Most of the time the only problem is that some apps use MySQL instead of MySQLi (talking about the PHP-Modul. Not the Databases itself)
From PHP5 to PHP7 is major version change. It would be surprise if the code worked as it is! As a starting point, you can see this http://php.net/manual/en/migration70.php
I'm trying to install zend-escaper but I'm getting this error:
This is strange as my PHP version (from phpinfo()) is 5.5.19, the message claims it is 5.3.5(!) which should satisfy the requirement anyway.
My ZF version is 1.12.13
I'm using PHP Storm
Can anyone help please?
Thanks
Tomasz
The PHP version on the command line can be a different executable than the PHP running inside the web server. It also can use a different pho.ini configuration file.
So if Composer states the PHP it is using is 5.3.5, this is correct because Composer is directly asking the PHP it is running on for its version. The problem is when this PHP version on the command line is way older then the PHP version in the web server.
Try to update your command line PHP.
Some more things to say: the version 5.3.5 is lower than the required 5.3.23, because the last number in the version is 5 compared with 23, and 5 is less than 23. So the version you are using is below the minimum requirement for zend escaper - at least in the version 2.5.1 you try to use. Such an old PHP was last supported in the 2.2 framework versions, so you might as well try to depend on ~2.2. However this will simply be a workaround for the old cli version.
One other note: You are in the process of installing a zend framework 2 component - don't expect your installed zend framework 1 to support any fancy stuff on its own. It is possible to mix classes with namespaces and without, and even use zf2 things together with zf1, but zf1 won't offer any automatic functionality to use these.
I've started a new project in which I like to used the current version of PHP (5.5.12). I compiled this version myself because the version of my distro is 5.3.
I need propel ORM so I installed it via composer.
Now, the propel-script uses this shebang:
#!/usr/bin/env php
which of course calls the main PHP (5.3) and not my self-compiled one. Unfortunately propel needs PHP >= 5.4 and I cannot execute the script without errors.
So my quick-and-dirty solution is to replace the first line in the propel-script with:
#!/opt/php-5.5.12/bin/php
which works, but is not update-safe. At least I think this could be replaced by doing a composer-update.I still need the 5.3-version for other projects, so using an alias is no solution for me.
It's maybe some petty problem, but is there a finer way to combine 3rd-party-libraries via composer with a self-compiled php executable?
I would encourage you to use vagrant and setup a virtual machine environment where php5.5 is installed. You could setup an Ubuntu 14.04 for example, it contains PHP version 5.5.
Developing on your physical machine is sooo yesterday! ;)
What are the differences between PHP 5.2.x and 5.3.x?
Because all extensions are made separately for these.
Thanks a lot.
PHP 5.3 is a newer version with a number of new features (closures, namespaces, etc.). Is is the current stable version for the PHP project. PHP 5.2 is an older version, which is now heading towards the end of its support cycle - now only important security issues are being fixed. If you start a new project, start it with PHP 5.3.
When changes in PHP core are made that change the structure enough that extensions can no longer be compatible - the second digit in the version number is incremented (5.0, 5.1, 5.2, 5.3). The first digit is for very major changes changing the whole language (like between PHP 4 and 5). Between 5.2 and 5.3, you can expect source code compatibility (though some incompatibilities exist) but not binary module compatibility.
You can find an exhaustive list of backwards incompatible changes from 5.2 to 5.3 on PHP.net.
PHP extensions depends on the phpapi version among other things, along with the Zend Module API version and the Zend Extension API version, which as far as I'm aware, changes at each PHP version because of the core changes made to the language. This explains why each PHP version has a new build for each extension.
You can find the answer in PHP official website.
In this page: Migrating from PHP 5.2.x to PHP 5.3.x.