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!
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
Cheers, Carsten
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!
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.
)
… where is your Nextcloud hosted? 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
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?
I contacted the 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
The new server with php 7 and my posted script did it. Everything fine now.
Thanks for your help!
Kind regards
perfect…would really appreciate if you could share your script for other users
Please also mark this thread as solved.
…::::carsten
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);
?>
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:
<?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);
?>
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.
Hi Benedikt,
try to move your all-inkl.com account to a machine with native php7.
Contact the support, they will help you (see also my post above).
Kind regards
Thank you for the answer, but that is exactly what i’m trying to avoid, see my original post
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.