example myconnect.php

$servername = "localhost";
$username = "";
$password = "";
try {
    $conn = new PDO("mysql:host=$servername;dbname=meigee", $username, $password);
    //set the PDO error mode to exception
    echo "Connected successfully";
} catch(PDOException $e) {
    echo "Connection failed: " . $e->getMessage();
echo "<br>";
echo "PHP on Magento";

how to upload file mycon.php? Magento1.9.4.3

1 Answer 1


I would suggest that you create a shell script in order to leverage the "Magento way" of coding

You may follow this tutorial


Using shell scripts you would be able to use Magento classes inside of your custom shell PHP script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.