# Hosting issues and possibly site hacking

**URL:** <https://community.ovhcloud.com/t/pb-hebergement-et-surement-piratage-de-site/54015>\
**Category:** Domaines et Hébergements\
**Tags:** hébergement-web\
**Created:** [September 28, 2026, 7:31am UTC](https://community.ovhcloud.com/t/pb-hebergement-et-surement-piratage-de-site/54015 "2026-09-28T07:31:32Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![LaurentK6](https://community.ovhcloud.com/letter_avatar/laurentk6/32/6_22734026db12803ebb3e059622ac3534.png) [@LaurentK6](https://community.ovhcloud.com/u/LaurentK6)\
**Post date:** [September 28, 2026, 7:31am UTC](https://community.ovhcloud.com/t/pb-hebergement-et-surement-piratage-de-site/54015/1 "2026-09-28T07:31:32Z")

</div>

Hello everyone,

I'm having issues with my OVH hosting. I have an "Archive" folder that I created (which is not a WordPress or Joomla folder) and I can't delete it; I don't even have access to the permissions. Has anyone encountered this problem and what solution should be adopted?

The email from OVH tells me there is a&nbsp;cache.php&nbsp;file, which is a hacker file, inside this folder.

Thanks to everyone.

---

<div class="post-metadata">

**Author:** ![Gaston](https://community.ovhcloud.com/user_avatar/community.ovhcloud.com/gaston/32/33_2.png) [@Gaston](https://community.ovhcloud.com/u/Gaston)\
**Post date:** [September 28, 2026, 7:33am UTC](https://community.ovhcloud.com/t/pb-hebergement-et-surement-piratage-de-site/54015/2 "2026-09-28T07:33:34Z")

</div>

Hello @LaurentK6

The simplest and fastest solution is to perform a **Hosting** and **Database** restoration to a date before your issue. For example, a week earlier.

See the paragraph in my guide: [T - Restoring your OVH site to an earlier date](https://wordetweb.com/word-et-web/WORDPRESS-guide-installation-de-WordPress-premier-domaine-chez-OVH-FR.htm#_T_%E2%80%93_Restauration)

---

<div class="post-metadata">

**Author:** ![LaurentK6](https://community.ovhcloud.com/letter_avatar/laurentk6/32/6_22734026db12803ebb3e059622ac3534.png) [@LaurentK6](https://community.ovhcloud.com/u/LaurentK6)\
**Post date:** [September 28, 2026, 7:50am UTC](https://community.ovhcloud.com/t/pb-hebergement-et-surement-piratage-de-site/54015/3 "2026-09-28T07:50:01Z")

</div>

Thanks for this tip; actually I used GEMINI to create a PHP script that directly deletes the file and the folder.

---

<div class="post-metadata">

**Author:** ![Gaston](https://community.ovhcloud.com/user_avatar/community.ovhcloud.com/gaston/32/33_2.png) [@Gaston](https://community.ovhcloud.com/u/Gaston)\
**Post date:** [September 28, 2026, 9:50am UTC](https://community.ovhcloud.com/t/pb-hebergement-et-surement-piratage-de-site/54015/4 "2026-09-28T09:50:31Z")

</div>

Hello @LaurentK6

What did GEMINI recommend to you?

Which domain?

Don’t forget to back up your site on your PC.

\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_

**Backups of your site at OVH are not permanent**.

Excerpt from my guide: [T - Restoration OVH of your site to an earlier date](https://wordetweb.com/word-et-web/WORDPRESS-guide-installation-de-WordPress-premier-domaine-chez-OVH-FR.htm#_T_%E2%80%93_Restauration "T - Restauration OVH de votre site à une date antérieure")

**At OVH, restoring your hosting can only go back a maximum of two weeks.**

If your site was hacked three weeks ago, you’re out of luck and will have to delete everything and rebuild your site from scratch.

**At OVH, restoring your database can only go back a maximum of two months**

Make sure to back up **Hosting and Database** on your PC once a month.

See the paragraph in my guide: [Ua - Complete backup of your site on your PC](https://wordetweb.com/word-et-web/WORDPRESS-guide-installation-de-WordPress-premier-domaine-chez-OVH-FR.htm#_U_%E2%80%93_Sauvegarde)

See the paragraph in my guide: [Ub - Complete restoration of your site from your PC](https://wordetweb.com/word-et-web/WORDPRESS-guide-installation-de-WordPress-premier-domaine-chez-OVH-FR.htm#_W_-_PLUGINS "Ub - Restauration complète de votre site depuis votre PC")

---

<div class="post-metadata">

**Author:** ![Asterix](https://community.ovhcloud.com/user_avatar/community.ovhcloud.com/asterix/32/29931_2.png) [@Asterix](https://community.ovhcloud.com/u/Asterix)\
**Post date:** [September 28, 2026, 10:11am UTC](https://community.ovhcloud.com/t/pb-hebergement-et-surement-piratage-de-site/54015/5 "2026-09-28T10:11:36Z")

</div>

Hello 🙂

When you encounter difficulties deleting data on a hosting service, don't hesitate to check the file access permissions.

Personally, I like to share this site which is handy for understanding CHMOD permissions for beginners: [https://chmodcommand.com/chmod-666/](https://chmodcommand.com/chmod-666/)

> [@LaurentK6](#):
>
> I went through GEMINI to create a PHP script that directly deletes the file and the folder.

If you have information about this PHP file, I'm interested! And curious 😛

Astérix

---

<div class="post-metadata">

**Author:** ![Gaston](https://community.ovhcloud.com/user_avatar/community.ovhcloud.com/gaston/32/33_2.png) [@Gaston](https://community.ovhcloud.com/u/Gaston)\
**Post date:** [September 28, 2026, 10:12am UTC](https://community.ovhcloud.com/t/pb-hebergement-et-surement-piratage-de-site/54015/6 "2026-09-28T10:12:11Z")

</div>

> [@Asterix](#):
>
> If you have the information from this php file, I’m interested! And curious 😛

Just like me. 😀

---

<div class="post-metadata">

**Author:** ![fritz2cat](https://community.ovhcloud.com/user_avatar/community.ovhcloud.com/fritz2cat/32/29833_2.png) [@fritz2cat](https://community.ovhcloud.com/u/fritz2cat)\
**Post date:** [September 28, 2026, 11:42am UTC](https://community.ovhcloud.com/t/pb-hebergement-et-surement-piratage-de-site/54015/7 "2026-09-28T11:42:33Z")

</div>

I would add that SFTP is better than FTP when it comes to deleting files whose names contain exotic characters.

The same applies when a directory contains more than 4,998 files.

---

<div class="post-metadata">

**Author:** ![LaurentK6](https://community.ovhcloud.com/letter_avatar/laurentk6/32/6_22734026db12803ebb3e059622ac3534.png) [@LaurentK6](https://community.ovhcloud.com/u/LaurentK6)\
**Post date:** [September 28, 2026, 2:44pm UTC](https://community.ovhcloud.com/t/pb-hebergement-et-surement-piratage-de-site/54015/8 "2026-09-28T14:44:14Z")

</div>

Actually I no longer had permissions on the folder to delete. I'm posting the GEMINI code below.

---

<div class="post-metadata">

**Author:** ![LaurentK6](https://community.ovhcloud.com/letter_avatar/laurentk6/32/6_22734026db12803ebb3e059622ac3534.png) [@LaurentK6](https://community.ovhcloud.com/u/LaurentK6)\
**Post date:** [September 28, 2026, 2:45pm UTC](https://community.ovhcloud.com/t/pb-hebergement-et-surement-piratage-de-site/54015/9 "2026-09-28T14:45:12Z")

</div>

here is the code proposed by GEMINI

```php
<?php
// Activate error display
ini_set('display_errors', 1);
error_reporting(E_ALL);

// Set the path to your folder (e.g., 'wp-content/uploads/weird-folder' or 'weird-folder')
$target = '1';

function forceDelete($dir) {
    if (!file_exists($dir)) {
        return "Le dossier n'existe pas à cet emplacement : " . htmlspecialchars($dir);
    }

    if (!is_dir($dir)) {
        chmod($dir, 0777);
        return unlink($dir) ? "Fichier supprimé : $dir" : "Échec suppression fichier : $dir";
    }

    // Force the permissions of the main folder
    chmod($dir, 0777);

    // Iterate over all files and subfolders (including hidden ones like .htaccess)
    $items = array_diff(scandir($dir), array('.', '..'));
    foreach ($items as $item) {
        $path = $dir . DIRECTORY_SEPARATOR . $item;
        chmod($path, 0777);
        if (is_dir($path)) {
            forceDelete($path);
        } else {
            if (!unlink($path)) {
                echo "Impossible de supprimer le fichier : " . htmlspecialchars($path) . "<br>";
            }
        }
    }

    return rmdir($dir) ? "<b>Dossier supprimé avec succès !</b>" : "<b>Échec de la suppression du dossier racine.</b>";
}

echo forceDelete($target);
?>

```

---

<div class="post-metadata">

**Author:** ![Gaston](https://community.ovhcloud.com/user_avatar/community.ovhcloud.com/gaston/32/33_2.png) [@Gaston](https://community.ovhcloud.com/u/Gaston)\
**Post date:** [September 28, 2026, 4:40pm UTC](https://community.ovhcloud.com/t/pb-hebergement-et-surement-piratage-de-site/54015/10 "2026-09-28T16:40:56Z")

</div>

Thanks @LaurentK6

But could you provide the "line‑by‑line" version?  
That would give us better readability.

---

<div class="post-metadata">

**Author:** ![LaurentK6](https://community.ovhcloud.com/letter_avatar/laurentk6/32/6_22734026db12803ebb3e059622ac3534.png) [@LaurentK6](https://community.ovhcloud.com/u/LaurentK6)\
**Post date:** [September 29, 2026, 10:07am UTC](https://community.ovhcloud.com/t/pb-hebergement-et-surement-piratage-de-site/54015/12 "2026-09-29T10:07:21Z")

</div>

```auto
<?php
// Enable error display
ini_set('display_errors', 1);
error_reporting(E_ALL);

// Set the path to your folder (e.g., 'wp-content/uploads/weird-folder' or 'weird-folder')
$target = '1';

function forceDelete($dir) {
    if (!file_exists($dir)) {
        return "The folder does not exist at this location: " . htmlspecialchars($dir);
    }

    if (!is_dir($dir)) {
        chmod($dir, 0777);
        return unlink($dir) ? "File deleted: $dir" : "Failed to delete file: $dir";
    }

    // Force permissions on the main folder
    chmod($dir, 0777);

    // Iterate over all files and subfolders (including hidden ones like .htaccess)
    $items = array_diff(scandir($dir), array('.', '..'));
    foreach ($items as $item) {
        $path = $dir . DIRECTORY_SEPARATOR . $item;
        chmod($path, 0777);
        if (is_dir($path)) {
            forceDelete($path);
        } else {
            if (!unlink($path)) {
                echo "Unable to delete file: " . htmlspecialchars($path) . "<br>";
            }
        }
    }

    return rmdir($dir) ? "<b>Folder successfully deleted!</b>" : "<b>Failed to delete the root folder.</b>";
}

echo forceDelete($target);
?>

```

---

<div class="post-metadata">

**Author:** ![Gaston](https://community.ovhcloud.com/user_avatar/community.ovhcloud.com/gaston/32/33_2.png) [@Gaston](https://community.ovhcloud.com/u/Gaston)\
**Post date:** [September 29, 2026, 11:05am UTC](https://community.ovhcloud.com/t/pb-hebergement-et-surement-piratage-de-site/54015/13 "2026-09-29T11:05:04Z")

</div>

Hello @LaurentK6

I understand the script much better, thank you very much.

Your script works in two steps:

- force the access rights of a folder to 777 and then delete it
- and this for all subfolders of the directory tree.

Thank you very much

---

<div class="post-metadata">

**Author:** ![Asterix](https://community.ovhcloud.com/user_avatar/community.ovhcloud.com/asterix/32/29931_2.png) [@Asterix](https://community.ovhcloud.com/u/Asterix)\
**Post date:** [September 29, 2026, 1:17pm UTC](https://community.ovhcloud.com/t/pb-hebergement-et-surement-piratage-de-site/54015/14 "2026-09-29T13:17:52Z")

</div>

Thanks for sharing the script!

---

<div class="post-metadata">

**Author:** ![LaurentK6](https://community.ovhcloud.com/letter_avatar/laurentk6/32/6_22734026db12803ebb3e059622ac3534.png) [@LaurentK6](https://community.ovhcloud.com/u/LaurentK6)\
**Post date:** [September 29, 2026, 3:28pm UTC](https://community.ovhcloud.com/t/pb-hebergement-et-surement-piratage-de-site/54015/15 "2026-09-29T15:28:12Z")

</div>

Thanks to Gemini 😉

---

<div class="post-metadata">

**Author:** ![system](https://community.ovhcloud.com/user_avatar/community.ovhcloud.com/system/32/5_2.png) [@system](https://community.ovhcloud.com/u/system)\
**Post date:** [October 1, 2026, 3:28pm UTC](https://community.ovhcloud.com/t/pb-hebergement-et-surement-piratage-de-site/54015/16 "2026-10-01T15:28:41Z")

</div>

Ce sujet a été automatiquement fermé après 2 jours. Aucune réponse n'est permise dorénavant.
