Drush not recognizing drupal root folder - drupal

This one is driving me crazy.
Whenever i use "drush dl" to download site_audit or drupalgeddon it downloads these modules inside the drush home folder ( /users/[user]/.drush ) instead of the current sites modules folder.
the "drush status" and the "drush #site-alias status" command gives me the correct site information, see below:
C:\wamp\www\drupal>drush dl site_audit
Install location C:\Users\Thomas/.drush/site_audit already exists. Do you want
to overwrite it? (y/n): n
Skip installation of site_audit to [warning]
C:\wamp\www>drush #drupal status
Drupal version : 7.34
Site URI : localhost/drupal
Database driver : mysql
Database username : root
Database name : drupal
Default theme : garland
Administration theme : garland
PHP executable : php.exe
PHP configuration : C:\Users\Thomas.drush\php.ini
PHP OS : WINNT
Drush version : 6.0
Drush configuration :
Drush alias files : C:\Users\Thomas/.drush/aliases.drushrc.php
Drupal root : /mamp/htdocs/drupal
Site path : sites/default
File directory path : sites/default/files
Also, when i try to download a module that already exist in the current sites modules folder it tells me so correctly. Same goes for the "en" command. I can also disable or uninstall modules successfully. Uninstalling does not remove the folder, tough.
The only thing i have noticed is that "drush configuration" does not show a path. However, i did copy the example file inside the .drush home folder AND one inside the sites/all/drush folder (i removed the 'example' from the filename off course).
Running windows 8 and tried both MAMP and WAMP with same results. I really hope someone can help me with this cause i am pulling my hair here.
Update:
I tested the dl command with other modules and they are downloaded to the correct folder. I cleared the drush cache several times. Yet site_audit and drupalgeddon keep getting downloaded to the wrong folder. I just don't get it.

Stupid me. These are both not modules but Drush extensions, hence the alternative download locations.

I think the real problem is, that you didn't specify the site-alias in your "drush dl" statement.
You run
drush #site-alias status
containing the site-alias, but
drush dl site_audit
without a sie-alias. I suppose you are in the drush folder, as drush downloads to the current folder, if no root folder is given explicitly or via site-alias.

Related

Wordpress Plugins Couldn't Update: Could not create directory

Good day! Why is it that I am not able to update my plugins in my Wordpress Website.
In my FTP File I have already set my plugins folder to 755 then configured my wp-contents to 755. In my wordpress Site Health, this is what is written in File Permission
The main WordPress directory Writable
The wp-content directory Writable
The uploads directory Writable
The plugins directory Writable
The themes directory Writable
I have done everything written in this site and still I can't update any of my plugins. I don't know what is wrong anymore or what should I do.
I am using CWP, with WordPress 5.5.1 and PHP version 7.4.10
One way to solve this problem, trying to change the FTP permissions by the “wp-config.php” file.
There're some steps to fix “Installation failed, could not create directory.” From your web hosting account, open the “File Manager”. Within the root folder, locate the “wp-config.php” file.
In your “wp-config.php” file, enter the following passage of code.
NOTE: Replace the information in brackets with your information.
define(‘FS_METHOD’, ‘ftpext’);
define(‘FTP_BASE’, ‘/pathtorootofyourblog/’);
define(‘FTP_USER’, ‘ftpusername’);
define(‘FTP_PASS’, ‘ftppassword’);
define(‘FTP_HOST’, ‘yoursite.com’);
define(‘FTP_SSL’, false);
Save the “wp-config.php” file.
Return to your dashboard and try to install the plugin or upgrade once again. This time, it should be done without any problems.

Issue on drush 9 alias file location

According to this post and with local installation of Drush 9 as adviced by the official website (not globally installed), I put my Drush8 alias file into: ~/.drush/sites, in addition of the ~/www/domain/sited8/drush/sites default folder. And I edited the ~/.drush/drush.yml file to add my other path to alias files.
Then I run ~ $ drush site:alias-convert and get:
Absolute path to a directory for writing new alias files [~/www/domain/sited8/drush/sites]: !!
Then drupal ccreate converted files into this folder. It seem to ignore my other folder..
Actually I get only one website but I will add others, so I want to have my alias files into a root folder instead of a drupal website folder (it will not be a multisite install).
So why drush doesn't look an dwork into my ~/.drush/sites folder ?
EDIT: after convertion, I move files to ~/.drush/sites then with drush sa I get a list like :
'#sited8ce.prod':
root: ~/www/celony/sited8
uri: 'https://www.lycee-celony.com/'
'#sited8mg.dev':
root: ~/www/mgasquet/sited8
uri: 'http://d8-lycee-marie-gasquet.eu'
but when I try to use one of them I get partial status info:
$ drush #sited8ce.prod status
PHP binary : /php/7.2.14/bin/php
PHP config : ~/admin/config/php/php.ini
PHP OS : Linux
Drush script : ~/www/mgasquet/sited8/vendor/drush/drush/drush
Drush version : 9.7.1
Drush temp : /tmp
Drush configs : ~/.drush/drush.yml
~/www/mgasquet/sited8/vendor/drush/drush/drush.yml
Drush is locally installed in both websites but the drush folder is only present on one..I don't understand the logic here..
Because alias doesn't work:
~ $ drush #sited8ce.prod pml | grep goo
Command pml was not found. Pass --root or a #siteAlias in order to run Drupal-specific commands.

