Renaming Admin Folder in Opencart - opencart

I'm new to opencart. While I understand the security benefits of renaming the admin folder and renaming all instances of 'admin' in the config file, my question is, if for example I install a payment extension that comes with its own admin and catalog folder to be merged, do I also rename the extensions admin folder to reflect the new change?
The .htaccess file isn't an option for now as my IP address isnt static.
Thanks for your anticipated reply.

Steps to Change OpenCart Admin Dashboard URL & Folder
Log into your hosting account cPanel, or FTP
Navigate to the folder containing the “admin” folder. It is usually the “public_html” or “/var/www/html” folders.
Right click on the “admin” folder and choose the “rename” option from the dropdown
Enter the new folder name for the “admin” folder. Use an un-common name which is hard to guess and completely unrelated to your business. (For eg: “STA22R1”, “ROCKETSCIENCE74851”)
Now, edit the /admin/config.php and replace ALL instances of the word ‘admin’ with the new folder name you have chosen in the above step.
// HTTP
define('HTTP_SERVER', 'http://test.domain.com/opencart/**admin**/');
define('HTTP_CATALOG', 'http://test.domain.com/opencart/');
// HTTPS
define('HTTPS_SERVER', 'http://test.domain.com/opencart/**admin**/');
define('HTTPS_CATALOG', 'http://test.domain.com/opencart/');
//DIR
define('DIR_APPLICATION', '/home/userna5/public_html/opencart/**admin**/');
define('DIR_SYSTEM', '/home/userna5/public_html/opencart/system/');
define('DIR_DATABASE', '/home/userna5/public_html/opencart/system/database/');
define('DIR_LANGUAGE', '/home/userna5/public_html/opencart/**admin**/language/');
define('DIR_TEMPLATE', '/home/userna5/public_html/opencart/**admin**/view/template/');
define('DIR_CONFIG', '/home/userna5/public_html/opencart/system/config/');
define('DIR_IMAGE', '/home/userna5/public_html/opencart/image/');
define('DIR_CACHE', '/home/userna5/public_html/opencart/system/cache/');
define('DIR_DOWNLOAD', '/home/userna5/public_html/opencart/download/');
define('DIR_LOGS', '/home/userna5/public_html/opencart/system/logs/');
define('DIR_CATALOG', '/home/userna5/public_html/opencart/catalog/');
// DB
define('DB_DRIVER', 'mysqli');
define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'username_example');
define('DB_PASSWORD', 'password');
define('DB_DATABASE', 'username_example');
define('DB_PREFIX', 'oc_');
If you are using vQmod, you will have to update the pathReplaces.php file, located in the /vqmod directory. The code to rename the ‘admin’ folder should already be there. It would be similar to the code shown below:
$replaces[] = array('~^admin\b~', 'backend');
Replace the word backend with the new folder name we have chosen in the above steps.

If you renamed the admin folder name then the other extension you are trying to install that will not work because the other extension is looking for the admin folder that folder is doesn't exists in the directory so, it will you the error like no /admin directory exists. But if you renamed the extension folder name as to your opencart admin then it may depend if your extension has install.xml then it will not work properly if there is no install.xml then it will work properly. I hope this answer will help you if you like this then please vote for it.

Related

How to set repository as the root when using /docs as the source for Github pages?

If I set my githubpages repo to <username>.github.io, anything in the root gets displayed on <username>.github.io
But I want to use the /docs feature so I can have a static site generator in the root of the project that outputs to the /docs folder
so the docs say
- have a /docs folder in the root of the repository
- not follow the repository naming scheme <username>.github.io or <orgname>.github.io
so, I rename my repo, "blah"
but now nothing shows up at <username>.github.io and the page is at <username>.github.io/blah
so when using /docs how do you set the repo as the root of the site <username>.github.io?
After contacting github support, it turns out you can't ( currently ) you need to use one of their other methods that use <username>.github.io
I found the same problem with this.
After hours of try I figured out that:
If you use a repository named '.github.io' or '.github.com', you could only use their pre-provided file structure, which means you can't select the source for the github-pages service.
If you rename the repo to other name which not match the auto-serve pattern(.github.io| ...com), you will be able to choose the source.
If case [2], you need to add an empty file named '.nojekyll' under /docs folder, and put all files including CNAME and index.html and asset files(images, css,etc.,) here.
ref: https://www.docslikecode.com/articles/github-pages-python-sphinx/

EC2 FTP User Directory change

Our EC2 instance setup has an ftp user that had successful setup through the vsftpd program with an original home directory of \home\user\, I followed the instructions on this stack overflow, and had the user's shell set to /bin/false
What I'm looking to do is make the ftp user login only accessible to a particular directory, a folder in the html directory - \var\www\html\website.com\userfolder
What I've done:
Added user to a group ftpgroup
Authorized access and ownership of the new directory to the user:ftponly
Changed the user's home directory in /etc/passwd
added .ssh/authorized_keys with user's key in the new directory
changed ChrootDirectory in /etc/ssh/sshd_config to new directory
changed the permissions on the directory to chmod -R 775 user:ftpgroup
mounting \var\www\html\website.com\userfolder
Before these changes I was able to access the FTP, and now upon attempted access I receive the following errors from the Filezilla client:
Error: Disconnected: No supported authentication methods available
(server sent:publickey) ... Status: Connection attempt failed with
"ETIMEDOUT - Connection attempt timed out"
As it was working before, I'm thinking that it might have something to do with permissions, I'm just unsure of where else to change.
Thanks for any insight.
This worked for me.
After creating the user with vsftpd, the user now has access to the directory via FileZilla.
I then added a link from the home/{user} directory to the /var/www/html/{user} directory.
The user can upload files to the home directory and can view it from the html directory.
This is a simple hack. Let me know if this solves your problem.

