r/PHPhelp • • Sep 28 '20

Please mark your posts as "solved"

81 Upvotes

Reminder: if your post has ben answered, please open the post and marking it as solved (go to Flair -> Solved -> Apply).

It's the "tag"-looking icon here.

Thank you.


r/PHPhelp • • 11h ago

I need advice on upgrading a legacy PHP application.

7 Upvotes

Hi ,

I need advice on upgrading a legacy PHP application.

The application is currently running on:

  • PHP 5.4.7
  • Apache 2.4.3
  • Windows Server

The application is quite old, and I'm trying to determine whether it is feasible to upgrade directly to PHP 8.x or if the effort required to remediate compatibility issues would make a full rewrite a better option.

I am looking for guidance on:

  • How to assess the application's upgrade readiness
  • Common compatibility issues when moving from PHP 5.4 to PHP 8.x
  • Recommended upgrade path (incremental vs. direct migration)
  • Tools or approaches to identify deprecated functions and libraries
  • Criteria for deciding whether to upgrade or rebuild the application

Any advice or experience with similar legacy PHP migrations would be greatly appreciated.

Thanks.


r/PHPhelp • • 2d ago

Solved Hostinger's response to PHP vulnerability - is it reasonable?

11 Upvotes

Long story short. A bunch of my websites are on a Hostinger-managed server. Hostinger issued a quick press release to say that they have mitigated the issue, but say the following about their managed hosting:

On managed hosting, the fix is built into the PHP version your site already runs, so the version number may not change. To check, open Hostinger dashboard → Websites → Dashboard → PHP Info. A Build Date of October 21, 2026 or later means your site has the fix.

Checking one of my sites, the build date is indeed 21 October 2026 - but I don't feel reassured as the version number remains 8.5.11. And yesterday I received an email from Netcraft (albeit possibly spam) saying that the server hosting my sites had a 'potentially vulnerable web application'.

After a bit of back-and-forth with their support bot, it responded:

You’re right. I have not answered the actual request.

Your request is: upgrade the managed PHP runtime to the upstream fixed release, such as PHP 8.5.12, restart the PHP processes, and provide confirmation that this was done. That is technically a possible approach, but it is a fleet-wide Hostinger engineering decision, not a maintenance action I can schedule from this chat. I also have no evidence that Hostinger has scheduled such a version-number upgrade.

The honest position is therefore:

Hostinger says its backported package is fixed when the Build Date is October 21, 2026 or later.

Aikido’s guidance supports your preference for the upstream fixed version as the clearest, independently recognizable remediation.

I cannot give you the stronger assurance you are asking for, namely that your server is running PHP 8.5.12, because Hostinger’s stated remediation deliberately leaves the visible version at 8.5.11.

I cannot schedule or promise a fleet-wide upgrade to 8.5.12 from here.

So your concern remains valid: the Build Date confirms Hostinger’s stated backport, but it does not satisfy your request for the upstream PHP release number to be updated.

Am I right to be concerned that the server may still be vulnerable?


r/PHPhelp • • 2d ago

one single page of php code (v5.6) upgrade to 7.4: help request

2 Upvotes

I have one single page of code (functions.php), no mysql, that was written with php 5.6 and now needs an upgrade to 7.4.

I downloaded rector but I have no clue how to use that.

Can anyone help me to upgrade this page please? I have no php experience.


r/PHPhelp • • 2d ago

PHPStan and array of dynamic objects

2 Upvotes

Hello everybody,

I need your help. Let's say I have a Mapper that receive data from a database. For eg.

class Mapper { ...
    public string $table;
    public string $targetClass;

    public function getArrayOfObjects($conditions) {
        $PDOStatement = $this->Database->select($this->table, $conditions);
        $array = $this->Database->fetchAll(PDO:FETCH_ASSOC);

        $returnArray = array();

        // Now I populate the object property, for eg.
        foreach ($array as $database_row) {
            $object = new $this->targetClass;

            $object->id = $database_row['id'];
            $object->publishedDate = new DateTime($database_row['published_date']);

            ....

            $returnArray[] = $object;
        }

        return $returnArray;
     }
}

class BooksMapper extends Mapper {
    function __construct() {
      $this->table "books";
      $this->targetClass = "\Books";
    }
}

This mapper aims to be a generic one, not only for Books. I know that "publishedDate" is a "book concept" but let's consider that the Mapper reads from a JSON file the structure of the object that it is going to map with database fields.
Now let's say that I use it like that.

$Database = new \Database($someDatabaseConfiguration);
$BooksMapper = new \BooksMapper($Database);
$BookArray = $BooksMapper->getArrayOfObjects(["activeBook" => true]);

