PHP file is deprecated? - php

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/

Related

Why am I obtaining these warning messages into the page of an old Joomla website?

I am not so into PHP and I have the following problem.
I reinstalled an old Joomla website (it is an old version of the CMS that I have to upgrade) on my local server (XAMPP).
The problem is that now I obtain some warning message like this into the pages:
Strict Standards: Only variables should be assigned by reference in C:\xampp\htdocs\erusma\plugins\content\embed_google_docs_viewer\embed_google_docs_viewer.php on line 61
The website works fine but somewhere I have these warning. I think that maybe is something related to the PHP log settings or something like this.
What can I do to avoid these links? (I can't change the code)
Here are a few options (listed in increasing level of difficulty):
Ignore the warning messages as they are likely doing no harm especially on local host.
Suppress the warning messages via the appropriate option in Joomla Global Configuration and/or directives in php.ini or .htaccess files.
Downgrade PHP to an earlier version.
Upgrade Joomla / third party extensions to later versions.
Fix the code.

Errors with UwAmp PHP 7

I get errors with some WordPress themes (Layers and Dynamic Website Builder) when using UwAmp and versions of PHP 7. With Layers there is an error about an empty category array and with Dynamic Website Builder, the admin pages cannot be reached (connection reset).
I have UwAmp 3.1 and have tried PHP 7.0.3 and PHP 7.1.1. There are no errors with PHP 5.6.18.
I installed the Visual Studio redistributable when I installed UwAmp. At first, I thought it was a problem with the Themes and maybe PHP 7.1.1, but I tried PHP 7.0.7 using the Uniform Server and those themes worked fine. That lead me to conclude it is more likely related to UwAmp.
There are no related errors in the Apache log and even though logging is enabled for PHP and I specified a log file in the INI file, there are no PHP error logs. I have not enabled or disabled any PHP extensions.
I suspect it may be something missing from the UwAmp versions of PHP 7.x. Any ideas?
Thanks.
So it is not an issue with UwAmp. I found that there was a change with PHP 7.1 where empty string arrays must be initialized. Previously PHP would handle it automagically. You can see a discussion of it here: https://github.com/spotweb/spotweb/issues/243

PHP "failed to open stream" after migration from one server to another, others are Deprecated, why?

I migrated a PHP website running ob ubuntu 10.10 server to another unbutu 12.04 server.
Now some php functions are Deprecated and some can't find the right "path" they are looking for.
The old server was running php 5.3.3 the new one has php 5.3.10 (so no real big difference)
Some links were written like this :
"../modules/xxx.php"
and I just changed the name to the fullpath and it is working.
Due to the fact, that the website is fully working on the old server, the configuration should be "ok". Do you guys think there is any other reason for this errors than the version of php ?
I think about downgrading php to 5.3.3 on the new server for the test....
But I wont do it, when there might be other reasons.
Some error examples :
Deprecated: Function split() is deprecated in /data/
Warning: include(modules/mdl_users/settings.conf.php): failed to open stream: No such file or directory in /data/xxx/www/classes/module.class.php on line 35
he can't open the files when one part of the path was written by a function like this
include($this->registry->admin_path."modules/".$this->name."/settings.conf.php"
so obviously the configuration in php has been changed somehow. since the website is not mine, I don't want to change 100 paths manually. Do you think downgrading will "repair" this issue?
Thanks in advance
It sounds to me that the php.ini file just has different options selected on the new server. For instance, you can hide the deprecated warnings in the errors section of php.ini.
If those warnings were set to be hidden on your old server, and set to be displayed on your new server then this is why you are seeing them all of a sudden.
I doubly very much the minor version upgrade of PHP will be a problem. It's still 5.3 after all. The PHP config is almost certainly the cause of the issues.
The best thing to do would be to do a file compare from both the old and new php.ini files if you have access.
Alternatively, you can set most php.ini options at runtime in your code if you need to.
split() function has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged.
preg_split() is the suggested alternative to this function.
If you don't require the power of regular expressions, it is faster to use explode().

Old php site not working on new IIS server, need to use GD library but can't figure it out

I have been developing our php based site on a development box that was set up when i started my new job a few months ago. I have just got a new dev box and am having some real trouble getting my IIS server to work with the site.
I am running windows 7 64bit and IIS7.
I get this error when trying to load the site:
Fatal error: Call to undefined function imagecreatefromgif() in filepath:// line:#
I have done some searching around and found that this particular function is part of the GD library and that i needed to enable it in the php.ini file. most sites were saying that i needed to uncomment this line extension=php_gd2.dll but it wasn't there, so i added it. I took the php_gd2.dll file from the old test box and put it in the folder specified as so
extension_dir ="C:\Program Files (x86)\PHP\v5.2\ext"
I should point out that I am using php5.2 by necessity, we use a library called ezpdf to create pdfs and it contains hundreds of references to magic_quotes_runtime the old dev box was actually running php5.0 but i couldnt find anything earlier than 5.2, and as far as i can tell the magic quotes things should be an issue before php5.3.
Anyway, using the php manager in IIS7, i can see that php_gd2.dll is enabled, however if i look at phpinfo() i can see no reference to GD.
No matter what i try i get the same error, does anyone have any ideas!?
GD isn't JUST the .dll you load into php. there's a fair chunk of other code in other libraries that the php .dll references. You'll need the entire GD setup for it to work in IIS, not just the one php_gd.dll.
References to magic_quotes_runtime by themselves aren't 'bad' - a lot of libraries have to handle running under older PHP versions where magic_quotes is enabled by default, and do appropriate compensation for that fact. If ezpdf is, however, recreated magic_quotes behavior, then it's definitely time to upgrade versions or switching to something better. magic_quotes is deprecated for a reason, and re-enabling it in any way/shape/form is a bad idea.

Is PHP 5.3 backwards-compatible with PHP 5.2?

I'm starting to learn PHP. I would like to use PHP 5.3 because it's the newest version so far. I'm working on a project in which I'll use PHP 5.2 scripts that someone gave me.
Are they going to run just fine even though I'm using PHP 5.3?
PHP.net features a guide for upgrading from PHP 5.2.x to PHP 5.3. This includes a section on backwards compatibility.
From my experience, the transition from 5.2 to 5.3 went pretty smoothly smoothly. The only problems I had with my app was to ensure my DateTime setting were property configured in my php.ini, and filter out some overly-agressive deprecation warnings that started showing up.
No, 5.3 is not backward compatible, and by all means it shouldn't be seen as a minor version upgrade.
There is a page dedicated to incompatible changes: http://www.php.net/manual/en/migration53.incompatible.php
Also consider functions you have designed but have been accepted into 5.3. Since php doesn't support overloading or overwriting of functions, this will give an error.
For the most part, minor version releases aren't going to cause you problems. You should be okay.
Obviously, if you do have any problems, you'll want to make sure you have error_reporting set to see all errors. PHP: error_reporting
Also, check the manual for changes in 5.3 from 5.2: Migrating from PHP 5.2.x to PHP 5.3.x
There are some minor issues. Call time pass by reference are deprecated. There are new reserved words (ie. goto).
php has no backward compatibility in all version. It often removed some functions when it changed version. The problem occurs when you have to upgrade server and need to change php version but some php scripts no longer work with new php version. You also have to correct php script which is a bigger job. But if the script belong to other users rather than yours, you can't upgrade those scripts. This is a real headache situation that I'm fed up with php and switch to perl instead for backward compatibility reason.

Categories