Opencart Extension Installation issue

Facing this problem while installing opencart extension at localhost
Your issue is related with in correct ftp details or no ftp details added in
Admin - System - Settings - Store - Edit - Ftp
You can contact your host for FTP details.
You just need to update max_execution_time = 120 value in your php.ini file.
Or
You can add a php.ini file with max_execution_time = 120 value in /admin folder.
Or
You can add below code to .htaccess file too:
php_value max_execution_time 120
This will surely resolve the issue.
Use "FTP QuickFix" by iSense.
https://www.opencart.com/index.php?route=marketplace/extension/info&extension_id=18892
This extension allows install extension without FTP settings. It could be helpful if you have any FTP-related error by extension installation.
You need to download and unzip this mod first.
Then, admin panel > Extensions > Extension Installer.
Click the Upload button and select the .xml file that you previously unzipped. Navigate to Extensions > Modifications and click on the Refresh button at the top right corner of the screen.
This is it.

Opencart - can't upload images

I moved a OpenCart version 1.5.6.4 installation from one server to another and after some time I noticed I can't upload images anymore. Whenever I use the image manager to upload the images it just gets stuck, the spinner wheel keeps spinning but the images are not uploading.
I tried changing the folder pemissions of the image and data folders to 777 and cleared the cache. I also tried to upload an extension that allows for multiple files uploads hoping that somehow magically it would fix the problem, needless to say, it didn't. Haven't found a solution on SO or OC forums.
My best guess is that the problem lies in the config files.
I runned a phpinfo(); and you can check it at http://atelier-faiblesse.ro/info.php.
The admin config contains the following code:
<?php
// HTTP
define('HTTP_SERVER', 'http://atelier-faiblesse.ro/admin/');
define('HTTP_CATALOG', 'http://atelier-faiblesse.ro/');
// HTTPS
define('HTTPS_SERVER', 'http://atelier-faiblesse.ro/admin/');
define('HTTPS_CATALOG', 'http://atelier-faiblesse.ro/');
// DIR
define('DIR_APPLICATION', '/var/www/clients/client9/web72/web/admin/');
define('DIR_SYSTEM', '/var/www/clients/client9/web72/web/system/');
define('DIR_DATABASE', '/var/www/clients/client9/web72/web/system/database/');
define('DIR_LANGUAGE', '/var/www/clients/client9/web72/web/admin/language/');
define('DIR_TEMPLATE', '/var/www/clients/client9/web72/web/admin/view/template/');
define('DIR_CONFIG', '/var/www/clients/client9/web72/web/system/config/');
define('DIR_IMAGE', '/var/www/clients/client9/web72/web/image/');
define('DIR_CACHE', '/var/www/clients/client9/web72/web/system/cache/');
define('DIR_DOWNLOAD', '/var/www/clients/client9/web72/web/download/');
define('DIR_LOGS', '/var/www/clients/client9/web72/web/system/logs/');
define('DIR_CATALOG', '/var/www/clients/client9/web72/web/catalog/');
// DB
define('DB_DRIVER', 'mysqli');
define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'XXXXXXXX');
define('DB_PASSWORD', 'XXXXXXXX');
define('DB_DATABASE', 'XXXXXXXX');
define('DB_PREFIX', 'oc_');
?>
Do you notice any problems in the config file? Or do you know any other reasons file uploading might not work?
Run below commands from ssh to fix this issue.
chown -R www-data /var/www/clients/client9/web72/web/image
chmod -R 755 /var/www/clients/client9/web72/web/image

Fatal error: require_once() - After moving htdocs to another drive

Fatal error: require_once(): Failed opening required 'C:\xampp\htdocs/system/startup.php' (include_path='.;N:\New folder\php\PEAR') in N:\New folder\htdocs\index.php on line 23...
This error is showing on localhost server when I had to uninstall XAMPP folder from c: drive but I took backup of htdocs and MySQL folder and when I reinstall XAMPP in n: drive and copy paste old htdocs and MySQL to new files, this error is showing...
2nd problem which I am facing is that my SQL is not running on XAMPP control panel whereas
Apache is running without any issue...
What can be the reason for this error?
OpenCart uses two config.php files, one at root and another in admin folder. In these files some global variables are defined containing also paths to installation folder. When you installed the OC, it automatically find the paths and write them into both config files.
But when you changed the directory of your OC (moving on disk, uploading to server), they don't update automatically and you need to do this manually:
// DIR
define('DIR_APPLICATION', '/path/to/public_html/catalog/');
define('DIR_SYSTEM', '/path/to/public_html/system/');
define('DIR_DATABASE', '/path/to/public_html/system/database/');
define('DIR_LANGUAGE', '/path/to/public_html/catalog/language/');
define('DIR_TEMPLATE', '/path/to/public_html/catalog/view/theme/');
define('DIR_CONFIG', '/path/to/public_html/system/config/');
define('DIR_IMAGE', '/path/to/public_html/image/');
define('DIR_CACHE', '/path/to/public_htmll/system/cache/');
define('DIR_DOWNLOAD', '/path/to/public_html/download/');
define('DIR_LOGS', '/path/to/public_html/system/logs/');
E.g. if you have old paths like this one:
define('DIR_APPLICATION', 'c:/htdocs/catalog/');
And now you moved it to n:/New folder, change all the paths accordingly, e.g.
define('DIR_APPLICATION', 'n:/New folder/htdocs/catalog/');