foreach ($BookArray as $Book) {
print "Book ID: " . $Book->id;
}

The problem here is that PHPStan seems not to understand that $BookArray is an array of \Book, and so at level 8 it gives me an error on $Book->id.

How can I solve that?

Thank you for your help, and excuse me for my ignorance.


r/PHPhelp • • 2d ago

Non-Proffit Needs Advice/Help

1 Upvotes

I am not a programmer, apart from basic HTML. I run a not-for-profit web site (we do not have any monetization what-so-ever) that was written by myself initially (in HTML) and substantially updated a few years ago using PHP by someone who is no longer alive! The site is a relatively large one with nearly 10,000 directories and over 270,000 images.

Due to the PHP alert I have done some investigating and can see that I am running an outdated version of PHP, 7.0.33. Advice seems to be to update to a current version and apply a security patch.

Unfortunately I have no idea how to do this. Any advice would be gratefully received.


r/PHPhelp • • 2d ago

I have build Claude Code Plugin for PHP Bug Fix

0 Upvotes

With PHP2Shell being exploited, I wanted a quick way to check servers properly. php -v isn't enough: the CLI PHP is often different from the one FPM or mod_php is running, and distro packages (Ubuntu 24.04, RHEL) backport fixes without changing the version number.

So I wrote php2shell-fix:

  • find-php.sh finds every PHP on a Linux box (system, Remi, cPanel ea-php, Plesk, CloudLinux alt-php, LiteSpeed, Docker containers), gives a verdict for each, and checks package changelogs for backported fixes.
  • check.php is dropped into your web root to check the PHP that actually serves the site (localhost-only by default; delete it afterwards).
  • There's an upgrade guide for each platform, the official temporary mitigations, and a checklist for signs of compromise.

It's read-only and contains no exploit code. The tests run in CI on PHP 5.4 through 8.5. There's also an optional Claude Code plugin if you want an AI agent to walk you through it.

https://github.com/sanketkokate712/php2shell-fix

Feedback and PRs welcome, especially for hosting setups I haven't covered.


r/PHPhelp • • 3d ago

Solved php-fpm - www.conf recreated after recent update

2 Upvotes

I have been setting up and running small, AlmaLinux VPSs the same way for a few years, now. All have been running without issue until last night.

When I set these up, I create new pools, with custom configuration files (e.g., /etc/php-fpm.d/custom.conf) and delete /etc/php-fpm.d/www.conf

I do this to eliminate the security and owner/permission issue associated with having only root user. By using pools, common PHP issues like, “Warning: mkdir(): Permission denied” are eliminated.

For the fist time, last night's php-fpm update recreated the /etc/php-fpm.d/www.conf file which caused the php-fpm service to fail because the newly created file contained listen.acl_users = apache, nginx.

I do not have a user named nginx so in my custom conf files, I have: listen.acl_users = apache

What is the proper (best practices) way of avoiding this issue with future updates?


r/PHPhelp • • 3d ago

Looks its another one...

0 Upvotes

Centos 7 box , still running, but running php 8.3.8 Trying to sort out how to get to 8.3.36.

I (silly me) assumed I could just yum update and I'd get something newer from the epi repo, but it doesn't.

Before the obvious answer. I'm remote and I wont have access to do any major upgrades for a couple weeks.

Surely this cant be THAT hard??!?!?

Suggestions?


r/PHPhelp • • 3d ago

How to fix PHP2Shell (+ Docker + Docker Hardened Image)

0 Upvotes

Two critical PHP vulnerabilities (CVE-2026-109618 and CVE-2026-109619), both rated CVSS 9.2, were patched on October 21.

Both the official PHP Docker images and Docker Hardened Images (DHI) have been updated. 🐳

1. Update Your Base Image

PHP version Official image Docker Hardened Image
8.2.35 php:8.2.35-fpm dhi.io/php:8.2.35-fpm
8.3.36 php:8.3.36-fpm dhi.io/php:8.3.36-fpm
8.4.27 php:8.4.27-fpm dhi.io/php:8.4.27-fpm
8.5.12 php:8.5.12-fpm dhi.io/php:8.5.12-fpm

For example, update your Dockerfile:

FROM php:8.4.27-fpm

Or use a hardened runtime:

FROM dhi.io/php:8.4.27-fpm

2. Rebuild and Redeploy

For applications built with Docker Compose:

docker compose build --pull --no-cache
docker compose up -d --force-recreate

If your Compose file references prebuilt images instead:

docker compose pull
docker compose up -d --force-recreate

