Error index.php not writeable Administrator index.php not writeable In opencart - vqmod

i've got problem when i install vqmod in opencart the error say
index.php not writeable
Administrator index.php not writeable
i have no index.php file in my root opencart ,
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/install/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!');

you need to do two things
1)open vqmod/install/index.php
find the following code
$admin = 'admin';
change its value to your admin folder name that you have changed to
$admin = 'youradminfoldername';
2)open vqmod/pathReplaces.php
find the following code (if there is no,add it)
$replaces[] = array('~^admin\b~', 'xxxxx');
change xxxxx to your current admin folder name.
after you have these two things,even if it still show such infomation,
you should be ok to install extension.
I have tested this method ,it works for me.
another solution I guess maybe is to delete vqmod folder and reupload vqmod-opencart-2.6.1,and then only need to modify vqmod/pathReplaces.php,it should works

It probably means that you've deleted the file. You might have to reinstall the Opencart or upload the file from default opencart source files.
Open cPanel File Manager Set permission to 777 for the file

Related

How do I make different sessions on the site

I am using session_start ();
I want to make each page or each folder has its own session
Example:
When you request mysite.com/A opens new session
When asked mysite.com/B opens new session
How so?
It is not clear as to what you mean by opening new session in each folder. If you meant to say that you want a session variable on each folder and the value of this variable should change from folder to folder:
Say, you have a session variable $_SESSION['folderName'] and you want to achieve:
$_SESSION['folderName'] = 'A'; // When in folder mysite.com/A
$_SESSION['folderName'] = 'B'; // When in folder mysite.com/B
Then you can do:
$_SERVER['REQUEST_URI_PATH'] = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$segments = explode('/', $_SERVER['REQUEST_URI_PATH']);
//now when the URL is mysite.com/A, $segments[0] will
// have mysite.com and $segments[1] will have 'A'
So, on each file on each folder, you can do:
<?
session_start();
$_SERVER['REQUEST_URI_PATH'] = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
$segments = explode('/', $_SERVER['REQUEST_URI_PATH']);
$_SESSION['folderName'] = $segments[1];
?>

Laravel - copy image

i need to copy an image and save in diferent name. how can i do this in laravel?
Please help me.
img/master.jpg -> copy -> paste with different name (user1)
----now------
img/master.jpg
img/user1.jpg
You can use laravel File helper, here is the file System Doc.
$oldPath = 'images/1.jpg'; // publc/images/1.jpg
$newPath = 'images/2.jpg'; // publc/images/2.jpg
if (\File::copy($oldPath , $newPath)) {
dd("success");
}
if you need to rename it following would be helpful,
$oldPath = 'images/1.jpg'; // publc/images/1.jpg
$fileExtension = \File::extension($oldPath);
$newName = 'new file.'.$fileExtension;
$newPathWithName = 'images/'.$newName;
if (\File::copy($oldPath , $newPathWithName)) {
dd("success");
}

"Could not determine temp directory, please specify a cache_dir manually"

