magento 2 - How to enable extension without upgrade magento - magento2

I followed some steps for installing extension on magento 2.
1) Upload extension folder to code directory
2) Run following command in CMD:
php bin/magento setup:upgrade
When i run this command my theme css and images were removed and set default.

Look in this file
app/etc/config.php
<?php
return array (
'modules' =>
array (
'Magento_Store' => 1,
'Magento_AdminNotification' => 1,
'Magento_AdvancedPricingImportExport' => 1,
(...)
'Magento_WishlistSampleData' => 1,
),
);
Add your module to the list, assign '1' to it and clear all enabled caches using
php bin/magento cache:clean
Assigning '0' to a module disables it also.
I suggest you check the Magento mode: Developer or Default. If you need to set it:
magento deploy:mode:set developer
More info over here: http://devdocs.magento.com/guides/v2.0/install-gde/install/cli/install-cli-subcommands-enable.html

I don't think it available. Because bin/magento setup:upgrade will be call install script/upgrade script make sure module stable to work, If you want to do that only 1 way that is updated record in table setup_module

After the adding exteion to your store you have to run these commands:
php bin/magento setup:upgarde
php bin/magento setup:static-content:deploy -f
php bin/magento cache:clean
php bin/magento cache:flush

Related

Installing php extension for SQL Anywhere on server with CentOS, Plesk, php-fpm

we got a new WebServer with CentOS, Plesk and php-fpm.
Now we don't get the php extension running.
What we did:
installed latest SQL Anywhere 17 (ebf29577)
copied php-7.3.0_sqlanywhere_r.so to /opt/plesk/php/7.3/lib64/php/modules/
loading php-7.3.0_sqlanywhere_r.so via /opt/plesk/php/7.3/etc/php.d/sqlanywhere.ini
this leads to an error:
WARNING: [pool plesk-php73-fpm.plesk-service.localdomain] child 11616 said into stderr: "NOTICE: PHP message: PHP Warning: request_startup() for sqlanywhere module failed in Unknown on line 0"
(This leads to php 7.3 fpm is not loading at all)
next try was to switch from FPM to CGI: same error
module is loadable itself within shell if LD_LIBRARY_PATH was enhanced with path /opt/sqlanywhere17/lib64/
some tries getting the cause by strace did not help
Has anybody an idea or maybe even successfully installed php extension.
Thanks
Florian
after a lot of tests we found a solution:
in Plesk Domain php settings we had to add:
[php-fpm-pool-settings]
env[LD_LIBRARY_PATH]="/opt/sqlanywhere_v2/lib64:$LD_LIBRARY_PATH"
Now all libs are found and it works
For me solution was, creating custom handler:
plesk bin php_handler --add -displayname "PHP SQLAnywhere 7.4" -path /opt/php-custom-handlers/7.4/php-sqlanywhere.fcgi -clipath /opt/plesk/php/7.4/bin/php -phpini /opt/plesk/php/7.4/etc/php.ini -type fastcgi
php-sqlanywhere.fcgi contents:
#!/bin/bash
LD_LIBRARY_PATH=/opt/sqlanywhere17/lib64
export LD_LIBRARY_PATH
exec /opt/plesk/php/7.4/bin/php-cgi "$#"
And finally using this handler on domain php settings and adding on additional directives:
extension=sqlanywhere.so

Multi-theme (nginx server) specific theme css, js not loading

Very strange issue, one specific (multi-store) theme css and js are not loading. The server is "nginx". I run multiple times below static-content command.
php -dmemory_limit=-1 bin/magento setup:static-content:deploy --theme Test/testdealer en_US -f
Other stores are working fine except Test/testdealer
Please help.
If multi-stores, then please define the correct language "locale", while running static-content deploy command.
Please verify the store "locale" via:
admin->stores->configuration->select store-view->general->general->locale options->locale (store view)...
If locale is "English (Australia)", then static-content command must be:
php -dmemory_limit=-1 bin/magento setup:static-content:deploy --theme Test/testdealer en_AU -f
Thanks,

Connect yii2 with mongodb

I am new to Yii2. Can anyone tell me how to configure YII2 with mongodb and how to establish connection between YII2 and mongodb? I have tried to download the mongodb package from git hub and tried to run the following command
php composer.phar require --prefer-dist yiisoft/yii2-mongodb "*"
In the command prompt inside the root folder where I have installed Yii2 but I get the following error
Your requirements could not be resolved to an installable set of packages.
Problem 1
- yiisoft/yii2 2.0.0 requires bower-asset/jquery 2.1.*#stable | 1.11.*#stable -> no matching package found.
- yiisoft/yii2 2.0.0 requires bower-asset/jquery 2.1.*#stable | 1.11.*#stable -> no matching package found.
- Installation request for yiisoft/yii2 == 2.0.0.0 -> satisfiable by yiisoft/yii2[2.0.0].
If you are trying to install it through command prompt then try the following command which using composer
composer require --prefer-dist yiisoft/yii2-mongodb "*"
This works in my windows 8 environment.
To ignore dependency errors while installing the package use --ignore-platform-refs switch:
composer require --ignore-platform-refs --prefer-dist yiisoft/yii2-mongodb "*"
Remember that you must also have the MongoDB extension installed in PHP for this plugin to work:
http://php.net/manual/en/class.mongodb.php
Seems like problem was with yii2 composer dependencies, Kindly RUN this command in your console to add global dependencies,
1) composer global require "fxp/composer-asset-plugin:~1.1.1"
2) Add "yiisoft/yii2-mongodb": "~2.0.0" in your composer.json file
3) Now run composer install or composer update
4) Composer install will only install require packages in your composer file but composer update will also check if there is any new release for your packages that you mentioned in composer.js and then install the new release.
5) now add below code in your common/config/main.php file
return [
//....
'components' => [
'mongodb' => [
'class' => '\yii\mongodb\Connection',
'dsn' => 'mongodb://developer:password#localhost:27017/mydatabase',
],
],
];
Now is the time to test either mongoDb working or not.
$collection = Yii::$app->mongodb->getCollection('customer');
$collection->insert(['name' => 'John Smith', 'status' => 1]);
For further information Please follow below link,
https://github.com/yiisoft/yii2-mongodb
'mongodb' => [
'class' => '\yii\mongodb\Connection',
'dsn' => 'mongodb://127.0.0.1:27017/vinagex',
'options' => [
"username" => "vinagex",
"password" => "vinagex"
]
],

