ezSQL compiling issue on PHP V7 - php

I've been developing my PHP Apps based on ezSQL class since 2000s. Unfortunately, I have depended on this class ever since. It was fine until I realized that this class isn't valid for servers running PHP 7+. When I run my App on servers running PHP 5.6 and below it works fine. Any other version above PHP 5.6 would give me this error:
Fatal Error: ezSQL_mysql requires mySQL Lib to be compiled and or linked in to the PHP engine
Unfortunately, the one who did this great class isn't working on it anymore since a long time. Is there any way around to fix this?

You are probably using the old ezSQL class, it uses libmysqlclient. PHP 7 no longer uses libmysqlclient, leaving the old version of ezSQL useless. Upgrade to the new version of ezSQL or access this project that updated the old class adapted for MySQLi.

Related

Why is twig_template_get_attributes() throwing a fatal error?

I have twig installed via composer on a new codebase I'm working on (OSX), and on a new server I was trying install my app on. I started getting a fatal error on twig_template_get_attributes()
namely
PHP Fatal error: Call to undefined function twig_template_get_attributes() in /<path_to_here>/templates_c/a2/4e/3fbd69b54a0875d7cd3744d62bf1fa98ed4e7b1b375f904ead10b7cb27b6.php
I don't have this problem locally (OSX), and I was trying figure out why this is happening on my other server (Ubuntu 12.04 if that matters). When I install twig as a PHP extension the problem goes away, but my understanding is that the extension is completely optional and only optimizes one call
as per the documentation
The C extension is optional but it brings some nice performance
improvements. Note that the extension is not a replacement for the PHP
code; it only implements a small part of the PHP code to improve the
performance at runtime; you must still install the regular PHP code.
and
And from now on, Twig will automatically compile your templates to
take advantage of the C extension. Note that this extension does not
replace the PHP code but only provides an optimized version of the
Twig_Template::getAttribute() method.
very confused about this behavior.

Can a PHP app be compatible to PHP5 and PHP7 at the same time?

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

Which PHP Version To Use While Migrating from 5.3?

I am working on a project which is in php 5.3+. I need to create a separate Api which is to be deployed on same server for which i am using the Symfony2.
As i need to deploy new api on same server i want to use php 5.5+ version Now i need to upgrade my old project to new version of php and mysql as the server currently is on 5,3+. I tried the php 5.4+ and mysql 5.5+ on my local system the project works fine, but when i switched to php 5.5+ it shows me error that states mysql_connect is Deprecated.
I checked on several sites and came across a solution where i can skip the deprecated message on php 5.5 + via doing some ini settings.
Now my main concern is whether is it a right solution to migrate to php5.5+ and start new feature development out there As i need to use 5.5+ so that i wont face same deprecated issue with any other thing in future in new Apior should i migrate to 5.4+.
Kindly Reply
Upgrade to the latest 5.x branch. Do not upgrade to 7.
A new major version, means that backwards compatibility is broken. You can expected that some deprecated features are dropped. In general upgrading to a new mayor PHP version requires you to upgrade your code base.
When upgrading to a new minor version, you can expect your application to keep working. Typically new functionality is added and some functionality is deprecated, but nothing is removed.
Deprecation is a notification to indicate that functionality might be removed in an upcoming version.
The notifications are meant for you as developer, to know what you need to change to make your code ready for upgrading new major version.
On the production environment you should disable these notifications through error_reporting.
The deprecation notifications should not keep you from upgrading to a new minor version. Without this upgrade it's difficult to know what to change to make your software up to date.
Conclusion: Update to PHP 5.6. Than, when you're ready and have time, change / update your code so you're not using deprecated features. When that's done, you can upgrade to PHP 7.
The question I would ask myself if I were you is how long I would want to maintain a code base with deprecated features... my suggestion is to migrate to PHP 7 (or 5.6 minimum), upgrade projects and start new feature developments... will pay better on the long run.
The short answer is "Move to PHP 5.6 now; then move to PHP 7 later, once you've dealt (or as part of the exercise of dealing with) with all the issues that would break your code in PHP 7.
The changes from PHP 5.3 to 5.6 are not really that big. The really big changes happened between 5.2 and 5.3, but if you're on 5.3 already then you've already dealt with that. Moving up to 5.6 from there is virtually seamless.
Yes, there are some backward-compatibility breaks between every version, and yes, you must read the upgrade notes for each version before you start, but in truth, 5.4, 5.5 and 5.6 were more about adding features and increasing performance than they were about breaking things.
You specifically mention the mysql extension being deprecated in 5.5. This is true, and you will get warnings. Note, however, that these functions will still work in 5.5 and 5.6. The deprecation warning is telling you that they are considered obsolete and will be removed in the future. This has now happened in 7.0. These warnings are basically there to give you fair warning; to give you time to change your code before the next upgrade cycle. Your code will still work for now if you ignore the warnings, but you should start work immediately to fix the problem.
Fixing the problem, in the case of the mysql extension, means replacing your database code so that it uses either the mysqli or PDO extensions.
The mysqli exension is basically a drop-in replacement for the old mysql extension. There are some changes (it adds an OO interface if you want to use it, and it doesn't use a single global connection object as the old library did, so you need to pass the connection object into every call), but it's generally fairly easy to convert from one to the other.
PDO is a more advanced database library which can support a range of different database types including Mysql. It is quite different to the old extension, so converting is a more complex process. But if you can use this one, it's generally considered the preferred option.

Symfony 1.4.18 and PHP 5.4 compatibility

Is the latest Symfony version (1.14.18) supposed to run properly with PHP 5.4?
I've just upgraded to PHP 5.4 locally and multiple sites that have previously worked fine are now throwing the following error when trying to load any page:
Fatal error: Call to undefined method sfCoreAutoload::register() in C:\dev\projects\my_site\config\ProjectConfiguration.class.php on line 4
The path to the sfCoreAutoload class is fine but for some reason it treats it as if it didn't exist at all.
I managed to resolve the issue so will just answer here for the benefit of anyone else facing the same. The culprit was APC. The latest "stable" version of the pre-compiled APC (3.1.9) didn't work with Symfony 1.4.18 + PHP 5.4.4, but using the APC beta (3.1.12) does work.

doctrine with mamp?

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.

Categories