Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7717895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T03:01:17+00:00 2026-06-01T03:01:17+00:00

<?php require_once ‘abstract.php’; class Mage_Shell_Snapshot extends Mage_Shell_Abstract { public function _snapshot() { if(!Mage::isInstalled()) {

  • 0
<?php
    require_once 'abstract.php';

    class Mage_Shell_Snapshot extends Mage_Shell_Abstract
    {
    public function _snapshot()
    {
        if(!Mage::isInstalled()) 
        {
            echo "Application is not installed yet, please complete install wizard first.";
            exit;
        }
        # Initialize configuration values
        $connection = Mage::getConfig()->getNode('global/resources/default_setup /connection');
        $rootpath = $this->_getRootPath();
        $snapshot = $rootpath.'testing';

        # Create the snapshot directory if not exists
        $io = new Varien_Io_File();
        $io->mkdir($snapshot);

        include('/home/test/public_html/xmlapi.php');
        $cp_user="test";
        $cp_pass="test123";
        $db_host="localhost";
        $db_name="test_insatller";
        $db_user="test_test";
        $db_pass="home123";
        $url="http://201.40.548.550/testing/";
        $ad_user="admin";
        $ad_pass="sk12121";
        $ad_email="indies.tester@gmail.com";
        $xmlapi = new xmlapi($db_host);
        $xmlapi->set_port(2083);
        $xmlapi->password_auth($cp_user,$cp_pass);
        $xmlapi->set_debug(1);
        //create database
        $xmlapi->api1_query($cp_user,"Mysql", "adddb", array($db_name));
        //create user
        $xmlapi->api1_query($cp_user,"Mysql", "adduser", array($db_user,$db_pass)); 
        //add user to database
        $xmlapi->api1_query($cp_user,"Mysql", "adduserdb", array($db_name,$db_user,'all'));
        $command = '/home/indieste/public_html/function.sh '.$db_host.' '.$db_name.' '.$db_user.' '.$db_pass.' '.$url.' '.$ad_user.' '.$ad_pass.' '.$ad_email; 
        echo $command;
        system($command);
        Mage::log($command);

    }
    public function run()
    {
        if ($this->getArg('testing'))
        {
            $this->_snapshot();
        }
        else
        {
            echo $this->usageHelp();
        }
    }

    public function usageHelp()
    {
        global $argv;
        $self = basename($argv[0]);

        USAGE;
    }
    }
   $shell = new Mage_Shell_Snapshot();
    $shell->run();

When i run this snapshot.php from the folder magento->shell->snapshot.php using putty, it is not creating the database and user.

I am creating the database and user in cpanel using xmlapi.php and run this run function.sh file to install magento in root directory of cpanel. It is also not giving me any type of error. so, is this code is sufficient to run a bash shell script(function.sh) from magento ?.

function.sh file contains the command related to download magento from server, extract it, and install in the root directory of cpanel using hostname, hostpassword, dbname, dbuser,dbpassword,admin user, admin password.

If any one have related link to run a shell script from magento then pls give me and tell me how to run a shell script from magento?.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T03:01:19+00:00Added an answer on June 1, 2026 at 3:01 am

    Shell scripts can be run from any php applications in two ways.

    1. Use the exec() function to run the script.

    2. use backticks (``) and specify the command to be run in the ticks.
      eg:

    $variable= “ls; ls inside the backtick.

    gives the output of ls into the variable.

    Be very sure if you are using this for an application , because, this is one serious issue from security perspective.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My form class: <?php require_once ('Zend\Form.php'); class Sergio_Form_registrationform extends Zend_Form { public function init(){
Here's my Zend code: <?php require_once ('Zend\Form.php'); class Sergio_Form_registrationform extends Zend_Form { public function
I add this class to library/My/Validate/PasswordConfirmation.php <?php require_once 'Zend/Validate/Abstract.php'; class My_Validate_PasswordConfirmation extends Zend_Validate_Abstract {
--- A.php ---- require_once 'B.php'; class A { public function __constructor($x){...} public function foo()
class_1.php class class_1 { public function __construct() { require_once $_SERVER['DOCUMENT_ROOT'].'/array.php'; } } class_2.php class
I have task: <?php require_once(dirname(__FILE__).'/../../config/ProjectConfiguration.class.php'); class GroupCheckTask extends sfBaseTask { protected function configure() {
My first class: <?php require_once( 'error/DisconnectedHandler.php' ); require_once( 'error/NoSuchRequestHandler.php' ); class NetworkManager { public
What is the difference between two codes? Extends; <?php require_once 'example.class.php'; Class First extends
This is my user class: <? require_once(dirname(__FILE__).'/DB.class.php'); require_once(dirname(__FILE__).'/Model.class.php'); class Benutzer extends Model { private
//file foo.php <?php namespace foo; class foo{ function __construct(){ echo hello; } } ?>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.