Skip to main content

Crontab issue: Uncaught mysqli_sql_exception: No such file or directory

Comments

14 comments

  • ffeingol

    For grins, in your cron command can you cd into the accounts public_html folder and see if that makes any different.  That "should" be the same thing as /usr/local/bin/ea-php81 /path/cron.php, but it can't hurt to try.

    0
  • cPRex Jurassic Moderator

    ^ I always recommend using the full paths in cron, as cron itself has no home directory to start with.

    0
  • webdesires

    Hello thanks guys, yes I have tried this. so to confirm both:

    cd /home/[account]/public_html && /usr/local/bin/php /home/[account]/public_html/wp-cron.php

    and

    /usr/local/bin/php /home/[account]/public_html/wp-cron.php
    0
  • webdesires

    again if I run either directly through SSH they work fine, but through cron they work but database fails with the error above.

    0
  • cPRex Jurassic Moderator

    Are you able to manually connect to MySQL using the data in your connection string?

    0
  • webdesires

    Yes, like ive said... run this script in a browser or through SSH command line and it all works fine.

     

    run it through crontab, get the mysqli error above.

    0
  • webdesires

    It's very very strange I know this is why I need help and cPanel doesn't support us anymore due to our license being a reseller license and our server company also cant help us so we are now stuck.

    I would be happy to pay for someone's time at this point if they want to come into our server and try and find out what the heck is going on.

    0
  • cPRex Jurassic Moderator

    Your license company does have to help you, and if they can't figure out the issue they are welcome to escalate to cPanel.  I'm not sure what a "reseller license" means though in your case.

    We do have a list of admins that advertise their specialty with cPanel tools here: https://support.cpanel.net/hc/en-us/community/posts/19389562586519-System-Adminstration-Services

    0
  • webdesires

    Hello,
     
    I am very sorry for the issues that you are having. I have indeed read your email, unfortunately, we have ceased the complimentary support we provide to the clients of our partners and resellers. We did notify all of our partners a while back that we were discontinuing this support at the beginning of the year for them to be able to notify their clients of this change. 
     
    I would ask them if they do possibly offer a licensing package where they provide cPanel support of any type. 
     
    Unfortunately, if they do not offer such a license the only other way for us to be able to assist you would be if you canceled your license with Lomart and purchased a new license through us directly. You can still use their server, so there would be no issue with losing data or migrations. You would only have to run an update command through SSH, and then we could access the server via your server credentials and provide you with the needed support for your issue. 
     
    I apologize for the issues that you are experiencing with your server and that we are unable to provide you more assistance with this issue at this time.

    With Regards,
    Tracey Y.
    Customer Service Representative

    0
  • cPRex Jurassic Moderator

    I can't comment on the agreement between you and your license provider, unfortunately.

    0
  • webdesires

    Anyone got any ideas what my issue could be? What would prevent a cronjob from connecting to a database in this fashion?

    0
  • ffeingol

    I would suggest trying:

    /opt/cpanel/ea-php##/root/usr/bin/php /home/user/public_html/script.php

    where ## is the version of PHP you want to run (i.e. ea-php82).  That forces the specific version of PHP that you want.

    0
  • webdesires

    We have fixed the issue!!

    So after exhausting all other ideas and finding everything SHOULD be fine, I decided to change the socket path on the server, because on the other servers the path was:

    /var/lib/mysql/mysqld.sock

    however on this particular server the path was:

    /run/mysqld/mysqld.sock

    To achieve this I set the path in my.cnf:

    socket=/var/lib/mysql/mysqld.sock

    Edited the socket path to the same in this file:

    /etc/mysql/mysql.conf.d/mysqld.cnf

    Edited all the php.ini files in multiphp to the same path...

    And finally all the symlinks I managed to find on the server:

    /var/tmp/mysqld.sock
    /tmp/mysqld.sock
    /var/lib/mysql/mysqld.sock

    As soon as I did this everything started working perfectly.
    Dont know why, dont care!

    Thanks guys anyway!!

    0
  • cPRex Jurassic Moderator

    That's interesting that the sock file wasn't set to the default, but I'm glad you got it working!

    0

Please sign in to leave a comment.