Jump to content

How best to auto-install PrestaShop?


Sumaleth

Recommended Posts

Hi! I work for Installatron (http://www.installatron.com), which I believe is the most popular third-party installer of PrestaShop at the moment (and probably has been for the last decade or more).

But we have a problem: we haven't been able to successfully install PrestaShop on all of the multitudinous server environment that we encounter since 1.7.5.0. 1.7.4.4 worked fine but no matter what we've tried since 1.7.5.0 we always get complaints from someone to say that it's not working.

-- --

Most of our installers are pretty simple. They work something like this:

  1. extract the app's archive into the destination location;
  2. chmod some files/directories;
  3. make some HTTP POST calls to the app's install script;
  4. final chmods and probably delete the install directory.

A typical installer might be half a page of code.

The PrestaShop installer, on the other hand, is a dozen or more pages filled with multiple approaches and notes explaining fixes for this and that.

In the end we fell back on what seemed a clever idea; install 1.7.4.4, regardless what version was selected by the user, but then immediately (and silently) upgrade it to the chosen version. This seemed to work fine but then a user found an important frontend page that is producing a 500 error. And I don't know why the upgrade isn't working.

-- --

I guess what I'm hoping is that someone here with deep knowledge of PrestaShop can help me construct the simplest, cleanest, most solid installer for PrestaShop?! If I started with this "ideal" version of what the installer code might look like (this is using the Installatron API, but the commands available are all as you might expect) then how close can we get something working to this?

<?php

// extract the archive
$this->extract("main");

// chmod all files to 666 and directories to 777 (we can limit this to only what's required?)
$this->chmod(".", 0666, 0777, true);

// install the app
$this->fetch("install/index.php",array(
	"language" => "en",
	"licence_agrement" => "1",
	"admin_email" => "[email protected]",
	'admin_firstname' => "Site",
	'admin_lastname' => "Owner",
	'admin_password' => "testing123!b",
	'admin_password_confirm' => "testing123!b",
	'db_mode' => ($this->input['field_content'] === 'no') ? 'lite' : 'full',
	'send_informations' => 'on',
	'shop_activity' => '0',
	'shop_country' => "en",
	'shop_name' => "My shop",
	'shop_timezone' => 'UTC',
	'timezoneByIso' => true,
	'iso' => 'us',
	'dbLogin' => $this->db_user,
	'dbName' => $this->db_name,
	'dbPassword' => $this->db_pass,
	'dbServer' => $this->db_host,
	'db_prefix' => $this->db_prefix,
	'rewrite_engine' => $this->env["has_apache"] !== false ? '1' : '',
	"submitNext" => "HandsOffInstall"
));

// a couple of db tweaks
$this->db_query("UPDATE `{$this->db_prefix}configuration` SET `value`=? WHERE `name`='PS_SHOP_EMAIL'", array($this->input["field_email"]), false);
$this->db_query("UPDATE `{$this->db_prefix}contact` SET `email`=?", array($this->input["field_email"]), false);

// complete
$this->chmod("...");
$this->rm("install");

?>

Something like this would be the ideal.

Although I haven't included the ability to select the default language in this mockup and that's something we need. In our current installer we install it with 'en' as the default language; then we log into the app (using one of those fetch(...) calls), then we try to select and install another language through the administration backend UI using further fetch calls. It ain't pretty. :)

But the 'language' parameter in PrestaShop's installer only works for the installer, not for the application that it ultimately installs. Unless we've missed something? It'd be great to be able to pass in the preferred language and the installer would set that up as the default language during install.

--

Anyway, that's all I can think to write for now. We try not to bother developers but we're really struggling with PrestaShop at the moment so this is a bit of an SOS in the sand. All help appreciated, publicly or privately, and I can answer any questions anyone has.

Thanks,
Rowan Crawford
@Installatron http://installatron.com
 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...