Magento admin throws an exception:
Could not determine temp directory, please specify a cache_dir manually
It is fresh instalation on new hosting package.
Usually it will happen in shared web hosting, but also some times on individual server, if the permission of tmp folder is set wrong.
Many people suggest to modify the file:
/lib/Zend/Cache/Backend/File.php to fix this problem. However, it may be a trap when you upgrade your Magento, as this file resides as core file of Magento. I recommend to use Magento's override feature.
Firstly, copy /lib/Zend/Cache/Backend/File.php to /app/code/local/Zend/Cache/Backend/File.php.
Then on line 91 or near this line, you will find:
'cache_dir' => null,
Change to:
'cache_dir' => "var/tmp/",
You can change the cache folder wherever you want.
Now create a directory named tmp(or whatever name you have given above) under var folder and change the permission to 777 if necessary.
This is only the permission issue. Just set the 777 permission to the cache directory and you are all done. try it.
For more details you can follow the link.
When ever you set the permission be sure it is recurrsively set..
chmod 777 -R /var/cache
this is the function
public function getTmpDir()
{
$tmpdir = array();
foreach (array($_ENV, $_SERVER) as $tab) {
foreach (array('TMPDIR', 'TEMP', 'TMP', 'windir', 'SystemRoot') as $key) {
if (isset($tab[$key])) {
if (($key == 'windir') or ($key == 'SystemRoot')) {
$dir = realpath($tab[$key] . '\\temp');
} else {
$dir = realpath($tab[$key]);
}
if ($this->_isGoodTmpDir($dir)) {
return $dir;
}
}
}
}
$upload = ini_get('upload_tmp_dir');
if ($upload) {
$dir = realpath($upload);
if ($this->_isGoodTmpDir($dir)) {
return $dir;
}
}
if (function_exists('sys_get_temp_dir')) {
$dir = sys_get_temp_dir();
if ($this->_isGoodTmpDir($dir)) {
return $dir;
}
}
// Attemp to detect by creating a temporary file
$tempFile = tempnam(md5(uniqid(rand(), TRUE)), '');
if ($tempFile) {
$dir = realpath(dirname($tempFile));
unlink($tempFile);
if ($this->_isGoodTmpDir($dir)) {
return $dir;
}
}
if ($this->_isGoodTmpDir('/tmp')) {
return '/tmp';
}
if ($this->_isGoodTmpDir('\\temp')) {
return '\\temp';
}
Zend_Cache::throwException('Could not determine temp directory, please specify a cache_dir manually');
}
defined in file lib/Zend/Cache/Backend.php
http://www.webtechnologycodes.com/magento-error-could-not-determine-temp-directory-please-specify-a-cache_dir-manually/
Create tmp folder in root of your magento installation with 777 permissions.
Open lib/Zend/Cache/Backend/File.php
Find $_options property and change line: 'cache_dir' => null, to 'cache_dir' => 'tmp',
Refresh page.
Create an info.php and check for the path beneath upload_tmp_dir to be writable for the webserver.
<?php phpinfo();
Otherwise set the path in your hosting environment.
Beware that this setting can not be placed within .htaccess files but some hosters allow individual php.ini files to be placed in your docroot:
upload_tmp_dir = /path/to/docroot/var/tmp/

Error: "There was a p‌r‌o‌b‌l‌e‌m saving package data" - Magento

I followed this tutorial Package the module which I have developed. Module works fine. When I tried to save I get this error "There was a problem saving package data" as shown in the screenshot too.
Documentation says You will have ”There was a problem saving package data” when you save the extension if there is space inside the module name. But as you can see there is not spaces in the module name.
What could be the issue? How can I fix this?
in linux
change the connect folder permision to
chmod -R 777 /var/www/magento/var/connect/
NOTE: Extensions are case sensitive. Make sure the package name reflects accordingly in all folders and xml files. e.g. MyExtension is not same as Myextension.
NOTE: The package name must NOT have space inside. For example, use Foo_Bar, don’t use “Foo Bar”. You will have ”There was a problem saving package data” when you save the extension if there is space inside the module name.
Capital letters & spaces matter.
Heres another example of adding a group, and then deleting a group.
// Adding attribute options
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$attribute = Mage::getSingleton("eav/config")->getAttribute("customer", "position");
$aClasses = array('Administrator','Dean','Counselor');
$updates = array();
$updates['attribute_id'] = $attribute->getId();
for($cnt = 0; $cnt < sizeof($aClasses); $cnt++) {
$updates['values'][] = $aClasses[$cnt];
}
$setup->addAttributeOption($updates);
die();
// Deleting attribute options
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$attribute = Mage::getSingleton("eav/config")->getAttribute("customer", "position");
//Values have to be deleted one at a time
// Eav Setup.php
$updates = array();
foreach ($attribute->getSource()->getAllOptions() as $option) {
$update['value'] = array();
$update['delete'][$option['value']] = true;
$update['attribute_id'] = $attribute->getId();
$update['value'][$option['value']] = true;
$updates[] = $update;
}
$setup->addAttributeOption($updates);
die();

jFile:move does not cause any error while it's failing to move the file