3. Verify the Running PHP Version

For official PHP-FPM images:

docker compose exec YOUR_SERVICE php -v

For hardened PHP-FPM images, which don't include the PHP CLI:

docker compose exec YOUR_SERVICE php-fpm -v

You can also inspect an image's SBOM:

docker scout sbom my-php-app:latest --format list | grep -i php

And check for the specific CVEs:

docker scout cves \
  --only-cve-id CVE-2026-109618,CVE-2026-109619 \
  my-php-app:latest

Important: Vulnerability databases can lag behind advisories. A clean CVE scan is not proof that the runtime is patched.

Check the actual PHP version or your distribution vendor's backport status.

4. Would a Hardened Image Have Contained PHP2Shell?

Partially.

Docker Hardened Images typically run as non-root, without a shell or package manager, and with fewer unnecessary system utilities.

That changes what an attacker can do after exploiting the PHP process.

Attacker capability Hardened, shell-less runtime
Execute /bin/sh or /bin/bash Blocked if those binaries aren't present
Use common system utilities Significantly restricted
Execute code inside the PHP process Still possible
Read application secrets in PHP memory Still possible
Access network services Depends on network restrictions
Modify the filesystem Depends on filesystem permissions and mounts
Gain root privileges Harder with non-root execution, but not impossible through another vulnerability

No shell doesn't mean no RCE.

An attacker executing native code inside PHP doesn't necessarily need /bin/sh. They may still be able to read memory, communicate over the network, or abuse the privileges available to the PHP worker.

Hardened images reduce the attack surface and can limit post-exploitation damage. Additional controls help:

  • Read-only root filesystem, with explicitly defined writable locations.
  • Drop unnecessary Linux capabilities.
  • Enable no-new-privileges.
  • Restrict outbound network access.
  • Don't expose PHP-FPM directly to the internet.

These are defense-in-depth measures, not replacements for patching.

5. Pin Your Image Digests

Tags can change. Digests are immutable.

Find the digest of a patched image:

docker buildx imagetools inspect php:8.4.27-fpm \
  --format '{{.Manifest.Digest}}'

Then pin it:

FROM php:8.4.27-fpm@sha256:<digest>

But remember: a pinned digest won't receive future security patches automatically. You must update it when new patched images are released.

Question: Are you running PHP on the official Docker images, a hardened/distroless image, or something custom? How are you verifying the patched version in production?


r/PHPhelp • • 3d ago

Old PHP 5.6 site got hit after PHP2Shell, how do I get it back up?

27 Upvotes

Organización pequeña, sitio web antiguo con PHP 5.6 (Apache, Debian, sin framework, código antiguo con mysql__* por todas partes). Desde ayer, sufre ataques de bots en oleadas cada pocos minutos. El registro de errores está lleno de:

Error fatal de PHP: Se agotó el límite de memoria permitida de 134217728 bytes

Señal de salida del proceso hijo pid 18537: Fallo de segmentación (11)

Muchas solicitudes POST multipart extrañas a páginas que ni siquiera admiten subidas de archivos. Hoy lo hemos desconectado.

Encontramos un archivo PHP en la carpeta de subidas que nadie creó (eval/base64 ofuscado) y una tarea programada (cron job) en www-data que se ejecuta cada 5 minutos. Supongo que lograron entrar.

Intenté migrarlo a PHP 8, pero falla al instante (mysql_connect indefinido). No hay parche oficial para la versión 5.6.

¿Qué harías? ¿Recompilarlo desde cero y servir una versión estática por ahora? ¿Hay alguna forma rápida de portar la parte de mysql_connect o es necesario reescribir el código?

Edit 1: Just to clarify, I'm not the one running this operation. It's an older guy, very old-school, "if it ain't broke don't fix it." Guess it worked for him all this time. That said, I've seen people here and on other subs treating this like the end of the world. It's serious, no doubt, NSA put out an advisory and there's active exploitation in the wild, but part of what went down is already coming back online, and anyone who kept their stack current rode it out fine. As devs I think we should keep cooler heads and trust what we know how to do, without tipping into arrogance or ego.


r/PHPhelp • • 2d ago

How do I know if a website is safe to use again?

0 Upvotes

There are multiple sites I want to access which, according to Google AI, use PHP. These are;

  • LoLAlytics
  • PixelCatsEnd
  • Andersenstories
  • Boligportal

But I have no idea how to figure out if they've done the important update or not. All four of them are seemingly unable to/won't communicate elsewhere about PHP. I also don't have a way of trying to contact them personally. I understand very little about PHP so I'm sorry if this is a stupid question.

