When I try to install a Wordpress from the panel I get the following Error Phar

When I try to install a Wordpress from the panel I get the following error:

Fatal error: Uncaught Error: Class “Phar” not found in /home/userdomain/.wp-cli/wp:3 Stack trace: #0 {main} thrown in /home/userdomain/.wp-cli/wp on line 3 Error: cmd exited with errors

But if I run wp cli as root it works, but if I try to run it as a normal user it throws the above error.
Any idea?

Show the output of these messages:

grep -r phar.so /etc/php
php -v | head -n1
php -m | grep Phar
su - YourUser
./wp-cli/wp
php -v | head -n1
php -m | grep Phar
grep -r phar.so /etc/grep -r phar.so /etc/php
/etc/php/7.1/mods-available/phar.ini:extension=phar.so
/etc/php/8.0/mods-available/phar.ini:extension=phar.so
/etc/php/7.2/mods-available/phar.ini:extension=phar.so
/etc/php/7.0/mods-available/phar.ini:extension=phar.so
/etc/php/5.6/mods-available/phar.ini:extension=phar.so
/etc/php/8.1/mods-available/phar.ini:extension=phar.so
/etc/php/8.2/mods-available/phar.ini:extension=phar.so
/etc/php/php/8.0/mods-available/phar.ini:extension=phar.so
/etc/php/php/8.3/mods-available/phar.ini:extension=phar.so
/etc/php/php/5.6/mods-available/phar.ini:extension=phar.so
/etc/php/php/8.1/mods-available/phar.ini:extension=phar.so
/etc/php/php/8.2/mods-available/phar.ini:extension=phar.so
/etc/php/php/7.4/mods-available/phar.ini:extension=phar.so
/etc/php/7.4/mods-available/phar.ini:extension=phar.so
php -v | head -n1
PHP 8.2.24 (cli) (built: Sep 27 2024 04:03:19) (NTS)
php -m | grep Phar
Phar
su - YourUser
 su - minasealemonclarinet
This account is currently not available.

But the account exists in Hestiacp

Screenshot_3

From here on down I could not continue since I cannot access the user as you indicated.
But if I do it like this, I can access the user:

sudo -u MyUser bash
.wp-cli/wp
Fatal error: Uncaught Error: Class “Phar” not found in /home/minasealemonclarinet/.wp-cli/wp:3
Stack trace:
#0 {main}  thrown in /home/minasealemonclarinet/.wp-cli/wp on line 3
php -v | head -n1
PHP 8.2.24 (cli) (built: Sep 27 2024 04:03:19) (NTS)

php -m | grep Phar
Not working for me

