1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'Server Configuration and Hosting' started by Nelson T., May 7, 2015.

  1. Nelson T.

    Nelson T. Guest

    I am trying to run a script in PHP using the SSH CLI.

    I get the error "Unexpected error occurred. Please try again later".

    Coder says something is wrong with my SSH CLI.

    Any ideas what is wrong and how to fix it?

    TIA.
     

    Attached Files:

  2. teletubbi

    teletubbi Active Member

    Are you missing the - f after php?
     
  3. Nelson T.

    Nelson T. Guest

    what does the -f do?
     
  4. teletubbi

    teletubbi Active Member

    Tells php that you want run a file.
     
  5. Nelson T.

    Nelson T. Guest

    Tried:

    php -f /path/to/file.php

    and got the same error

     

    Attached Files:

  6. teletubbi

    teletubbi Active Member

    Something in your logs?
     
  7. Nelson T.

    Nelson T. Guest

    How do I find out? (I am not skilled in this)
     
  8. Nelson T.

    Nelson T. Guest

    [Thu May 07 07:35:27 2015] [error] [client 207.46.13.13] File does not exist: /home/hobbymac/public_html/404.shtml
    [Thu May 07 07:35:27 2015] [error] [client 207.46.13.13] File does not exist: /home/hobbymac/public_html/find-new
    [Thu May 07 07:35:25 2015] [error] [client 208.68.190.28] File does not exist: /home/hobbymac/public_html/404.shtml, referer: http://www.hobby-machinist.com/
    [Thu May 07 07:35:25 2015] [error] [client 208.68.190.28] File does not exist: /home/hobbymac/public_html/taigachat, referer: http://www.hobby-machinist.com/
    [Thu May 07 07:35:25 2015] [error] [client 188.165.15.50] File does not exist: /home/hobbymac/public_html/404.shtml
    [Thu May 07 07:35:25 2015] [error] [client 188.165.15.50] File does not exist: /home/hobbymac/public_html/members
    [Thu May 07 07:35:23 2015] [error] [client 157.55.39.155] File does not exist: /home/hobbymac/public_html/404.shtml
    [Thu May 07 07:35:23 2015] [error] [client 157.55.39.155] File does not exist: /home/hobbymac/public_html/find-new
    [Thu May 07 07:35:23 2015] [error] [client 157.55.39.155] File does not exist: /home/hobbymac/public_html/404.shtml
    [Thu May 07 07:35:23 2015] [error] [client 157.55.39.155] File does not exist: /home/hobbymac/public_html/find-new
    [Thu May 07 07:35:22 2015] [error] [client 157.55.39.155] File does not exist: /home/hobbymac/public_html/404.shtml
    [Thu May 07 07:35:22 2015] [error] [client 157.55.39.155] File does not exist: /home/hobbymac/public_html/attachments
    [Thu May 07 07:35:21 2015] [error] [client 144.76.137.226] File does not exist: /home/hobbymac/public_html/404.shtml
    [Thu May 07 07:35:21 2015] [error] [client 144.76.137.226] File does not exist: /home/hobbymac/public_html/misc
    [Thu May 07 07:35:16 2015] [error] [client 207.46.13.47] File does not exist: /home/hobbymac/public_html/404.shtml
    [Thu May 07 07:35:16 2015] [error] [client 207.46.13.47] File does not exist: /home/hobbymac/public_html/find-new
    [Thu May 07 07:35:16 2015] [error] [client 148.251.183.105] File does not exist: /home/hobbymac/public_html/404.shtml
    [Thu May 07 07:35:16 2015] [error] [client 148.251.183.105] File does not exist: /home/hobbymac/public_html/misc
    [Thu May 07 07:35:15 2015] [error] [client 66.249.64.164] File does not exist: /home/hobbymac/public_html/404.shtml
    [Thu May 07 07:35:15 2015] [error] [client 66.249.64.164] File does not exist: /home/hobbymac/public_html/Xen
    [Thu May 07 07:35:15 2015] [error] [client 212.224.119.142] File does not exist: /home/hobbymac/public_html/404.shtml
    [Thu May 07 07:35:15 2015] [error] [client 212.224.119.142] File does not exist: /home/hobbymac/public_html/threads
    [Thu May 07 07:35:12 2015] [error] [client 157.55.39.155] File does not exist: /home/hobbymac/public_html/404.shtml
    [Thu May 07 07:35:12 2015] [error] [client 157.55.39.155] File does not exist: /home/hobbymac/public_html/attachments
     
  9. teletubbi

    teletubbi Active Member

    This belongs to your Web server.
    Has nothing to do with this issue.

    I don't know your installation so don't know if php is setup to generate his own log file or report to syslog.
     
  10. Nelson T.

    Nelson T. Guest

    How would I obtain the SSH error log. The server is set up:


    The operating system is 'CentOS release 6.6'.
    This is the output of the command using no php.ini:

    root@host [/home/hobbymac]# /usr/bin/php -n /home/hobbymac/public_html/importer.php
    Status: 500 Internal Server Error
    X-Powered-By: PHP/5.4.39
    Content-Type: text/html; charset=utf-8

    This is giving back a 500 error.

    The web host tried running a script to fix permissions for SuPHP and moved the .htaccess out of the way

    I get the same error.
     
  11. teletubbi

    teletubbi Active Member

    A 500 error is generic and say nothing at all.
    Maybe a permission issue.

    As you say your host, you log in as root?
     
  12. teletubbi

    teletubbi Active Member

    But anyhow this should be solved by the Web host.
    Only they know how they set up the server.
     
  13. MattW

    MattW Well-Known Member

    type "which php" and find the absolute path of PHP. As you aren't root, you user may not know where the PHP executable file is. Then, try again with the full path to PHP before the file
     
  14. Nelson T.

    Nelson T. Guest

    the path for php is:

    usr/local/bin/php

    so I used usr/local/bin/php /home/hobbymac/public_html/importer.php

    and got the same error.
     

    Attached Files:

  15. teletubbi

    teletubbi Active Member

    Again with the - f.
     
  16. Nelson T.

    Nelson T. Guest

    "No such file or directory"
     
  17. teletubbi

    teletubbi Active Member

    Than is something wrong with your path.
    Some host put the user in /usr/home/www/users or something like that and put only a symlink into your home dir.

    You have to find the original path to that file.
     
  18. Nelson T.

    Nelson T. Guest

    How would I find the path?
     
  19. teletubbi

    teletubbi Active Member

    find / - name importer.php
     
  20. Nelson T.

    Nelson T. Guest

    It says

    'importer.php' No such file or directory when in fact (I checked with Filezilla) it appears in the public/html directory.

    What is going wrong?
     

Share This Page