Trying to run SSH CLI PHP Script- Get "Unexpected Error Occurred"

  • Thread starter Thread starter Nelson T.
  • Start date Start date
But we don't even know if they use cpanel.
If the path, he provide at the beginning to public_html, is the right one why he got file not found.
 
But we don't even know if they use cpanel.
If the path, he provide at the beginning to public_html, is the right one why he got file not found.
Point being... if you are putting it in your HOME directory, your HOME directory is NOT in /public_html. That is ONLY where Apache expects to find the files it is to serve.
https://forums.cpanel.net/threads/default-home-directory.66380/
https://forums.cpanel.net/threads/how-does-one-change-a-users-home-directory.23942/

Just a few that show that cPanel does use the /home (or /home2) structure for HOME locations.
 
Agree.
Maybe just a misunderstood each other because English is not my native language.

What I want to say he have to find the absolute path of his public_html folder.
Otherwise it want work if he call the relative path.

I hope I make it more clear now.
 
Exactly... and that's (absolute) is where the /home/username/ comes in at. With a cpanel, if you have uploaded the file to your web root it would usually be /home/username/public_html (if I remember correctly from my short foray into cPanel before I ran screaming the other way).
 
I have cpanel and whm.

I tried every path to the file. Nothing works.

the correct path is /home/hobbymac/public_html/importer.php

I am curious how you got it working on your server.
 
Sorry for the delay.
Haven`t much time yesterday.

But here is the screenshot if i run your script.

import.webp

As you can see i can access the file and try to let it run.
The error came only from missing files in the xenforo installation. And that should be ok.
 
I know this may sound stupid... but have you made sure that the file that it is referencing can be read by others than the owner. I have sometimes found files that could only be read by the owner and nobody else.
 
Thats also my clue.
Maybe a permission issue.

Otherwise i can`t understand while he got file not found.

But on the other hand he can look into the file to verify that are code inside.

Something wired.
 
I give up.
First, test your environment with a simple script.
Code:
$ pwd
/home/floren
$ php -v
PHP 5.6.8 (cli) (built: Apr 23 2015 11:12:29)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies
$ vi time.php
$ cat time.php
<?php
var_dump(time());
$ php time.php
int(1431291146)
That importer you are trying to run belongs to a specific location with probably a ton of deps, you cannot just place it anywhere you like. While running the importer from proper location, tailf the PHP server logs to see what is going on. If you are not familiar with all this, hire a consultant. @MattW should be able to sort all this for you, quickly.
 
Last edited:
His problem is not the missing dep.
His problem is that he can`t locate the script if he call it from php.
This happens on all locations even in his home.
 
"Unexpected error occurred. Please try again later" is an error returned by XenForo (same happens when clicking the link above), so accessing the script through the CLI is working fine, it is just the script is producing an error.
 
"Unexpected error occurred. Please try again later" is an error returned by XenForo (same happens when clicking the link above), so accessing the script through the CLI is working fine, it is just the script is producing an error.
Correct!
Code:
Server Error Log
Error Info
ErrorException: Invalid argument supplied for foreach() - importer.php:177
Generated By: Unknown Account, A moment ago
Stack Trace
#0 /home/hobbymac/public_html/importer.php(177): XenForo_Application::handlePhpError(2, 'Invalid argumen...', '/home/hobbymac/...', 177, Array)
#1 {main}
Request State
array(3) {
  ["url"] => string(7) "http://"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}
 
Top Bottom