错误index.php不可写管理员index.php不可写在opencart中

时间:2017-05-31 02:57:45

标签: vqmod opencart2.3

我在opencart中安装vqmod时遇到问题,错误说

index.php不可写

管理员index.php不可写

我的root opencart中没有index.php文件,

Admin / index.php

<?php
// Version
define('VERSION', '2.3.0.2');

// Configuration
if (is_file('config.php')) {
    require_once('config.php');
}

// Install
if (!defined('DIR_APPLICATION')) {
    header('Location: ../install/index.php');
    exit;
}
// Startup
require_once(DIR_SYSTEM . 'startup.php');
start('admin');

vqmod /安装/ index.php的

// CHANGE THIS IF YOU EDIT YOUR ADMIN FOLDER NAME
$admin = 'admin';

// Counters
$changes = 0;
$writes = 0;

// Load class required for installation
require('ugrsr.class.php');

// Get directory two above installation directory
$opencart_path = realpath(dirname(__FILE__) . '/../../') . '/';

// Verify path is correct
if(!$opencart_path) die('COULD NOT DETERMINE CORRECT FILE PATH');

$write_errors = array();
if(!is_writeable($opencart_path . 'index.php')) {
    $write_errors[] = 'index.php not writeable';
}
if(!is_writeable($opencart_path . $admin . '/index.php')) {
    $write_errors[] = 'Administrator index.php not writeable';
}

if(!empty($write_errors)) {
    die(implode('<br />', $write_errors));
}

// Create new UGRSR class
$u = new UGRSR($opencart_path);

// remove the # before this to enable debugging info
#$u->debug = true;

// Set file searching to off
$u->file_search = false;

// Attempt upgrade if necessary. Otherwise just continue with normal install
$u->addFile('index.php');
$u->addFile($admin . '/index.php');

$u->addPattern('~\$vqmod->~', 'VQMod::');
$u->addPattern('~\$vqmod = new VQMod\(\);~', 'VQMod::bootup();');

$result = $u->run();

if($result['writes'] > 0) {
    if(file_exists('../mods.cache')) {
        unlink('../mods.cache');
    }
    die('UPGRADE COMPLETE');
}

$u->clearPatterns();
$u->resetFileList();

// Add catalog index files to files to include
$u->addFile('index.php');

// Pattern to add vqmod include
$u->addPattern('~// Startup~', '// VirtualQMOD
require_once(\'./vqmod/vqmod.php\');
VQMod::bootup();

// VQMODDED Startup');

$result = $u->run();
$writes += $result['writes'];
$changes += $result['changes'];

$u->clearPatterns();
$u->resetFileList();

// Add Admin index file
$u->addFile($admin . '/index.php');

// Pattern to add vqmod include
$u->addPattern('~// Startup~', '//VirtualQMOD
require_once(\'../vqmod/vqmod.php\');
VQMod::bootup();

// VQMODDED Startup');


$result = $u->run();
$writes += $result['writes'];
$changes += $result['changes'];

$u->addFile('index.php');

// Pattern to run required files through vqmod
$u->addPattern('/require_once\(DIR_SYSTEM \. \'([^\']+)\'\);/', 'require_once(VQMod::modCheck(DIR_SYSTEM . \'$1\'));');

// Get number of changes during run
$result = $u->run();
$writes += $result['writes'];
$changes += $result['changes'];

// output result to user
if(!$changes) die('VQMOD ALREADY INSTALLED!');
if($writes != 4) die('ONE OR MORE FILES COULD NOT BE WRITTEN');
die('VQMOD HAS BEEN INSTALLED ON YOUR SYSTEM!');

2 个答案:

答案 0 :(得分:0)

这可能意味着您已删除该文件。您可能必须重新安装Opencart或从默认的opencart源文件上载文件。 打开cPanel文件管理器为文件

设置777权限

答案 1 :(得分:0)

你需要做两件事

1)打开vqmod / install / index.php

找到以下代码

$admin = 'admin';

将其值更改为您已更改为

的管理员文件夹名称
$admin = 'youradminfoldername';

2)打开vqmod / pathReplaces.php

找到以下代码(如果没有,请添加它)

$replaces[] = array('~^admin\b~', 'xxxxx');

将xxxxx更改为您当前的管理员文件夹名称。

在你有这两件事之后,即使它仍然显示这样的信息, 你应该可以安装扩展程序。

我测试了这种方法,它对我有用。

另一个解决方案我想也许是删除vqmod文件夹并重新上传vqmod-opencart-2.6.1,然后只需要修改vqmod / pathReplaces.php,它应该可行