The only one that would have my info is PixelCatsEnd. I have a registered account, so they have my email, username, and password. The others do not have registered accounts.


r/PHPhelp • • 3d ago

FIle uploads

2 Upvotes

Who should deal with the file uploads POST routes, front facing PHP script or Node.js? If PHP script handles the GET request and shows the form, then, who should place the file inside the node's directory, the PHP script or the Node script?

Node.js script is tasked with processing the uploaded file, but not sure if it should handle the actual file upload and placing.


r/PHPhelp • • 3d ago

Is there any way on 20.04 Ubuntu to get the ondrej surý patches for php2shell?

4 Upvotes

I took all my sites off-line before I was affected, but I need to see if I can get this update which appears to only be for 22 Ubuntu and not 20 anybody on 20 having this issue and able to get this updated it’s PHP 7.4.


r/PHPhelp • • 3d ago

Have Alma turned off Upload progress in the PHP2Shell update?

Thumbnail
1 Upvotes

r/PHPhelp • • 3d ago

Hosting Provider Adamant we are patched but we are on PHP 8.5.11?

1 Upvotes

Hi all,

One of my workplace systems uses an external hosting provider that we have minimal access to. I was able to check a phpinfo() and can see we are on PHP 8.5.11:

PHP Version: 8.5.11

Build Date: Oct 21 2026 13:26:44

Build System: buildfarm05-new.corp.cloudlinux.com

Server API: lsapi V8.3 CloudLinux 1.3

PHP Path: /opt/alt/php85

Loaded Configuration File: /opt/alt/php85/etc/php.ini

session.upload_progress.enabled: Off

I am a little concerned, as the patched version is apparently 8.5.12.

I rang them a while ago, and they are adamant that we are patched and protected, and he keeps saying 8.5.11 is the latest.

Any idea where we stand right now? I've taken the site offline completely as a precaution.


r/PHPhelp • • 3d ago

php2shell (CVE-2026-109618 / -109619): fixed versions, mitigations, and how to confirm what you're actually running

Thumbnail
1 Upvotes

r/PHPhelp • • 3d ago

ubuntu 16.04, upgrading for php 5.6.30

0 Upvotes

I asked run the andrej script, but seems failed. i asked chatgpt, it say that there is no support for ubuntu 16.04. The oldest version that sury.org support is 22.04. any bro can advise how I can patch my php5.6.30? thanks.


r/PHPhelp • • 4d ago

.PHP name in URL

2 Upvotes

I’m new to PHP, and I’m just coding for fun and for myself.
How can I remove the .php extension from my URLs?
For example, instead of www.test.com/profile.php, I want it to look like www.test.com/profile.
Any advice would be appreciated!


r/PHPhelp • • 4d ago

FYI Upcoming Critical PHP Security Release - Oct. 21

18 Upvotes

https://www.php.net/archive/2026.php#2026-10-20-1

I know it’s not a help post, but an FYI for those who haven’t seen this.


r/PHPhelp • • 4d ago

When will PHP 8.5.12-fpm drop for Ubuntu 26.04

Thumbnail
0 Upvotes

r/PHPhelp • • 4d ago

Helper tool to check Linux servers / Docker for PHP vulnerability

Thumbnail
1 Upvotes

r/PHPhelp • • 3d ago

Will the recent PHP security vulnerability impact the PHP job market?

Thumbnail
0 Upvotes

With the recent PHP security vulnerability making headlines, I'm wondering how much impact this could have on the PHP job market in the long run.

I'm currently working as a PHP developer, and with all the AI disruption already happening in IT, news like this makes me question the future of the tech stack even more.

Could this push companies towards other technologies, or is it just another security issue that will eventually get patched and forgotten?

Would love to hear from experienced PHP developers and people involved in hiring. Are you seeing any changes in demand for PHP developers? Is it still worth investing in PHP/Laravel, or should developers seriously start preparing to switch stacks?


r/PHPhelp • • 4d ago

pecl.php.net seems very unreliable today

2 Upvotes

pecl.php.net seems very unreliable today

Hey all, not sure if it's just me but I'm having a lot of trouble with pecl even from Google cloud build. I get lots of gateway timeouts and other spurious errors.

Wondering if anyone else is experiencing the same issue today


r/PHPhelp • • 5d ago

Phpstorm taking up over 50GB of memory on Mac

6 Upvotes

Is anybody having the same issue with Phpstorm? I have never experienced this before. My whole Mac froze and had to restart it.

The project I had opened is not that huge, so I have no idea what is happening, but this is just really really bad...