I actually managed to make an installation zip for a plugin that I made and in the installation script file, I included this code in the install function in order to copy some file in a folder within joomla in another directory.
class plgVmCustomPayeddownloadsInstallerScript {
function install($parent) {
$src = "plugins/vmcustom/payeddownloads/payeddownloads.php";
$destination = "components/com_virtuemart/controllers";
if(!JFile::move($src, $destination,JPATH_ROOT)){
echo "tried to move from ".$src." to ".$destination;
return false;
}
}
After the installation I keep getting an error in joomla, "unable to rename the file" and the file that was supposed to be moved commanded by the install function did not, despite the fact that the files within the installation.xml did actually get coppied and installed correctly.
Also within the installation script In the install function I included some sql which is executed normally without any problems.
and I also tried in the postflight function with no success.
Also I do not get any specific erros from the php_error.log
I also tried to create this weird test, with the above tester.php file in my root application of my joomla installation.
<?php
/**
* #package Joomla.Site
* #copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
* #license GNU General Public License version 2 or later; see LICENSE.txt
*/
// Set flag that this is a parent file.
define('_JEXEC', 1);
define('DS', DIRECTORY_SEPARATOR);
if (file_exists(dirname(__FILE__) . '/defines.php')) {
include_once dirname(__FILE__) . '/defines.php';
}
if (!defined('_JDEFINES')) {
define('JPATH_BASE', dirname(__FILE__));
require_once JPATH_BASE.'/includes/defines.php';
}
require_once JPATH_BASE.'/includes/framework.php';
// Mark afterLoad in the profiler.
JDEBUG ? $_PROFILER->mark('afterLoad') : null;
// Instantiate the application.
$app = JFactory::getApplication('site');
// Initialise the application.
$app->initialise();
// Mark afterIntialise in the profiler.
JDEBUG ? $_PROFILER->mark('afterInitialise') : null;
// Route the application.
$app->route();
// Mark afterRoute in the profiler.
JDEBUG ? $_PROFILER->mark('afterRoute') : null;
// Dispatch the application.
$app->dispatch();
// Mark afterDispatch in the profiler.
JDEBUG ? $_PROFILER->mark('afterDispatch') : null;
// Render the application.
$app->render();
// Mark afterRender in the profiler.
JDEBUG ? $_PROFILER->mark('afterRender') : null;
//plugins/vmcustom/payeddownloads/payeddownloads.php to
//components/com_virtuemart/controllers
jimport('joomla.filesystem.file');
$src = JPATH_ROOT."/plugins/vmcustom/payeddownloads/payeddownloads.php";
$destination = JPATH_ROOT."/components/com_virtuemart/controllers/";
echo $src."<br>";
echo $destination."<br>";
JFile::move($src,$destination);
?>
The file does not get moved from payeddownloads to controllers folder and it is not causing any error.
Also I need to mention that php.ini has error_reporting = E_ALL and display_errors = On.
Also the php_error.log captures the errors. If I type for example echo "lala"oo it will log the error and it will show it.
So I suspect that JFile::move has a bug and its not throwing any errors even though the file is not copied. Any suggestions please?
Try using the following instead. Few tweaks make to your code:
function install($parent) {
$src = JPATH_SITE . "/plugins/vmcustom/payeddownloads/payeddownloads.php";
$destination = JPATH_SITE . "/components/com_virtuemart/controllers";
if(JFile::exists($src)){
echo "File Exists!";
}
else{
echo "File Doesn't Exist!";
}
if(JFolder::exists($destination)){
echo "Destination Folder Exists!";
}
else{
echo "Destination Folder Doesn't Exist!";
}
JFile::move($src, $destination); // Move file
if(JFile::move($src, $destination)){
echo "File Successfully Moved!";
}
else{
echo "failed to move from ".$src." to ".$destination;
}
}
Even thought the thread is old, I found it having the same issue, maybe the solution could work for anybody else.
JFile::move requires a source and destination FILE path. In the above code the paths should look like follows.
$src = JPATH_SITE . "/plugins/vmcustom/payeddownloads/payeddownloads.php";
$destination = JPATH_SITE . "/components/com_virtuemart/controllers/payeddownloads.php";

Resources