I’m wondering why you have those dirs /etc/php/php/*

Execute these commands:

v-change-user-shell minasealemonclarinet bash
su - minasealemonclarinet 
./wp-cli/wp
php -v | head -n1
php -m | grep Phar
php -i | grep -i 'configuration file'

Later you can change again the shell to nologin:

v-change-user-shell minasealemonclarinet nologin

Regarding the php why it is there I do not know the truth, once I had a problem with php and tinkering I managed to repair it, but I had not even noticed the path.
If it can be changed then I make the change

If I execute ./wp-cli/wp
I get:
-bash: ./wp-cli/wp: The file or directory does not exist.

But if I access cd .wp-cli

minasealemonclarinet@host:~/.wp-cli$ wp

Fatal error: Uncaught Error: class “Phar” not found in /home/minasealemonclarinet/.wp-cli/wp:3
Stack tracking:
#0 {main}
thrown in /home/minasealemonclarinet/.wp-cli/wp on line 3

Then, the user doesn’t have wp-cli installed as is using another one in the PATH.

su - minasealemonclarinet 
type wp

Exit from user’s shell and execute these commands:

v-add-user-wp-cli minasealemonclarinet
su - minasealemonclarinet 
./wp-cli/wp
php -v | head -n1
php -m | grep Phar
php -i | grep -i 'configuration file'

v-add-user-wp-cli minasealemonclarinet

Error: For user name ‘minasealemonclarinet’ WP-CLI already available!

root@host:/home/minasealemonclarinet/tmp# su - minasealemonclarinet

minasealemonclarinet@host:~$ ./wpcli/wp
-bash: ./wpcli/wp: No existe el fichero o el directorio

I have already modified the php path:
/etc/php/7.1/fpm/php.ini
/etc/php/8.0/fpm/php.ini
/etc/php/8.3/fpm/php.ini
/etc/php/7.2/fpm/php.ini
/etc/php/7.0/fpm/php.ini
/etc/php/5.6/fpm/php.ini
/etc/php/8.1/fpm/php.ini
/etc/php/8.2/fpm/php.ini
/etc/php/7.4/fpm/php.ini

I have already managed to install the wordpress, but I end up with this error:

Error: file /tmp/hst.diH2yl was not copied.

As far as I see what does not create the configuration file wp-config.php

Remove the dir and install it again

rm -rf /home/minasealemonclarinet/.wp-cli/
v-add-user-wp-cli minasealemonclarinet

The command is ./wp-cli/wp

I would need a log to know what’s going on.

Ok, the wp-cli thing I think is solved now I get the error I told you about:

Error: file /tmp/hst.gSp8i9 was not copied

But I do not know what log file I have to look for, as far as I could see the wp-config.php file does not create it, but if you have installed the wordpress.

Any idea what log file to look for?

Could you please show the output of this command?

v-run-cli-cmd minasealemonclarinet /home/minasealemonclarinet/.wp-cli/wp cli info
/var/log/hestia/system.log
/var/log/hestia/error.log
/var/log/hestia/nginx-error.log

v-run-cli-cmd minasealemonclarinet /home/minasealemonclarinet/.wp-cli/wp cli info
OS: Linux 6.1.0-26-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.112-1 (2024-09-30) x86_64
Shell: /bin/bash
PHP binary: /usr/bin/php8.2
PHP version: 8.2.24
php.ini used: /etc/php/8.2/cli/php.ini
MySQL binary: /usr/bin/mysql
MySQL version: mysql Ver 15.1 Distrib 10.11.6-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper
SQL modes:
WP-CLI root dir: phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir: phar://wp-cli.phar/vendor
WP_CLI phar path: /
WP-CLI packages dir:
WP-CLI cache dir: /home/minasealemonclarinet/.wp-cli/cache
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 2.11.0

The log:
2024/10/22 10:38:24 [error] 768#0: *472 FastCGI sent in stderr: “PHP message: PHP Notice: Error: file /tmp/hst.gSp8i9 was not copied in /usr/local/hestia/web/src/app/System/HestiaApp.php on line 46” while reading response header from upstream, client: xx.xxx.xxx.xx, server: _, request: “POST /add/webapp/?app=WordPress&domain=domainuser.com HTTP/2.0”, upstream: “fastcgi://unix:/run/hestia-php.sock:”, host: “xxx.xx.es:8083”, referrer: “https://xxx.xxxx.es:8083/add/webapp/?app=WordPress&domain=domainuser.com

There isn’t much information about the reason why it can’t copy the file.

Could you please remove all contents inside /home/YourUser/web/YourDomain/public_html/ and try to install Wordpress again?

rm -rf /home/YourUser/web/YourDomain/public_html/{*,.*} 2>/dev/null
1 Like

The same thing happens, the temporary file it createThe same thing happens, the temporary file it creates cannot be copied or created in the destination.

root@host:/tmp# cat hst.jUvOck

<?php /** * The base configuration for WordPress * * The wp-config.php creation script uses this file during the installation. * You don't have to use the website, you can copy this file to "wp-config.php" * and fill in the values. * * This file contains the following configurations: * * * Database settings * * Secret keys * * Database table prefix * * ABSPATH * * @link https://developer.wordpress.org/advanced-administration/wordpress/wp-config/ * * @package WordPress */ // ** Database settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define( 'DB_NAME', 'minasealemonclarinet_91991' ); /** Database username */ define( 'DB_USER', 'minasealemonclarinet_91991' );

But I see on the screenshot that the public_html dir has files, remove them before trying to install WordPress again, like I said in my previous post.

I do it with the empty folder, but as soon as the installation is finished, the error pops up and that blue sign that appears in the background.

Here you can see several attempts I have made
rwxr-xr-x 2 admin admin 4096 oct 19 18:34 hestia-webapp
-rw-r–r-- 1 admin admin 3363 oct 23 13:14 hst.8Re2VR
-rw-r–r-- 1 admin admin 3363 oct 23 13:10 hst.gwv2jS
-rw-r–r-- 1 admin admin 3363 oct 23 12:58 hst.OwKupD

Then I’m running out of ideas.

What php version are you using to setup Wordpress? I want to know if you are selecting php 8.3 on Wordpress setup page.

It doesn’t matter the php version I use, with all the ones I show you in the image I get the same error.

I have tried with another user and everything went fine, so the problem may be in permissions issues.
That the user does not have permissions to create that file or to move it.
I don’t know how to check the user permissions.

Use this command:
namei -mo /home/YourUser/web/YourDomain/public_html/

The thread is closed, in the end I deleted the user and recreated it and the problem is solved.
We will remain with the doubt that happened to this user.
Thank you very much for your support.
Best regards.

2 Likes