WordPress.com VIP theme activation issue - vip-init.php is not found

I am setting up my first VIP theme on Ubuntu 14.04 LTS computer by following instructions at:
https://vip.wordpress.com/documentation/vip/dev-environment/ and
http://docs.chassis.io/en/latest/quickstart/#prerequisites
At this point I have:
- Virtual Box 5.1 installed
- Vagrant 1:1.9.4 installed
Before writing the steps in detail here is my current folder structure
/var/www/html
|-> thevp (Chassis installation)
|-> wp
|-> wp-content/themes/vip/plugins
| | |-> vip-init.php
| |-> vp-theme (custom theme)
|-> mu-plugins
Vagrant URL: vagrant.local
Admin URL: vagrant.local/wp/wp-admin
After installing above two I installed Chassis inside /var/www/html/thevp folder. This installed a folder called wp, which I believe the default WordPress installation. So now I have /var/www/html/thevp/wp (plus other folders and files).
The wp-content folder sits inside "wp" folder.
Next I installed VIP Plugins and Helpers from svn co https://vip-svn.wordpress.com/plugins/ wp-content/themes/vip/plugins inside /var/www/html/thevp/wp/wp-content/themes/vip/plugins.
Then I installed VIP mu-Plugins inside /var/www/html/thevp/wp/wp-content/mu-plugins
And finally, I cloned my VIP theme from Github inside /var/www/html/thevp/wp/wp-content/themes/vp-theme
After all installations and cloning I ran $vagrant up from within /var/www/html/thevp/, which provisioned my Chassis Box and presented with the URL http://vagrant.local/.
The above URL runs fine and opens default site with TwentySeventeen theme.
Under Admin > Themes I can see my own theme vp-theme present along with other default themes WordPress has installed.
But whenever I am trying to Activate this theme I am getting this error message:
Warning:
require_once(/vagrant/content/themes/vip/plugins/vip-init.php): failed
to open stream: No such file or directory in
/vagrant/wp/wp-content/themes/vip/yrc-wordpress-theme/functions.php on
line 9
Fatal error: require_once(): Failed opening required
'/vagrant/content/themes/vip/plugins/vip-init.php'
(include_path='.:/usr/share/php') in
/vagrant/wp/wp-content/themes/vip/yrc-wordpress-theme/functions.php on
line 9
Assuming that /var/www/htm/thevp is not being recognized as the correct path becausd wp-content folder actually resides under /var/www/html/thevp/wp and this should be root, I destroyed running instance of VirtualBox and ran $ vagrant up again but this time from inside /var/www/html/thevp/wp.
But I still get the same error. Cannot figure out how to resolve this problem.
This is my first time with VIP theme. Please help!
UPDATE:
I checked my theme's functions.php for the following line
require_once WP_CONTENT_DIR . '/themes/vip/plugins/vip-init.php';
which is there, but I have a feeling that WP_CONTENT_DIR is probably outputting wrong path for some reason as the error message says
require_once(/vagrant/content/themes/vip/plugins/vip-init.php)...
I don't find any folder /vagrant/content. Got completely stuck here as I have no idea what to do next!
After long research and googling I finally got this to work.
The main reason for the error to come up was the content folder defined in config.yaml file.
When Chassis installs, it creates a file called config.yaml in its root. This is the default settings in the file under "path" section.
# Base directory for reference. Relative to the Chassis directory.
base: .
# Where WordPress lives. Relative to the base directory.
wp: wp
# Content directory. Relative to the base directory.
content: content
First thing I did was changed content: content to content: wp/wp-content. Thing to notice here is Chassis creates the default WordPress installation under "wp" not under "Wordpress".
Second thing I needed to change was from multisite: No to multisite: Yes in the same file.
However, while booting Virtual machine I encountered the following error:
It appears your machine doesn't support NFS, or there is not an
adapter to enable NFS on this machine for Vagrant
That got fixed by installing NFS Common and NFS Kernel Server
$ sudo apt-get install nfs-common nfs-kernel-server
I encountered another error during VitualBox booting with vagrant. It asked me for my sudo password. But after supplying it the execution failed and I received the following message on console:
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
mount -o 'vers=3,udp' 33.33.33.1:'/home/subrata/' /var/www
Stdout from the command: Stderr from the command: stdin: is not a tty
mount.nfs: requested NFS version or transport protocol is not
supported
To fix that I had to add the following lines in /etc/sudoers file.
vagrant ALL=(ALL) NOPASSWD:ALL
Defaults:vagrant !requiretty
Finally I am all set! $vagrant up has successfully booted my VM.
http://vagrant.local runs fine as well as now I am able to activate my own VIP theme for the first time :)

