How guess php version by static analysis of code - php

How to "guess" php version by looking at code?
Suppose you're handed a zip file containing php code for an application.
Are there any telltale signs about which version (5.x, 7.1, 7.3,etc )
the original author was working with?
My issue is, I suspect I'm running an incorrect php version for my (phalcon) application, my users can't log in. I see in logs
"PHP Warning: Use of undefined constant success - assumed 'success' (this will throw an Error in a future version of PHP)"
and
Uncaught Error: Class 'View' not found in ....

In general, this is not possible. You can inspect the set of features the original author used and try to identify a minimal version. When you find removed features you can also find a maximum version.
According to your warning message I assume you are using PHP 7.2 right now?!
The author probably developed this with a lower version (5.x) or has disabled warnings.
Maybe have a look here for more info about your warning message.
However, the warnings and errors you get are not really version related but seem to result from missing files and / or bad programming.
You should try to make it work with Version 7.2+ instead of choosing the version matching the developers version. Have a look at PHP versions here.

Related

PHP file is deprecated?

On my server, the following error is listed several times per day.
Can anybody tells me what it means and about what file it is reporting?
[11-Apr-2021 21:01:59 America/Boise] PHP Deprecated: Directive 'allow_url_include' is deprecated in Unknown on line 0.
TIA
This is the result of websites on the server using code that makes use of the allow_url_include function. This function was deprecated in PHP 7.4.
This notice is just a warning and not a fatal PHP error. Site functionality should resume as normal.
Downgrade the site's version of PHP.
Work with your website developer or system administrator to update or rewrite the code of any sites producing the warnings.
Disable deprecation warnings (See: https://support.cpanel.net/hc/en-us/articles/360059474934)
As far as I know, if you have updated your PHP version, checking that everything in your .htaccess is also up to date may fix the problem. Otherwise, updating the PHP version might help.
Note that WP Engine has decided to deprecate the .htaccess file for all customers on future versions of PHP. The latest PHP version, PHP 7.4, and any subsequent versions will no longer support .htaccess.
ref: https://wpengine.com/support/htaccess-deprecation/

Typo3 PHP Runtime Notice

I inherited a Typo3 site to maintain and have had no trouble until now. When I try login I get this error message:
Oops, an error occured!
PHP Runtime Notice: Declaration of t3lib_userAuthGroup::checkLogFailures() should be compatible with t3lib_userAuth::checkLogFailures() in /home3/onefoug3/public_html/t3lib/class.t3lib_userauthgroup.php line 113
I checked with my hosting service and they say it is an error with the script. I am not a programmer so I do not know how to fix that...not even sure where to start. How do I fix this?
To give you an overview about the situation with your TYPO3 installation I list a few points, some of them where you've to verify more:
TYPO3 in your installation is very old and outdated. You'll get perhaps many hints to update due to security-reasons. This is not wrong but I'd concentrate first on getting it running, perhaps better on a local server.
The Version of your TYPO3 installation is in any case very useful, you should try to provide it.
It's possible that you need an old PHP version to run that site and that the error is just thrown because of a wrong PHP Version. You could try with PHP 5.2.
It's not improbable that something in the TYPO3 core was changed manually. It might be patches or individual but in many versions I never found the mentioned methods in the line 113 like shown in the error-message.
Rarely I changed in the core somethings too, to circumvent some temporary problems, usually that's neither required nor advisable. Nevertheless if it helps you to get the installation locally running - why not.
The more advised step is to download the current version new and replace the existing core with that. Often you can chose the most recent minor version: assume you've Version 4.7.18, then you can download Version 4.7.20 or newer if available.
The link to get the newest Version of that old branch would be https://get.typo3.org/4.7
Better keep the old core till the problem is solved, even if you replace it.
If you follow my hint to get a higher minor version you should have a look in the install-tool, specifically in the update-wizard there.
I'd advise to update the question to include the Versions of TYPO3, PHP and MySQL, then perhaps it will be easier to help more.
As target I see to get the installation locally running and performing an update instead of serving the old site with insecure core. Based on that I answered in point 5 too, on a live-system it's not advisable especially with your limited knowledge.

TYPO3 PHP Runtime Deprecation Notice:

i have a problem with some old TYPO3 stuff, i tried to make a old TYPO3 Website run on my Ubuntu system.
And sorry if somethings are not clear to understand for me, i am new in CMS's and i am forced to change some stuff on a old page.
Problems are:
1.
Backend seems working, half. If i enable the ext. TemplaVoila my be Page module shows me a white page.
On TV disable,
Page module, seems working but it gives me some strange error messages inside the content fields.
if i try to look at the front-end it gives me this exception:
1: PHP Runtime Deprecation Notice: Non-static method tx_ttnews_div::getSubCategories() should not be called statically,
assuming $this from incompatible context in
/var/www/projectfolder/projectfolder-typo3/typo3conf/ext/tt_news/pi/class.tx_ttnews.php
line 3740
Just apart from this, i read about a removed php feature in update 5.6 i was using currently.
Things i checked already:
-Correct PHP -v
-Database import correct
-LocalConf correct (took from live server and changed for my localhost)
-Checked install-tool and rm -rf * inside typo3temp folder
Thanks for you help
Your PHP version combined with the versions of TYPO3 and extensions seems to be incompatible. You either need to use a different PHP version or upgrade TYPO3 and/or the extensions being used. FYI, the method being called is from a very old extension so although you don't say which version you're using, I assume your TYPO3 version is very old (either 6.x or even 4.x versions).
The normal recommendation would be to upgrade TYPO3 and any extensions. The less recommended alternative would be to use a different PHP version. But please be aware that remaining on older TYPO3 versions means your site may not be patched for security issues and may not be compatible with modern browsers.

Undefined hw_who()?

Hi i found this function hw_who() which says to Gets the list of currently logged in users.
however when i want to use it like that:
print_r(hw_who());
i get this error message
Fatal error: Call to undefined function hw_who() in ...
I have looked every where but it seems no post or how to use it.
anyhelp thanks !
EDIT:
my php version is : PHP Version 5.4.26
From the PHP manual:
This extension is considered unmaintained and dead. However, the
source code for this extension is still available within PECL SVN
here: » http://svn.php.net/viewvc/pecl/hyperwave.
This extension has been moved to the » PECL repository and is no
longer bundled with PHP as of PHP 5.0.0
So either you've installed it incorrectly via PECL, or you just haven't considered that.
My advice: Tackle your issue at hand differently.

Matching proxyauth.so version to PHP Zend API version

This is the error every time I start up php:
Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20100525/proxyauth.so' - dlopen(/usr/lib/php/extensions/no-debug-non-zts-20100525/proxyauth.so, 9)
I have two older versions of the proxyauth.so in no-debug-non-zts-20060613 and no-debug-non-zts-20090626, but neither is compatible with a module API compatible with 20100525, so symlinking doesn't solve the problem.
I've Googled my best and have no idea where proxyauth comes from, and therefore can't make a new one with the compatible API. There doesn't appear to be an extension in the php ext directory, so I have no idea what to do next.
Thoughts?
Thanks,
Bill
If the warning is the only problem - meaning your code itself runs fine - then the extension isn't required anymore by your application. Why not out-commenting the extension=proxyauth.so?

Categories