# How to (re)scan files without command line access?

**URL:** <https://help.nextcloud.com/t/how-to-re-scan-files-without-command-line-access/11411>\
**Category:** ℹ️ Support\
**Created:** [April 15, 2017, 3:41pm UTC](https://help.nextcloud.com/t/how-to-re-scan-files-without-command-line-access/11411 "2017-04-15T15:41:32Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tihnk](https://help.nextcloud.com/letter_avatar/tihnk/32/6_22734026db12803ebb3e059622ac3534.png) [@Tihnk](https://help.nextcloud.com/u/Tihnk)\
**Post date:** [April 15, 2017, 3:41pm UTC](https://help.nextcloud.com/t/how-to-re-scan-files-without-command-line-access/11411/1 "2017-04-15T15:41:32Z")

</div>

Hello Community!  
I’d like to (re)scan the files of a nextcloud 11.0.1 installation because of missing files. I know that I could do it by using command “occ files:scan rescan” on command line level. But I am running that it on shared hosted webspace, so I do not have command line access. I have FTP access and can run webcron (no “real” cron) or directly access an URL.  
So, how to rescan my files there?  
Thank you for your help,  
best regards!

---

<div class="post-metadata">

**Author:** ![riegerCLOUD](https://help.nextcloud.com/user_avatar/help.nextcloud.com/riegercloud/32/53593_2.png) [@riegerCLOUD](https://help.nextcloud.com/u/riegerCLOUD)\
**Post date:** [April 17, 2017, 1:06pm UTC](https://help.nextcloud.com/t/how-to-re-scan-files-without-command-line-access/11411/2 "2017-04-17T13:06:33Z")

</div>

Dear Tihnk,  
create a phpx-file e.g. “filescan.phpx”

> `<?php exec("php /www/htdocs/<w022222>/path-to-nextcloud/console.php file:scan --all -v 2>&1", $out, $result); echo "Returncode: " .$result ."<br>"; echo "Ausgabe des Scripts: " ."<br>"; echo "<pre>"; print_r($out); ?>`

Then call this file in your preferred browser. Please also have a look at [this ticket](https://help.nextcloud.com/t/updat-installed-at-all-inkl-de-to-11-0-2-problem/10190/5)

Cheers, Carsten

---

<div class="post-metadata">

**Author:** ![Tihnk](https://help.nextcloud.com/letter_avatar/tihnk/32/6_22734026db12803ebb3e059622ac3534.png) [@Tihnk](https://help.nextcloud.com/u/Tihnk)\
**Post date:** [April 17, 2017, 6:11pm UTC](https://help.nextcloud.com/t/how-to-re-scan-files-without-command-line-access/11411/3 "2017-04-17T18:11:22Z")

</div>

Hello riegerCloud,  
thanks for answer!  
But still there is a problem - IMHO - caused by several installed php versions.

```
PHP Version: 7.0.14-nmm1 // from echo phpversion();
Returncode: 0
Ausgabe des Scripts:

Array
(
    [0] => This version of Nextcloud requires at least PHP 5.6.0
    [1] => You are currently running 5.5.38-nmm2. Please update your PHP version.
)

```

when running with .php70 extension.

When .phpx is used “echo phpversion();” gives me 5.5.38-nmm2 as PHP Version.

Do you know how I can directly use php7? (How to find out the php7 path?)  
Thank you!

---

<div class="post-metadata">

**Author:** ![Tihnk](https://help.nextcloud.com/letter_avatar/tihnk/32/6_22734026db12803ebb3e059622ac3534.png) [@Tihnk](https://help.nextcloud.com/u/Tihnk)\
**Post date:** [April 17, 2017, 6:26pm UTC](https://help.nextcloud.com/t/how-to-re-scan-files-without-command-line-access/11411/4 "2017-04-17T18:26:22Z")

</div>

My current script looks like this:

update.phpx

```
<?php
$path = realpath(dirname( __FILE__ ));
echo "PHP Version: " . phpversion() ."<br>";
//exec("php $path/console.php upgrade 2>&1", $out, $result);
exec("php $path/console.php files:scan --all -v 2>&1", $out, $result);
echo "Returncode: " .$result ."<br>";
echo "Ausgabe des Scripts: " ."<br>";
echo "<pre>"; print_r($out);
?>

```

Result:

```
PHP Version: 5.5.38-nmm2
Returncode: 0
Ausgabe des Scripts:

Array
(
    [0] => This version of Nextcloud requires at least PHP 5.6.0
    [1] => You are currently running 5.5.38-nmm2. Please update your PHP version.
)
```

---

<div class="post-metadata">

**Author:** ![riegerCLOUD](https://help.nextcloud.com/user_avatar/help.nextcloud.com/riegercloud/32/53593_2.png) [@riegerCLOUD](https://help.nextcloud.com/u/riegerCLOUD)\
**Post date:** [April 18, 2017, 2:31pm UTC](https://help.nextcloud.com/t/how-to-re-scan-files-without-command-line-access/11411/5 "2017-04-18T14:31:12Z")

</div>

… where is your Nextcloud hosted? [All-INKL.COM](http://All-INKL.COM), 1und1, …

Did you already try to point to a specific php version in your .httaccess?

> e.g.:  
> …  
> AddHandler php71-cgi .php  
> …

Cheers, Carsten

---

<div class="post-metadata">

**Author:** ![Tihnk](https://help.nextcloud.com/letter_avatar/tihnk/32/6_22734026db12803ebb3e059622ac3534.png) [@Tihnk](https://help.nextcloud.com/u/Tihnk)\
**Post date:** [April 18, 2017, 3:57pm UTC](https://help.nextcloud.com/t/how-to-re-scan-files-without-command-line-access/11411/6 "2017-04-18T15:57:50Z")

</div>

[all-inkl.com](http://all-inkl.com)

I have chosen 7.0 (CGI) via Subdomain configuration. Otherwise Nextcloud wouldn’t run I think…

.htaccess configuration did also not work…

I tried different direct links to php such as /usr/local/bin/php but all I tried did not work…

Any ideas?

---

<div class="post-metadata">

**Author:** ![Tihnk](https://help.nextcloud.com/letter_avatar/tihnk/32/6_22734026db12803ebb3e059622ac3534.png) [@Tihnk](https://help.nextcloud.com/u/Tihnk)\
**Post date:** [April 19, 2017, 3:55pm UTC](https://help.nextcloud.com/t/how-to-re-scan-files-without-command-line-access/11411/7 "2017-04-19T15:55:58Z")

</div>

I contacted the [all-inkl.com](http://all-inkl.com) support. They told me that they have to transfer my data to another server with native php 7 installed to run phpx with php 7. So I will try that and update the thread asap.  
Kind regards

---

<div class="post-metadata">

**Author:** ![Tihnk](https://help.nextcloud.com/letter_avatar/tihnk/32/6_22734026db12803ebb3e059622ac3534.png) [@Tihnk](https://help.nextcloud.com/u/Tihnk)\
**Post date:** [April 20, 2017, 5:36am UTC](https://help.nextcloud.com/t/how-to-re-scan-files-without-command-line-access/11411/8 "2017-04-20T05:36:15Z")

</div>

The new server with php 7 and my posted script did it. Everything fine now.

Thanks for your help!  
Kind regards

---

<div class="post-metadata">

**Author:** ![riegerCLOUD](https://help.nextcloud.com/user_avatar/help.nextcloud.com/riegercloud/32/53593_2.png) [@riegerCLOUD](https://help.nextcloud.com/u/riegerCLOUD)\
**Post date:** [April 23, 2017, 2:49pm UTC](https://help.nextcloud.com/t/how-to-re-scan-files-without-command-line-access/11411/9 "2017-04-23T14:49:02Z")

</div>

perfect…would really appreciate if you could share your script for other users 😉  
Please also mark this thread as solved.  
…::::carsten

---

<div class="post-metadata">

**Author:** ![Tihnk](https://help.nextcloud.com/letter_avatar/tihnk/32/6_22734026db12803ebb3e059622ac3534.png) [@Tihnk](https://help.nextcloud.com/u/Tihnk)\
**Post date:** [April 23, 2017, 3:07pm UTC](https://help.nextcloud.com/t/how-to-re-scan-files-without-command-line-access/11411/10 "2017-04-23T15:07:16Z")

</div>

The final script:

```
<?php
// copy the script into the nextcloud mainfolder where console.php is located, e.g. /var/www/nextcloud
$path = realpath(dirname( __FILE__ ));
echo "PHP Version: " . phpversion() ."<br>";
// run upgrade routines after installation of a new release. The release has to be installed before.
//exec("php $path/console.php upgrade 2>&1", $out, $result);
// rescan filesystem
exec("php $path/console.php files:scan --all -v 2>&1", $out, $result);
// for more commands see documentation
echo "Returncode: " .$result ."<br>";
echo "Console output: " ."<br>";
echo "<pre>"; print_r($out);
?>
```

---

<div class="post-metadata">

**Author:** ![Daniele\_Senatore](https://help.nextcloud.com/user_avatar/help.nextcloud.com/daniele_senatore/32/6536_2.png) [@Daniele\_Senatore](https://help.nextcloud.com/u/Daniele_Senatore)\
**Post date:** [November 7, 2017, 9:33pm UTC](https://help.nextcloud.com/t/how-to-re-scan-files-without-command-line-access/11411/11 "2017-11-07T21:33:51Z")

</div>

First of all, thank you for the script 🙂  
In my plesk installation on shared hosting, I had to specify the correct php binary path, because I have more php versions, so now my code is:

```auto
<?php
// php binary
$bin = "/opt/plesk/php/5.6/bin/php";
// copy the script into the nextcloud mainfolder where console.php is located, e.g. /var/www/nextcloud
$path = realpath(dirname( __FILE__ ));
echo "PHP Version: " . phpversion() ."<br>";
// run upgrade routines after installation of a new release. The release has to be installed before.
//exec("php $path/console.php upgrade 2>&1", $out, $result);
// rescan filesystem
exec("$bin $path/console.php files:scan --all -v 2>&1", $out, $result);
// for more commands see documentation
echo "Returncode: " .$result ."<br>";
echo "Console output: " ."<br>";
echo "<pre>"; print_r($out);
?>
```

---

<div class="post-metadata">

**Author:** ![dschafar87](https://help.nextcloud.com/letter_avatar/dschafar87/32/6_22734026db12803ebb3e059622ac3534.png) [@dschafar87](https://help.nextcloud.com/u/dschafar87)\
**Post date:** [August 3, 2018, 10:44am UTC](https://help.nextcloud.com/t/how-to-re-scan-files-without-command-line-access/11411/14 "2018-08-03T10:44:31Z")

</div>

Sorry to drag this into the daylight after almost a year, but I’m hosted at all-inkl too and i tried to run the script .  
I run Nextcloud 13.0.5 on a server that has PHP verson 5.5.38-nmm3 as a module and PHP 7 set per CGI.  
I can’t move to a newer server with native PHP7, because on a subdomain there runs a fairly old project that is still in use and I don’t know how that would handle the change.

When I try to run the script I get the following error:

_PHP Version: 7.0.30-nmm1_  
_Returncode: 255_  
_Console output: \_  
 Array  
 (  
\_ [0] =\> This version of Nextcloud requires at least PHP 5.6.0_  
_You are currently running 5.5.38-nmm3. Please update your PHP version._  
_)_

I also tried to comment out the

_echo “PHP Version: " . phpversion() .”  
";_

but the I just get the same output with server error 255.

Maybe someone here can help me, also I’m a total n00b when it comes to scripts.  
Do they still say n00b? Anyway, thanks a lot for your help guys.

---

<div class="post-metadata">

**Author:** ![Tihnk](https://help.nextcloud.com/letter_avatar/tihnk/32/6_22734026db12803ebb3e059622ac3534.png) [@Tihnk](https://help.nextcloud.com/u/Tihnk)\
**Post date:** [August 3, 2018, 7:23pm UTC](https://help.nextcloud.com/t/how-to-re-scan-files-without-command-line-access/11411/15 "2018-08-03T19:23:13Z")

</div>

Hi Benedikt,

try to move your [all-inkl.com](http://all-inkl.com) account to a machine with native php7.  
Contact the support, they will help you (see also my post above).  
Kind regards

---

<div class="post-metadata">

**Author:** ![dschafar87](https://help.nextcloud.com/letter_avatar/dschafar87/32/6_22734026db12803ebb3e059622ac3534.png) [@dschafar87](https://help.nextcloud.com/u/dschafar87)\
**Post date:** [August 6, 2018, 6:53am UTC](https://help.nextcloud.com/t/how-to-re-scan-files-without-command-line-access/11411/16 "2018-08-06T06:53:17Z")

</div>

Thank you for the answer, but that is exactly what i’m trying to avoid, see my original post

---

<div class="post-metadata">

**Author:** ![wook](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wook/32/13161_2.png) [@wook](https://help.nextcloud.com/u/wook)\
**Post date:** [January 23, 2019, 9:33am UTC](https://help.nextcloud.com/t/how-to-re-scan-files-without-command-line-access/11411/17 "2019-01-23T09:33:36Z")

</div>

With All-Inkl, you do not have to switch the whole account to a new instance. Make sure in your KAS-domain-settings your domain has PHP 7+ selected.  
In CLI (Commandline-Interface) try following command:

> /usr/bin/ **php72** /www/htdocs/_youraccountnumber_/_yourpathtonextcloud_/console.php _nexcloudcommand_

Change _yoursomething_ to your needs et voila.

@dschafar87 change path to PHP in your script to

> /usr/bin/ **php72**

this should work.

---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 2, 2024, 2:41pm UTC](https://help.nextcloud.com/t/how-to-re-scan-files-without-command-line-access/11411/18 "2024-12-02T14:41:57Z")

</div>



---

<div class="post-metadata">

**Author:** ![wwe](https://help.nextcloud.com/user_avatar/help.nextcloud.com/wwe/32/72963_2.png) [@wwe](https://help.nextcloud.com/u/wwe)\
**Post date:** [December 4, 2024, 1:58pm UTC](https://help.nextcloud.com/t/how-to-re-scan-files-without-command-line-access/11411/19 "2024-12-04T13:58:04Z")

</div>