How to install site-specific modules in a Drupal 7 multi-site?

I have a "multi-site" installation of Drupal 7, which means that I have these folders in my "sites" folder:
all
domain.one
domain.two
domain.x
And in each of these folders, I also have "modules" and "themes" folders.
If I click the "install new module" link on the modules page ("admin/modules") from any domain X, Drupal tries to download modules in the "all/modules" folder instead of the "X/modules" folder.
Maybe I am not using the proper phrase to search in Google, but I do not see similar problems, so it may just be my problem.
How to install site-specific modules in a Drupal 7 multi-site?
You can try the example detailed out in this post: http://www.pixelclever.com/how-set-up-drush-for-multisite-installation which basically requires you to create a drushrc.php file for each multisite, which includes the path to the respective modules folder.
Here are the lines from that post that explain
To start, go to your drush folder where you will find a file entitled example.drushrc.php. Copy that file into the individual site folder in your Drupal multisite installation (sites/yourmultisite), and rename the file to drushrc.php.
Now open that file and add the following line:
$command_specific['dl']['destination'] = 'sites/yourmultisite/modules';
or
$command_specific['dl']['destination'] = 'sites/yourmultisite/modules/contributions';
This is also a step by step walkthrough of the updating process using drush on multisites.
http://rinen.net/2013/02/updating-a-drupal-multisite-using-drush/
I found good article for multisite install here,
http://mydons.com/drupal-7-multisite-install-steps-in-linux/
http://mydons.com/drupal-7-multisite-install-steps-in-windows/
This worked for me:
Changed working directory on terminal to specific site directory
i.e. "cd [drupal_site_directory]/sites/[site_one]/ "
use usual drush command to install modules i.e. "drush dl [module_name]"
Hope this might help you guys also.
.

Unable to create directory wp-content/uploads in Wordpress

I created php files for my plugin and added them to myplugin folder. Then I zipped myplugin folder as myplugin.zip. In Admin Panel of Wordpress I wanted to install my plugin to wordpress. I choosed this zip file and clicked to Install "Now button". Then Wordpress gave an error:
Unable to create directory wp-content/uploads/2013/05. Is its parent directory writable by the server?
What is the problem and how can I solve it? My OS is Linux and I use XAMPP server in my machine.
In your terminal, navigate to the wp-content folder and then run:
chmod -R 0744 plugins
That will set the folder and its subfolders to read/write/execute for you and read for everyone else.
Edit As suggested in the comments, check this out: codex.wordpress.org/Changing_File_Permissions
Alternatively you can just unzip them yourself and save them into this folder:
/wp-content/plugins/name-of-theplugin
Then you can just activate the plugin from the admin page.
I am not entirely familiar with XAMPP but it should be run as a user. Most likely your own windows account. You may try this:
Select the folder wp-content and right click -> properties. then go to Security Tab. There check to see if the User (i.e. you) has write+ modify permission.
Check what is XAMPP server running as, the folder above must have the permissions for the same user.
Double check the "general" tab on the wp-content folder and check the "Attributes" section. Make sure "Read Only is unchecked. If you are changing it, windows will prompt for whether to apply to subfolder. Say "yes".
. Or run XAMPP at Administrator and skip the above step .(assuming it is not production / public internet facing server).
I had this problem yesterday, I solved it by uninstalling the Wordpress module and installing it again as root from the terminal.
I thought if I run the installation wizard as I was logged as root was enough, but it wasn't.
These are the steps for MacOS:
Uninstall wordpress module. Be sure the folder is empty.
Mount the wordpress disk image
cd /volumes/nameOfWordpressModule image
sudo bitnami wordpress module.app/Contents/MacOS/installerbuilder.sh
I recommend you to list the items so you can write exactly the name of the image and app.
Hope it helps!
navigate to your main project folder and run the following:
chmod -R 0777 wp-content
in case of MAC run
sudo chmod -R 777 /Applications/XAMPP/htdocs/

Resources