WordPress.org

Ready to get started?Download WordPress

Forums

using exec to import mysql database (2 posts)

  1. alibas
    Member
    Posted 1 year ago #

    Hi guys,

    I want to import some tables with sql file in the plugin installation
    exec('mysql -h db_host -u db_user -p password db_name < data.sql',
    $output, $return_var);

    but $return_var is 127 and I have no clue why?!!

    I changed file permissions and change php safe_mode but still not working. and I can run other simple commands like ls, and also I can run this command from outside of wordpress but not inside.

    please help, thank you

  2. alibas
    Member
    Posted 1 year ago #

    ok I solved it but there is still another problem .

    I needed to add complete path to be able to run mysql --> /usr/local/mysql/bin/mysql

    but how can I know complete path in every computer that runs my plugin ?

Topic Closed

This topic has been closed to new replies.

About this Topic