Showing posts with label exec. Show all posts
Showing posts with label exec. Show all posts

Tuesday 5 June 2018

shell_exec("mysql -u $dbuser --password='$dbpassword' --host='$sqlhost' $dbname < $file") not working in PHP

I try to execute query from PHP / CMD / Terminal


mysql -u admin --password='jaydip' --host='localhost' 'mg_kansagra' < '/var/www/html/magento/dump/db.sql'


Its show me following error

mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 3167 (HY000) at line 17: The 'INFORMATION_SCHEMA.SESSION_VARIABLES' feature is disabled; see the documentation for 'show_compatibility_56'

ANSWER

Run the following query in your MySQL database:
set @@global.show_compatibility_56=ON;

Monday 6 June 2016

How to run URL Using exec, Shell_exec in php

function testf(){
        $url = 'http://www.google.com';
        $outputfile = "jems.html";
        $cmd = "wget -q \"$url\" -O $outputfile";
        exec($cmd);
        echo file_get_contents($outputfile);
    }