Getting PHP 8 errors even though not using PHP 8 - php

a few weeks back I setup PHP 8 but hit some issues in projects so reverted back to 7.4.
However, a few of my projects are broken and the errors I'm getting all seem linked to PHP 8.
An example is "Fatal error: Uncaught ArgumentCountError: array_merge()"
This is on a WordPress project that even with default theme and database from production is still throwing this issue when it wasn't before.
Running which php and php -v are both stating 7.4 as the PHP version.
Just checked and the phpinfo() page is still PHP 8.
Anything else I need to that might be causing this drama? I'm using Laravel Valet...

Might be useful to someone...
Turns out that Laravel Valet was caching it's .sock file...
rm ~/.config/valet/valet.sock
valet start
Did the job for me.

Related

phpMyAdmin (MAMP): Error while working with template cache: Unable to write in the cache directory

First post! I am working on a client site, trying to get their website going on a local Apache server on my Mac using MAMP. Am jumping thru hoops and this one has me stumped. I've imported the site, created the database and am trying to connect to it thru phpAdmin. I can get into the initial DB structure screen just fine, but when i click on the desired database, i get the following error:
"Error in processing request. Error code 500. Error text: Internal Server error (rejected). It seems the connection to your server has been lost. Please check your network and server statistics".
I also get an error on the lower part of the screen:
"Error while working with template cache: Unable to write in the cache directory (/Applications/MAMP/tmp/phpMyAdmin/twig/3f)."
I checked the apache_error.log and mysql_error_log.err and they are both clean. However, the php_error.log shows the issues:
"[16-Jul-2021 07:58:22 Europe/Berlin] PHP Fatal error: Uncaught exception 'RuntimeException' with message 'Unable to write in the cache directory (/Applications/MAMP/tmp/phpMyAdmin/twig/3f).' in /Applications/MAMP/bin/phpMyAdmin/vendor/twig/twig/src/Cache/FilesystemCache.php:61"
(and there's a stack trace that i can paste in if necessary....)
I've done some fairly extensive research and two things are suggested.
(1) the most common theory is that it is a permissions issue. I've checked and given read/write privs to the world thru the whole chain of directories in the path listed above (/Applications/MAMP/tmp/phpMyAdmin/twig/*). This does not solve the problem.
(2) it is recommended to download a more recent version of phpMyAdmin (just upgrade to the latest and greatest and all will be well!). I also did this, followed the instructions and got the error saying that i needed to be on php version 7.1.3 or later. As near as i can tell, there is no other option between my version (4.9.7) and the next (and current one) 5.1.1. So that didn't work for me either.
I'm currently at php version 5.6.40 on this client site and upgrading is a no-go for me (at least right now).
My environment is:
MAMP 6.3
PHP 5.6.40
MySql 5.7
phpMyAdmin version: 4.9.7 (the upgrade that i attempted above was to version 5.1).
I've been unable to find any other options. Can anyone help me out? I'm relatively new to PHP, but a pretty experienced software developer overall.

Laravel 5.5 and PHP incompatibility

I was trying to setup a Laravel project in a server which I don't have ssh access, just cPanel access, so I came in with the problem that it seems that the server is not recognizing the right PHP version, Laravel's version I was trying to setup is 5.5. phpinfo() outputs version 7.0.22.
Inside cPanel there's a module called "PHP configuration" and it is set to version 7.
How can I solve this problem, I really want to use Laravel 5.5 or above, it is worth mentioning that I don't have contact with the server owner, I'm limited just to cPanel.
It is throwing the following error:
Parse error: syntax error, unexpected '?', expecting variable in /vendor/symfony/translation/Translator.php line 79
which is
public function __construct(?string $locale, ...
That is how I know it is not recognizing the right php version.
EDIT:
Just to clear out, I just thought that was the problem because I have had already that issue sometime in the past and read similar posts, but if that's not the case, I would appreciate that to be pointed out and not just silly jokes like "a bird flew", maybe other people are in the same problem and think of the same reason and this question could be useful to them.
So it turned out that the server's PHP version had nothing to do with the problem, the thing was, since I had no access to SSH, I had to install Laravel in my local computer, then copy all the files and put them inside the server, but my computer had PHP 7.1 and although Laravel's version was really version 5.5, some features of PHP 7.1 were applied on that Laravel installation.
So the solution was just to install Laravel 5.5 within a PHP 7.0.* installation in order to make it work in a server with PHP 7.0.22
Related GitHub issue ~ https://github.com/laravel/framework/issues/23559

PHP Fatal error: Uncaught Error: Cannot access property started with '\\0'

So I'm using Timber v0.22.5. I have it currently running on my local and a dev environment right now. Everything is running great no issues. Both environments are running PHP 5.5.9.
I just migrated it to my production server which is running PHP 7.0. I am now getting the following error from Timber.
Fatal error: Uncaught Error: Cannot access property started with '\0'
in
/var/www/html/wp-content/plugins/timber-library/lib/timber-core.php:67
I'm not sure what exactly else is different between the environments other than different versions of PHP. I cannot update to Timber v1 because well the guide seems to suggest not doing that because of some backwards compatibility issues.
I'm going to try installing PHP 5.5.9 and see if that does the trick but was wondering if anyone else was having this issue.
Thanks!
This is an issue with Timber 0.* and PHP 7. You should be able to fix it by replacing Timber/Core::import with the current version:
https://github.com/timber/timber/blob/master/lib/Core.php#L59-L75
This will be happened if you use the latest version of "Better Search and Replace" plugin too. You should be able to fix by trimming the key:
https://github.com/deliciousbrains/better-search-replace/issues/71

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.

RHEL 6, PHP 5.3.3, symfony 1.4.[12] -> irregular PHP Fatal error: Class 'sfProjectConfiguration' not found in

i deploy a symfony 1.4 project on a RHEL 6 Server with PHP 5.3.3.
On a irregular basis I get entries in the php error log complaining that sfProjectConfiguration could not be found and the request fails. The same request then runs smoothly the next time.
There is no memcache or apc installed.
On other machines it works flawless.
Any ideas how to solve or investigate the problem?
Sometimes i have an fimiliar error in frontend/backend_dev. Does the error occur when you use on of them? It happens to me when I "hammer" the F5-Button. Could be a cache-rebuilding problem.

Categories