How to configure and use Mailgun's SDK with composer-php?

I installed Composer and a SDK for Mailgun's service. These are the steps i followed:
# current directory
cd ~
# Install Composer
curl -sS https://getcomposer.org/installer | php
# Add Mailgun as a dependency
php composer.phar require mailgun/mailgun-php:~1.7
According to the instructions, all I did after that was (index.php):
<?php
require 'vendor/autoload.php';
use Mailgun\Mailgun;
# First, instantiate the SDK with your API credentials and define your domain.
$mg = new Mailgun("key-my-key-goes-here-987654321");
$domain = "somedomain.com";
Then, I tried to get the list of bounced emails:
$data = $mg->get("$domain/bounces", array('limit' => 15, 'skip' => 0));
var_dump($data);
...and I'm getting this error:
Warning: require(vendor/autoload.php): failed to open stream: No such
file or directory in /var/www/html/index.php on line 2 Fatal error:
require(): Failed opening required 'vendor/autoload.php'
(include_path='.:/usr/share/pear:/usr/share/php') in
/var/www/html/index.php on line 2
So I'm guessing it has something to do with composer's installation/configuration perhaps? Thanks for any help...
The way you programmed it, you must have the following files all in the same directory:
composer.json
index.php (your test script)
And you must have run the composer require command while being inside this directory. This will also create a directory named vendor here, and add plenty of files, amongst them vendor/autoload.php.
If however your test script isn't in this location, the require call will not find the file where you tell PHP to find it. This isn't any failure of Composer, but simply the fact that you have to include that file according to your situation, not by copy&paste code. If you change the path of your test script, you have to change the path of the vendor directory as well.

how to configure doctrine command line tools on zenframework 2

i am using doctrine 2 on zendframework 2. i have configured both correcly and they are both working.
i however wish to use doctrine's command line tool to generate entities etc.
i have followed doctrine's instructions and created a cli-config.php page in the root of my application:
http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/configuration.html
i am however lost on two issues;
the configuration requires a bootstrap php page; however, zendframework 2 does not use a bootstrap page; so what would the equivalent be?
Secondly, it requires us to obtain an entity mangager; would the method below be the correct way to get the entity manager:
public function getEntityManager()
{
if (null === $this->em) {
$this->em = $this->getServiceLocator()->get('doctrine.entitymanager.orm_default');
}
return $this->em;
}
below is how the cli-config.php page should look;
// cli-config.php
require_once 'my_bootstrap.php';
// Any way to access the EntityManager from your application
$em = GetMyEntityManager();
$helperSet = new \Symfony\Component\Console\Helper\HelperSet(array(
'db' => new \Doctrine\DBAL\Tools\Console\Helper\ConnectionHelper($em->getConnection()),
'em' => new \Doctrine\ORM\Tools\Console\Helper\EntityManagerHelper($em)
));
i would really appreciate any help or advice on this matter.
warm regards
Andreea
the matter has been resolved:!!
it did not work because i was using a cygdrive command line. however, when i switched to git bash it worked perfectly. with git bash i have to use the command:
C: > cd project-directory
project-dir > vendor\bin\doctrine-module orm:validate-schema
If you have started your project using the Zend Skeleton Application you do have a composer.json file. You just need to include the DoctrineORMModule (instructions here)
Then, using the CMD just type
C: > cd project-directory
project-dir > vendor\bin\doctrine-module orm:validate-schema
There you go.
Once you have set up doctrine2 and zf2, you should be able to simply run all CLI commands.
php public/index.php orm:generate-entities
Using the parameters as described in the official documentation.
Note: DoctrineModule and DoctrineORMModule need to be enabled within your application.config.php
You need to install the doctrine/doctrine-orm-module with your Composer dependency manager. To do that, cd to your web site's top-level directory and type the following command:
php composer.phar require doctrine/doctrine-orm-module *
After executing this command, the DoctrineModule and DoctrineOrmModule will be installed into your vendor folder, and Doctrine commands will become available.
For more information about DoctrineOrmModule, see this:
https://github.com/doctrine/DoctrineORMModule