Support » Plugin: Duplicator - WordPress Migration Plugin » PHP not running

  • Resolved Wei Hong


    I had uploaded the installer.php and package to my ftp.

    but when I install it i get the error message as below

    Error: PHP is not running

    Duplicator requires that your web server is running PHP. Your server does not have PHP installed, or PHP is turned off.
    ‘an_indexable_id’, ‘column_value’ => ‘the_column_to_perform_search_on’); ini_set(“max_execution_time”, “{$GLOBALS[‘MAX_TIME’]}”); ini_set(“max_input_time”, “{$GLOBALS[‘MAX_TIME’]}”); ini_set(‘memory_limit’, ‘1000M’); set_time_limit(0); /* ================================================================================================ END ADVANCED FEATURES: Do not edit below here. =================================================================================================== */ //GLOBALS $GLOBALS[‘DUPLICATOR_INSTALLER_VERSION’] = ‘0.3.2’; $GLOBALS[“SERIAL_TABLES”][“wpc_options”] = array(‘column_id’ => ‘option_id’, ‘column_value’ => ‘option_value’); $GLOBALS[“SERIAL_TABLES”][“wpc_postmeta”] = array(‘column_id’ => ‘meta_id’, ‘column_value’ => ‘meta_value’); $GLOBALS[“SERIAL_TABLES”][“wpc_usermeta”] = array(‘column_id’ => ‘umeta_id’, ‘column_value’ => ‘meta_value’); $GLOBALS[“SQL_FILE_NAME”] = “installer-data.sql”; $GLOBALS[“LOG_FILE_NAME”] = “installer-log.txt”; $GLOBALS[“SEPERATOR1”] = str_repeat(“********”, 10); $GLOBALS[“LOG_LEVEL”] = isset($_POST[‘log_level’]) ? $_POST[‘log_level’] : 1; $GLOBALS[“MYSQL_CHARSET”] = ‘utf8’; $GLOBALS[“CURRENT_ROOT_PATH”] = dirname(__FILE__); //Update Permissions $chown_root_path = @chmod(“{$GLOBALS[‘CURRENT_ROOT_PATH’]}”, 0755); $chown_log_path = @chmod(“{$GLOBALS[‘CURRENT_ROOT_PATH’]}/{$GLOBALS[‘LOG_FILE_NAME’]}”, 0644); $GLOBALS[“LOG_FILE_HANDLE”] = @fopen($GLOBALS[“LOG_FILE_NAME”], “w+”); //POST PARMS $action = isset($_POST[‘action’]) ? trim($_POST[‘action’]) : null; $dbhost = isset($_POST[‘dbhost’]) ? trim($_POST[‘dbhost’]) : null; $dbname = isset($_POST[‘dbname’]) ? trim($_POST[‘dbname’]) : null; $dbuser = isset($_POST[‘dbuser’]) ? trim($_POST[‘dbuser’]) : null; $dbpassword = isset($_POST[‘dbpassword’]) ? trim($_POST[‘dbpassword’]) : null; $current_url = isset($_POST[‘current_url’]) ? trim($_POST[‘current_url’]) : null; $new_url = isset($_POST[‘nurl’]) ? trim($_POST[‘nurl’]) : null; $new_url = rtrim($new_url, ‘/’); $disable_ssl = (isset($_POST[‘disable_ssl’]) && $_POST[‘disable_ssl’] == ‘1’) ? true : false; $dbmake = (isset($_POST[‘dbmake’]) && $_POST[‘dbmake’] == ‘1’) ? true : false; $dbclean = (isset($_POST[‘dbclean’]) && $_POST[‘dbclean’] == ‘1’) ? true : false; $dbcharvalid = (isset($_POST[‘dbcharvalid’]) && $_POST[‘dbcharvalid’] == ‘1’) ? true : false; $dbmysqlichar = (isset($_POST[‘dbmysqlichar’]) && $_POST[‘dbmysqlichar’] == ‘1’) ? true : false; $zip_manual = (isset($_POST[‘zip_manual’]) && $_POST[‘zip_manual’] == ‘1’) ? true : false; //CONSTANTS define(“DUPLICATOR_HELPLINK”, “”); define(“DUPLICATOR_SSDIR_NAME”, ‘wp-snapshots’); //This should match DUPLICATOR_SSDIR_NAME in duplicator.php define(‘MSG_FAIL_MYSQLI_SUPPORT’, ‘
    In order to complete an install the mysqli extension for PHP is required. If you are on a hosted server please contact your host and request that mysqli be enabled. For more information visit:
    ‘); define(‘MSG_FAIL_DBCONNECT’, ‘
    ‘); define(‘MSG_FAIL_DBCONNECT_CREATE’, ‘
    Unable to create database “%s”.
    Please try creating the database manually to proceed with installation
    ‘); define(‘MSG_FAIL_DBTRYCLEAN’, ‘
    Unable to remove all tables from database “%s”.
    Please remove all tables from this database and try the installation again.
    ‘); define(‘MSG_ERR_CONFIG’, ‘
    A configuration file already exists in this location. You have two options:

    Empty this root directory and recopy the package and installer.
    Copy package from “‘ . DUPLICATOR_SSDIR_NAME . ‘” directory back up to your root (same location as installer.php) and delete the wp-config.php file.

    ‘); define(‘MSG_ERR_DBCREATE’, ‘
    The database “%s” does not exists.
    Enable allow database creation to proceed with the installation.
    ‘); define(‘MSG_ERR_DBCLEANCHECK’, ‘
    The database “%s” has %s tables. The Duplicator only works with an EMPTY database. Enable the “Allow Table Removal” checkbox to delete all tables and proceed with installation. Please backup all your data before proceeding!

    Some hosting providers do not allow table removal from scripts like the Duplicator. In this case you will need to login to your hosting providers control panel and remove the tables manually. Please contact your hosting provider for further details.
    ‘); define(‘MSG_ERR_ZIPNOTFOUND’, ‘
    The packaged zip file was not found. Be sure the zip package is in the same directory as the installer file. If you are trying to reinstall a package you can copy the package from the “‘ . DUPLICATOR_SSDIR_NAME . ‘” directory back up to your root (the same location as your installer.php file).
    ‘); define(‘MSG_ERR_ZIPEXTRACTION’, ‘
    Failed in extracting zip file. Please be sure the archive is completely downloaded. Try to extract the archive manually to make sure the file is not corrupted.
    ‘); define(‘MSG_ERR_ZIPMANUAL’, ‘
    When choosing manual package extraction, the contents of the package must already be extracted and the wp-config.php and database.sql files must be present in the same directory as the installer.php for the process to continue. Please manually extract the package into the current directory before continuing in manual extraction mode.
    ‘); define(‘MSG_ERR_ZIPTOMANY’, ‘
    When running the duplicator only one .zip archive file can be placed within the same directory as the installer.php file. Please make sure the .zip is the correct Package you are trying to install and only one exists.
    ‘); define(‘MSG_ERR_FWRITE’, “
    PHP on this web server currently does not have the proper access level to write to the document root which is currently ‘{$GLOBALS[‘CURRENT_ROOT_PATH’]}’. In order for the duplicator to proceed please enable PHP with the ability to write files. If you’re on a shared hosting environment please contact your hosting company and tell them you’re getting warnings with writing files in PHP.
    “); define(‘MSG_OK_PASS’, ‘
    Please proceed with installation.
    ‘); //DETECT ARCHIVE FILES $GLOBALS[“ZIP_FILE_NAME”] = “No package file found”; $GLOBALS[“ZIP_FILE_COUNT”] = 0; foreach (glob(“*.zip”) as $filename) { $GLOBALS[“ZIP_FILE_NAME”] = $filename; $GLOBALS[“ZIP_FILE_COUNT”]++; } if ($GLOBALS[“ZIP_FILE_COUNT”] > 1) { $GLOBALS[“ZIP_FILE_NAME”] = “Too many zip files found in directory”; } /** * UTILITY CLASS * Various Helper Routines */ class DInstaller { /** * Get current microtime as a float. Can be used for simple profiling. */ static public function get_microtime() { return microtime(true); } /** * Return a string with the elapsed time. * Order of $end and $start can be switched. */ static public function elapsed_time($end, $start) { return sprintf(“%.4f sec.”, abs($end – $start)); } } /** * TABLE_COUNT * Count the tables in a given database * @param string $dbname Database to count tables in */ function dinstaller_table_count($conn, $dbname) { $res = mysqli_query($conn, “SELECT COUNT(*) AS count FROM information_schema.tables WHERE table_schema = ‘{$dbname}’ “); $row = mysqli_fetch_row($res); return is_null($row) ? 0 : $row[0]; } /** * TABLE_ROW_COUNT * Returns the table count * @param string $conn A valid link resource * @param string $table_name A valid table name */ function dinstaller_table_row_count($conn, $table_name) { $total = mysqli_query($conn, “SELECT COUNT(*) FROM $table_name“); if ($total) { $total = @mysqli_fetch_array($total); return $total[0]; } else { return 0; } } /** * ADD_ENDING_SLASH * Adds a slash to the end of a path * @param string $path A path */ function dinstaller_add_slash($path){ $last_char = substr($path, strlen($path)-1, 1); if ($last_char != ‘/’ ) { $path .= ‘/’; } return $path; } /** * DEBUG * Used to write debug info to the output page * @param string $msg A a message that belongs to a unique title block * @param int $loglevel Log level * @param bool $newline Insert a newline */ function dinstaller_log($msg, $loglevel = 1) { if ($loglevel <= $GLOBALS[“LOG_LEVEL”] ) { @fwrite($GLOBALS[“LOG_FILE_HANDLE”], “{$msg}\n”); } } /** * SET_SERIALIZED_STRING * Fixes the string length of a string object that has been serialized * International strings will not return the currect length without setting: ‘Enable MySQL character set’ * @param string $sObject The string ojbect to recalculate the size on. */ function dinstaller_set_serialized_string($sObject) { $regex = ‘!(?<=^|;)s:(\d+)(?=:”(.*?)”;(?:}|a:|s:|b:|d:|i:|o:|N;))!s’; $serial_string = preg_match( ‘/^s:[0-9]+:”(.*$)/s’, trim($sObject), $match); //Nested serial string if ($serial_string) { $inner = preg_replace_callback($regex, ‘dinstaller_serialize_callback’, rtrim($match[1], ‘”;’)); $serialized = ‘s:’ . strlen(utf8_encode($inner)) . ‘:”‘ . $inner . ‘”;’ ; } else { $serialized = preg_replace_callback($regex, ‘dinstaller_serialize_callback’, $sObject); } return $serialized; } function dinstaller_serialize_callback($match) { return ‘s:’ . strlen(utf8_encode($match[2])); } function dinstaller_is_serialized($data) { $test = @unserialize($data); return ($test !== false || $test === ‘b:0;’) ? true : false; } /** * SET_SAFE_PATH * Makes path safe for any OS * Paths should ALWAYS READ be “/” * uni: /home/path/file.xt * win: D:/home/path/file.txt * @param string $path The path to make safe */ function dinstaller_set_safe_path($path) { return str_replace(“\\”, “/”, $path); } /** * DUPLICATOR_FCGI_FLUSH * PHP_SAPI for fcgi requires a data flush of at least 256 * bytes every 40 seconds or else it forces a script hault */ function dinstaller_fcgi_flush() { echo(str_repeat(‘ ‘,256)); @flush(); } //DATABASE CONNECTION AJAX MESSAGE REQUESTS if ($action == ‘dbconnect-test’) { $mysqli_conn = @mysqli_connect($dbhost, $dbuser, $dbpassword); if (! $mysqli_conn) { die(MSG_FAIL_DBCONNECT . mysqli_connect_error()); } if (! $dbmake) { mysqli_select_db($mysqli_conn, $dbname) or die(sprintf(MSG_ERR_DBCREATE, $dbname)); } if (! $dbclean) { $tblcount = dinstaller_table_count($mysqli_conn, $dbname); if ($tblcount > 0) { die(sprintf(MSG_ERR_DBCLEANCHECK, $dbname, $tblcount )); } } die(MSG_OK_PASS); } ?>

    Duplicator – Installer
    See installer-log.txt for an overview of this process.
    “; $tryagain_html = “
    Try Again
    “; $log = “”; //==================================================================================================== //PRECHECKS: Validate and make sure to have a clean enviroment //==================================================================================================== if (! function_exists(‘mysqli_connect’)) { die(MSG_FAIL_MYSQLI_SUPPORT); } //Detect file write access if ($GLOBALS[“LOG_FILE_HANDLE”] == false) { die(MSG_ERR_FWRITE); } if ($GLOBALS[“ZIP_FILE_COUNT”] > 1) { die(MSG_ERR_ZIPTOMANY . $tryagain_html); } if(file_exists(‘wp-config.php’)) { if (! $zip_manual) { die(MSG_ERR_CONFIG . $tryagain_html); } } $mysqli_conn = @mysqli_connect($dbhost, $dbuser, $dbpassword); if (! $mysqli_conn) { die(MSG_FAIL_DBCONNECT . mysqli_connect_error() . $tryagain_html); } if (! $dbmake) { mysqli_select_db($mysqli_conn, $dbname) or die(sprintf(MSG_ERR_DBCREATE, $dbname) . $tryagain_html); } else { $sql = “CREATE DATABASE IF NOT EXISTS {$dbname}“; mysqli_query($mysqli_conn, $sql); mysqli_select_db($mysqli_conn, $dbname) or die(sprintf(MSG_FAIL_DBCONNECT_CREATE, $dbname) . $tryagain_html); } if (! $dbclean) { $log = “Database already empty. Ready for install.”; $tblcount = dinstaller_table_count($mysqli_conn, $dbname); if ($tblcount > 0) { die(sprintf(MSG_ERR_DBCLEANCHECK, $dbname, $tblcount ) . $tryagain_html); } } else { /* Remove all existing tables */ $sql = “SHOW TABLES FROM {$dbname}“; $found_tables = null; if($result = mysqli_query($mysqli_conn, $sql)){ while($row = mysqli_fetch_row($result)){ $found_tables[] = $row[0]; } if (count($found_tables) > 0) { $log = “removing tables\n”; foreach($found_tables as $table_name){ $sql = “DROP TABLE {$dbname}.{$table_name}”; if(! $result = mysqli_query($mysqli_conn, $sql)){ die(sprintf(MSG_FAIL_DBTRYCLEAN, $dbname) . $tryagain_html); } else { $log .= “{$sql}\n”; } } } else { $log = “No tables found to remove.”; } } } dinstaller_log(“{$GLOBALS[‘SEPERATOR1’]}”); dinstaller_log(‘INSTALLER-LOG’); dinstaller_log(“{$GLOBALS[‘SEPERATOR1’]}”); dinstaller_log(‘START-PRECHECK:’ . @date(‘h:i:s’) ); dinstaller_log(“———————————-“); dinstaller_log(“ENVIROMENT:”); dinstaller_log(“version: {$GLOBALS[‘DUPLICATOR_INSTALLER_VERSION’]}”); dinstaller_log(“log level: {$GLOBALS[‘LOG_LEVEL’]}”); dinstaller_log(“php:” . phpversion()); dinstaller_log(“php sapi: ” . php_sapi_name()); dinstaller_log(“mysql:” . mysqli_get_server_info($mysqli_conn)); dinstaller_log(“server: {$_SERVER[‘SERVER_SOFTWARE’]}”); dinstaller_log(“document root: {$GLOBALS[‘CURRENT_ROOT_PATH’]}”); dinstaller_log(“document root 755: ” . var_export($chown_root_path, true)); dinstaller_log(“log file 644: ” . var_export($chown_log_path, true)); dinstaller_log(“secure build name: 509b6138187a92731_20121108_prforaustralia”); dinstaller_log(“———————————-“); dinstaller_log(“SETTINGS:”); dinstaller_log(“database connection => host:{$dbhost} | database:{$dbname} “); dinstaller_log(“old url:'{$current_url}'”); dinstaller_log(“new url:'{$new_url}'”); dinstaller_log(“disable ssl: ” . var_export($disable_ssl, true)); dinstaller_log(“zip manual: ” . var_export($zip_manual, true)); dinstaller_log(“zip archive installed: ” . var_export(class_exists(‘ZipArchive’), true)); dinstaller_log(“———————————-“); dinstaller_log(“DROP TABLES STATUS:”); dinstaller_log(“results => {$log}”); dinstaller_log(‘END-PRECHECK:’ . @date(‘h:i:s’) . “\n”); $log = ”; echo “
    ✔ Prechecks Completed
    “; dinstaller_fcgi_flush(); //==================================================================================================== //PACKAGE EXTRACTED: Extract the contents of the zip file //==================================================================================================== dinstaller_log(“{$GLOBALS[‘SEPERATOR1’]}”); dinstaller_log(“PACKAGE-EXTRACTION”); dinstaller_log(“{$GLOBALS[‘SEPERATOR1’]}”); dinstaller_log(‘START-EXTRACTION:’ . @date(‘h:i:s’) . “\n” ); $zip_name = ”; $filename = null; $package_set_warning = false; foreach (glob(“*.zip”) as $filename) { $zip_name = $filename; } if($filename == null) { die(MSG_ERR_ZIPNOTFOUND . $tryagain_html); } if (‘’ != $zip_name) { dinstaller_log(“WARNING: This Package Set may be incompatible! \nBelow is a summary of the package this installer was built with and the package used. To guarantee accuracy make sure the installer and package match. For more details see the online FAQs. \ncreated with: \nprocessed with: {$zip_name} \n”); $package_set_warning = true; } $target = dinstaller_set_safe_path($GLOBALS[‘CURRENT_ROOT_PATH’]); $zip_size = filesize($filename); if ($zip_manual) { dinstaller_log(“\n-package extraction is in manual mode-\n”); if (! file_exists(“wp-config.php”) && ! file_exists(“database.sql”)) { dinstaller_log(“files wp-config.php or database.sql not found\n”); die(MSG_ERR_ZIPMANUAL . $tryagain_html); } } else { dinstaller_log(“starting package extraction”); $zip = new ZipArchive(); if ($zip->open($zip_name) === TRUE) { $zip->extractTo($target); dinstaller_log(“zip information:\n” . print_r($zip, true)); $close_response = $zip->close(); dinstaller_log(“zip close response: {$close_response}”); dinstaller_log(“package extracted complete\n”); } else { die(MSG_ERR_ZIPEXTRACTION . $tryagain_html ); } echo ($package_set_warning) ? “
    Package Extracted (possible issues see log)
    ” : “
    ✔ Package Extracted
    “; dinstaller_fcgi_flush(); } dinstaller_log(‘END-EXTRACTION:’ . @date(‘h:i:s’). “\n”); //==================================================================================================== //SCRIPTS UPDATED: wp-config.php & database.sql //==================================================================================================== //======================================== //WP-CONFIG dinstaller_log(“{$GLOBALS[‘SEPERATOR1’]}”); dinstaller_log(‘SCRIPT FILES ROUTINE’); dinstaller_log(“{$GLOBALS[‘SEPERATOR1’]}”); dinstaller_log(‘START-FILES:’ . @date(‘h:i:s’) . “\n” ); $config_file = @file_get_contents(‘wp-config.php’, true); $patterns = array (“/’DB_NAME’,\s*’.*?’/”, “/’DB_USER’,\s*’.*?’/”, “/’DB_PASSWORD’,\s*’.*?’/”, “/’DB_HOST’,\s*’.*?’/”, “/’WP_HOME’,\s*’.*?’/”, “/’WP_SITEURL’,\s*’.*?’/”); $replace = array (“‘DB_NAME’, ” . ‘\”.$dbname.’\”, “‘DB_USER’, ” . ‘\”.$dbuser.’\”, “‘DB_PASSWORD’, ” . ‘\”.$dbpassword.’\”, “‘DB_HOST’, ” . ‘\”.$dbhost.’\”, “‘WP_HOME’, ” . ‘\”.$new_url.’\”, “‘WP_SITEURL’, ” . ‘\”.$new_url.’\”); if ($disable_ssl) { array_push($patterns, “/’FORCE_SSL_ADMIN’,\s*true/”); array_push($replace, “‘FORCE_SSL_ADMIN’, false”); } $config_file = preg_replace($patterns, $replace, $config_file); file_put_contents(‘wp-config.php’, $config_file); //======================================== //DATABASE SCRIPT @chmod(dinstaller_set_safe_path(dirname(__FILE__) . “/database.sql”), 0777); $sql_file = file_get_contents(‘database.sql’, true); if ($sql_file == false || strlen($sql_file) < 10) { $parent_path = dirname(__FILE__); dinstaller_log(“ERROR: Unable to read from the extracted database.sql file .\nValidate the permissions and/or group-owner rights on directory ‘{$parent_path}’\n”); } //Complex Subject See: //Removes no breaking characters if ($dbcharvalid) { dinstaller_log(“ran ‘Replace Invalid Characters’ option\n” . $log); $sql_file = str_ireplace(“\xA0″,” “,$sql_file ); } $primary_list = array($current_url); if (count($GLOBALS[“SCRUB_LIST”]) > 0) { for($i = 0; $i < count($GLOBALS[“SCRUB_LIST”]); ++$i) { array_push($primary_list, $GLOBALS[“SCRUB_LIST”][$i]); } } for($i = 0; $i < count($primary_list); ++$i) { $old_url = $primary_list[$i]; $log .= “- {$old_url}\n”; $sql_file = str_replace($old_url, $new_url, $sql_file); } $sql_result_file_data = explode(“;\n”, $sql_file); $sql_result_file_length = count($sql_result_file_data); $sql_result_file_path = dinstaller_set_safe_path(dirname(__FILE__) . “/{$GLOBALS[‘SQL_FILE_NAME’]}”); //Write new contents to install-data.sql @chmod($sql_result_file_path, 0644); file_put_contents($GLOBALS[“SQL_FILE_NAME”], $sql_file); if (is_readable($sql_result_file_path) && filesize($sql_result_file_path) > 0) { dinstaller_log(“New sql file generated from database.sql to {$sql_result_file_path} \n”); } else { $parent_path = dirname(__FILE__); dinstaller_log(“ERROR: Unable to create new sql file {$GLOBALS[‘SQL_FILE_NAME’]}.\nValidate the permissions and/or group-owner rights on directory ‘{$parent_path}’ and file ‘{$GLOBALS[‘SQL_FILE_NAME’]}’\n”); } dinstaller_log(“new url is: {$new_url}”); dinstaller_log(“scrubbed old url(s) in {$GLOBALS[‘SQL_FILE_NAME’]}:\n” . $log); dinstaller_log(“finalized scripts:\n- see {$GLOBALS[‘SQL_FILE_NAME’]} for SQL processed.\n- see wp-config.php for updated changes. \n” ); $log = ”; echo “
    ✔ Script Files Updated
    “; dinstaller_log(‘END FILES:’ . @date(‘h:i:s’) . “\n”); dinstaller_fcgi_flush(); //==================================================================================================== //DATABASE ROUTINES //==================================================================================================== dinstaller_log(“{$GLOBALS[‘SEPERATOR1’]}”); dinstaller_log(‘DATABASE-ROUTINES’); dinstaller_log(“{$GLOBALS[‘SEPERATOR1’]}”); dinstaller_log(‘START-DB:’ . @date(‘h:i:s’) . “\n” ); dinstaller_log(“db create: ” . var_export($dbmake, true)); dinstaller_log(“db clean: ” . var_export($dbclean, true)); dinstaller_log(“db replace characters: “. var_export($dbcharvalid, true)); dinstaller_log(“db mysqli charset: ” . var_export($dbmysqlichar, true)); dinstaller_log(“db wait_timeout: {$GLOBALS[‘MAX_TIME’]}”); mysqli_query($mysqli_conn, “SET wait_timeout = {$GLOBALS[‘MAX_TIME’]}”); //ENABLE DATABASE SETTINGS //Possible fix for utf8 characters however Causing issues in large inserts //mysqli_query($mysqli_conn, “SET NAMES ‘utf8’ “); This seems to cause problems if ($dbmysqlichar) { if (mysqli_set_charset( $mysqli_conn, “{$GLOBALS[‘MYSQL_CHARSET’]}”)) { dinstaller_log(“MySql: charater set loaded [{$GLOBALS[‘MYSQL_CHARSET’]}]\n”); } else { dinstaller_log(“MySql: charater set error using [{$GLOBALS[‘MYSQL_CHARSET’]}]\n”); } } $profile_start = DInstaller::get_microtime(); $temp=0; $fcgi_buffer_pool = 1000; $fcgi_buffer_count = 0; while ($temp < $sql_result_file_length) { @mysqli_query($mysqli_conn, ($sql_result_file_data[$temp])); $temp++; if ($fcgi_buffer_count++ > $fcgi_buffer_pool) { $fcgi_buffer_count = 0; dinstaller_fcgi_flush(); } } $profile_end = DInstaller::get_microtime(); dinstaller_log(“———————————-“); dinstaller_log(“DATABASE RESULTS”); dinstaller_log(“processed queries: {$temp} “); dinstaller_log(“process time: ” . DInstaller::elapsed_time($profile_end, $profile_start) . “\n”); $table_count = 0; dinstaller_log(“Table Record Counts”); if ($result = mysqli_query($mysqli_conn, “SHOW TABLES”)) { while ($row = mysqli_fetch_array($result, MYSQLI_NUM)) { $table_rows = dinstaller_table_row_count($mysqli_conn, $row[0]); dinstaller_log(“{$row[0]}:{$table_rows}”); $table_count++; } mysqli_free_result($result); } if ($table_count == 0) { dinstaller_log(“NOTICE: You may have to manually run the installer-data.sql to validate data input. Also check to make sure your installer file is correct and the table prefix ‘wpc_’ is correct for this particular version of WordPress. \n”); } //Update site title $site_title = mysqli_real_escape_string($mysqli_conn, $_POST[‘site_title’]); mysqli_query($mysqli_conn, “UPDATE wpc_options SET option_value = ‘{$site_title}’ WHERE option_name = ‘blogname’ “); //DATA CLEANUP: Perform Transient Cache Cleanup //Remove all duplicator entries and record this one since this is a new install. mysqli_query($mysqli_conn, “DELETE FROM wpc_duplicator“); mysqli_query($mysqli_conn, “DELETE FROM wpc_options WHERE option_name LIKE (‘_transient%’)”); mysqli_query($mysqli_conn, “DELETE FROM wpc_options WHERE option_name LIKE (‘_site_transient%’)”); dinstaller_log(“\nTransient cached cleanup completed.\n”); //SERIALIZATION LOGIC if ($GLOBALS[“SERIAL_STR_FIX”]) { dinstaller_log(“———————————-“); dinstaller_log(“START SERIALIZATION:” . @date(‘h:i:s’) . “\n”); $fix_count = 0; $seperator1 = str_repeat(“—–“, 15); foreach($GLOBALS[“SERIAL_TABLES”] as $table_name => $column_info) { $table = $table_name; $col_id = $column_info[‘column_id’]; $col_val = $column_info[‘column_value’]; $sql = “SELECT {$col_id}, {$col_val} FROM {$table}” ; $retid = mysqli_query($mysqli_conn, $sql); $serial_count = @mysqli_num_rows($retid); dinstaller_log(“serialization query ({$serial_count}):\n{$sql} \n”); while ($row = @mysqli_fetch_array($retid)) { $base64coverted = false; if (base64_decode($row[$col_val], true)) { $decoded = base64_decode($row[$col_val], true); if (dinstaller_is_serialized($decoded)) { for($i = 0; $i < count($primary_list); ++$i) { $old_url = $primary_list[$i]; $row[$col_val] = str_replace($old_url, $new_url, $decoded); $base64coverted = true; } } } //The url will only be in a string so string types are all that need to be searched. if (strpos($row[$col_val], ‘s:’) !== false && stristr($row[$col_val], $new_url)) { $old_val = $row[$col_val]; $index = $row[$col_id]; $new_val = dinstaller_set_serialized_string($old_val); //Change found make update. if ($old_val != $new_val) { if ($base64coverted) { $log .= (“\nBASE 64 ITEM FOUND: (url scrub performed)\n” ); $new_val = base64_encode($new_val); } $sql = “UPDATE {$table} SET {$col_val} = ‘” . mysqli_real_escape_string($mysqli_conn, $new_val) . “‘ WHERE {$col_id} = ‘{$index}’ “; $result = mysqli_query($mysqli_conn, “$sql”); if ($result) { $fix_count++; $log .= “####################################-START-####################################\n”; $log .= “{$seperator1}\n{$table}=id:{$row[$col_id]} [before] \n{$seperator1}\n{$old_val}\n”; $log .= “{$seperator1}\n{$table}=id:{$row[$col_id]} [after] \n{$seperator1}\n{$new_val}\n\n\n”; } } } } } dinstaller_log(“serialization replacements:\nupdated {$fix_count} records\n”); dinstaller_log(“serialization replacements overview:\n”. $log, 2); dinstaller_log(“END SERIALIZATION:” . @date(‘h:i:s’) . “\n”); $log = ”; } if ($table_count == 0 ) { echo “
    Database Routines Done (possible issues see log)
    “; } else { echo “
    ✔ Database Routines Completed
    “; } dinstaller_log(‘END DB-ROUTINES:’ . @date(‘h:i:s’) . “\n” ); dinstaller_fcgi_flush(); //==================================================================================================== //FINAL CLEANUP //==================================================================================================== dinstaller_log(“{$GLOBALS[‘SEPERATOR1’]}”); dinstaller_log(‘START FINAL CLEANUP’); dinstaller_log(“{$GLOBALS[‘SEPERATOR1’]}”); dinstaller_log(‘START-CLEANUP:’ . @date(‘h:i:s’) . “\n” ); if(!file_exists(DUPLICATOR_SSDIR_NAME)) { mkdir(DUPLICATOR_SSDIR_NAME, 0755); } $fp = fopen(DUPLICATOR_SSDIR_NAME . ‘/index.php’, ‘w’); fclose($fp); @unlink(‘database.sql’); $currdata = parse_url(“”); $newdata = parse_url($new_url); $currpath = dinstaller_add_slash(isset($currdata[‘path’]) ? $currdata[‘path’] : “”); $newpath = dinstaller_add_slash(isset($newdata[‘path’]) ? $newdata[‘path’] : “”); //WEB CONFIG FILE if ($currpath != $newpath) { dinstaller_log(“HTACCESS CHANGES:”); @copy(‘.htaccess’, ‘.htaccess.orig’); @copy(‘web.config’, ‘web.config.orig’); @unlink(‘.htaccess’); @unlink(‘web.config’); dinstaller_log(“created backup of original .htaccess to htaccess.orig and web.config to web.config.orig”); $tmp_htaccess = << RewriteEngine On RewriteBase {$newpath} RewriteRule ^index\.php$ – [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . {$newpath}index.php [L] # END WordPress HTACCESS; file_put_contents(‘.htaccess’, $tmp_htaccess); dinstaller_log(“created basic .htaccess file. If using IIS web.config this process will need to be done manually.”); dinstaller_log(“updated .htaccess file as follows:\n {$tmp_htaccess}”); } else { dinstaller_log(“web configuration file was not renamed because the paths did not change.”); } $html = “”; $html .= “
    ✔ Process completed!

    “; $html .= “IMPORTANT FINAL STEPS!”; $html .= “
    “; $html .= “Complete all these steps to finish setup:

    Resave permalinks – take me there
    Empty cache on all cache plugins (W3 Cache, etc…) and resave plugin settings
    Delete installer.php, installer-data.sql, installer-log.txt & package files – delete for me
    Must have already logged into this newly installed WordPress Administrator
    Validate all sections of your site – take me there

    “; $html .= “TROUBLESHOOTING

    Common Quick Fix Issues:

    Validate directory and file permissions (see below)
    Validate web server configuration file (see below)
    Clear your browsers cache
    Deactivate and reactivate all plugins
    Resave a plugins settings if it reports errors
    Make sure your root directory is empty

    “; $html .= “Permissions:
    Not all operating systems are alike. Therefore, when you move a package (zip file) from one location to another the file and directory permissions may not always stick. If this is the case then check your WordPress directories and make sure it’s permissions are set to 755. For files make sure the permissions are set to 644 (this does not apply to windows servers). Also pay attention to the owner/group attributes. For a full overview of the correct file changes see the WordPress permissions codex

    “; $html .= “Web server configuration files:
    For Apache web server the root .htaccess file was copied to .htaccess.orig. A new stripped down .htaccess file was created to help simplify access issues. For IIS web server the web.config file was copied to web.config.orig, however no new web.config file was created. If you have not altered this file manually then resaving your permalinks and resaving your plugins should resolve most all changes that were made to the root web configuration file. If your still experiencing issues then open the .orig file and do a compare to see what changes need to be made.

    “; $html .= “Plugin Notes:
    It’s impossible to know how all 3rd party plugins function. The Duplicator attempts to fix the new install URL for settings stored in the WordPress options table. Please validate that all plugins retained there settings after installing. If you experience issues try to bulk deactivate all plugins then bulk reactivate them on your new duplicated site. If you run into issues were a plugin does not retain its data then try to resave the plugins settings.

    “; $html .= “Cache Systems:
    Any type of cache system such as Super Cache, W3 Cache, etc. should be emptied before you create a package. Another alternative is to include the cache directory in the directory exclusion path list found in the options dialog. Including a directory such as \pathtowordpress\wp-content\w3tc\ (the w3 Total Cache directory) will exclude this directory from being packaged. In is highly recommended to always perform a cache empty when you first fire up your new site even if you excluded your cache directory.

    “; $html .= “Trying Again:
    If you need to retry and reinstall this package you can easily run the process again by deleting all files except the installer.php and package file and then browse to the installer.php again.

    “; $html .= “Additional Notes:
    If you have made changes to your PHP files directly this might have an impact on your duplicated site. Be sure all changes made will correspond to the sites new location. Only the package (zip file) and the installer.php file should be in the directory where you are installing the site. Please read through our knowledge base before submitting any issues. If you have a large log file that needs evaluated please email the file, or attach it to a help ticket.

    “; $html .= “Approved Hosts:
    Please check out our approved hosts page as it has a list of hosting providers and themes that have been tested successfully with the Duplicator plugin.

    “; $html .= “
    “; $html .= “
    For troubleshooting see our FAQs or submit a help ticket at
    If this product has benefited you consider a partnership or donation!
    “; $html .= “
    “; //Stop the watch when completed $html .= “”; echo $html; mysqli_close($mysqli_conn); dinstaller_log(‘END FINAL:’ . @date(‘h:i:s’) . “\n”); fclose($GLOBALS[“LOG_FILE_HANDLE”]); dinstaller_log(“PROCESS CAME TO FULL COMPLETION \n”); } ?>
    Package Name ” readonly=”true” class=”readonly” />
    Package Url edit
    Install Url get
    Site Title

    Allow Database Creation Allow Table Removal
    [Test Connection]

    Advanced Options

    Disclaimer: This plugin has been heavily tested, however it does require above average technical knowledge. Please use it at your own risk and do not forget to back up your database and files beforehand. If you’re not sure about how to use this tool then please enlist the guidance of a technical professional.

    Database: Do not attempt to connect to an existing database unless you are 100% sure you want to remove all of it’s data. Connecting to a database that already exists will permanently DELETE all data in that database. This tool is designed to populate and fill a database with NEW data from a duplicated database using the SQL script in the package name above.

    Setup: Only the package (zip file) and installer.php file should be in the install directory, unless you have manually extracted the package and checked the ‘Manual Package Extraction’ checkbox. All other files will be OVERWRITTEN during install. Make sure you have full backups of all your databases and files before continuing with an installation.

    Manual Extraction: Manual extraction requires that all contents in the package are extracted to the same directory as the installer.php file. Manual extraction is only needed when your server does not support the ZipArchive extension. Please see the online help for more details.

    After Install:When you are done with the installation remove the installer.php, installer-data.sql and the installer-log.txt files from your directory. These files contain sensitive information and should not remain on a production system.

    I have read all warnings & notices
    installer version:

    Any Idea what can I do?

    Thanks a lot!!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Cory Lamle


    Hey globalmigration,

    If you can remove the information above the moderators don’t like that much text dumped into the post.

    It looks like from the very first line above that you don’t have PHP running on the server your trying to install your site….

    Hope that helps!

    Wei Hong


    Dear lifeinthegrid,

    Thank you so much!! For yr reply, I got my hosting to solve it ady.

    But now I am facing another issue, which is
    Warning: Invalid argument supplied for foreach() in /home/pr4au/domains/ on line 277

    Do you have any idea?
    You can try to access my website

    to have a look.


    Plugin Author Cory Lamle


    If you can give the latest version a try it may have your fixes for the issue your seeing. The very latest version can be found by following these instructions:

    -> Browse to
    -> Look for the section “Other Versions”
    -> Click on “Development Version” and download the zip plugin file
    -> Uninstall your current version and install this one

    Plugin Author Cory Lamle


    Hey globalmigration,

    Any luck with this?

    Wei Hong


    Hi Lifeinthegrid,

    THanks for your follow up. I was respond to your support time last time.

    Yes. Its solved with joy by installing the developer version.

    Thanks you soo much!!

    Plugin Author Cory Lamle


    Excellent! Setting thread to resolved…

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘PHP not running’ is closed to new replies.