I want to create a multisite Drupal 8 site. I would like to keep the default site, and then add another site. This is all being done on a WAMP stack and is on a locahost. These are the steps I have taken, but have not worked:
Downloaded most recent Drupal 8 and unzipped (and moved files) to www/my_primary_site
I created two databases in MySQL: site1, site2
in the www/my_primary_site/sites folder, I did the following:
a. Created a folder called "my_second_site"
b. Created a file called sites.php.
c. In sites.php, I have this code:
$sites = array(
'8080.localhost.my_primary_site' => 'default',
'8080.localhost.my_primary_site/my_second_site' => 'my_second_site',
);
I then go to localhost/my_primary_site. This brings me to the Drupal install (localhost/my_primary_site/core/install.php). But, if I go to localhost/my_primary_site/my_second_site, it just redirects me back to localhost/my_primary_site/core/install.php.
I would expect that the second link would take me to a different install path. Is this correct? If not, how would I fix this?
thanks
jason
Make sure to copy the default settings.php and services.yml to the new folder.
Try using the format of using . instead of /' like this:
$sites = array(
'8080.localhost.my_primary_site' => 'default',
'8080.localhost.my_primary_site.my_second_site' => 'my_second_site',
);
Make a symbolic link in your root directory that points to the main Drupal folder.
ln -s /drupal /my_primary_site/my_second_site
Try using this:
$sites['site1.localhost'] = 'site1';
$sites['site2.localhost'] = 'site2';
Also, make sure you add this domain to your etc/hosts file:
127.0.0.1 site1.localhost
127.0.0.1 site2.localhost
There are two approaches :
Try using sysmlinks functions in file myfile.php
2.Using sites.php in /drupal/sites folder
$sites['site1'] = 'site1';
$sites['site2'] = 'site2';
Related
I am using Valet+ for my Magento projects.
Currently I’m trying to add WP integration for M2 project. I put wordpress copy into pub/wp/ directory and want to go through the installation process, but I’m receiving 404 error when I’m trying to access url like https://magento2.test/wp/
Could anyone advice for it?
Thank you!
You can use custom valet driver for it.
Copy Magento2ValetDriver.php into magento root directory and rename it to LocalValetDriver.php
Also, change the class name to LocalValetDriver in it.
In the function frontControllerPath, add the following code at the top.
if ($uri === '/wp') {
$_SERVER['DOCUMENT_ROOT'] = $sitePath . '/pub/wp';
return $sitePath . '/pub/wp/index.php';
}
I have a WP installation in the root-folder, and some other WP installations in sub-directories
example.com => has WP-installation in root folder
example.com/project1 => folder named "project1" resides in root and has own WP-installation
everything works fine, except uploads.
Let's say, I'm in example.com/project1/wp-admin and want to upload a file:
Expected behaviour:
file is uploaded to /project1/wp-content/uploads
DB-entry is created in project1-database
Actual behaviour:
file is uploaded to /wp-content/uploads (root-folder)
DB-entry is created in project1-database
I've tried changing upload_dir, resulting into the same behaviour:
define('UPLOADS', 'project1/wp-content/uploads');
I also tried changing the wp_content_dir:
define( 'WP_CONTENT_DIR', dirname(__FILE__).'/project1/wp-content' );
But this gives me an error, like "Can't upload to /project1/wp-content/uploads/2018/09'.
What am I doing wrong here?
Ok, got it fixed now:
I was on the right path with:
define( 'WP_CONTENT_DIR', dirname(__FILE__).'/project1/wp-content' );
The error that I got, was because I created the folder for the mounth by hand as root, and therefore the permissions were wrong.
I am trying to add a function from plugin 1(wp job manager) to plugin 2(woocommerce).
I have decided to do this by including the php file from plugin 1, however I am unable to locate the file directory. I have used:
include( plugin_dir_path( __FILE__ ) . 'wp-job-manager/includes/class-wp-job-manager-applications.php');
but it returns the following error:
Warning:
include(/home/content/p3pnexwpnas05_data02/78/2394078/html/wp-content/themes/listify-child/wp-job-manager/includes/class-wp-job-manager-applications.php): failed to open stream: No such file or directory in
/home/content/p3pnexwpnas05_data02/78/2394078/html/wp-content/themes/listify-child/functions.php
on line 77
Please advise me as I've been stuck on this issue for really long... Thanks!!!
Wordpress setups have a constant ABSPATH defined (look at the bottom lines of wp_config.php) which points to the full and absolute path of the Wordpress setup, so in your case echo ABSPATH; would return /home/content/p3pnexwpnas05_data02/78/2394078/html/.
For most installations, appending wp-content/plugins/ to that string would point you to your plugins directory.
However, in a Wordpress configuration one can also customize the wp-content and or plugins directory to their own preference, so building plugins on ABSPATH.'wp-content/plugins/ is not recommended. Unfortunately Wordpress simply doesn't have a get_absolute_pluginspath() function or something available. A trick would be to fetch the plugins-URL, and remove the site-URL from it, so the remaining data is wp-content/plugins/ (or whatever the user has made of it). In code:
$plugins_directory = ABSPATH.str_replace(site_url()."/","",plugins_url())."/";
Which in your case would return:
/home/content/p3pnexwpnas05_data02/78/2394078/html/wp-content/plugins/
You probably mean:
plugin_dir_path(__FILE__)
That gives you the directory path to the file that statement is in. So what that returns depends on where you run it. If you use this statement
include( plugin_dir_path(__FILE__) . 'wp-job-manager/includes/class-wp-job-manager-applications.php');
in the main plugin file for wp_job_manager (probably wp_job_manager.php), then plugin_dir_path(__FILE__) give the path of the directory that file is in (the plugin directory).
If you use it in some other file, you will need to adjust the rest of the path string accordingly.
I'm using Drush 4.2 and I'm trying to rsync files from a the dev server to my local machine. My aliases.drushrc.php is located in the root of my local drupal installation and has the following in it:
$aliases['local'] = array(
'root' => '/Users/christian/Sites/site-root',
'path-aliases' => array(
'%files' => 'sites/default/files'
),
);
$aliases['dev'] = array(
'root' => '/var/www/vhosts/some-domain.com/subdomains/dev/httpdocs',
'remote-host' => 'some-domain.com',
'remote-user' => 'root',
'path-aliases' => array(
'%drush' => ' /var/tools/drush/drush',
'%files' => 'sites/default/files',
),
);
As a test I try to run this from the local drupal root:
drush rsync #dev:%files ~/Desktop/test/
I expect #dev:%files to expand to the remote file path but instead I get:
You will destroy data from /Volumes/MacintoshHD/Users/christian/Desktop/test/ and replace with data from #dev:/Volumes/MacintoshHD/Users/christian/Sites/site-root/%files
Any ideas?
UPDATE:
I've also found that when I'm try the command:
drush dd #dev:%files
I get
Target '#dev:%files' not found.
UPDATE 2
I've found that the issue seems to be coming from the location of the aliases.drushrc.php file. I had it in the drupal root of the site I was working on. I found that if I moved it to ~/.drush/ then everything worked perfectly.
I'd prefer to have it under source control though. I tried putting it in sites/default/ but it had the same problems as before. I'll award the bounty to whomever tells me where to put this file so it's under the source controlled site root.
You can set the alias path in your drushrc.php config file.
If this is not set, then drush searches these locations (in this order) for the alias file.
/etc/drush
drush installation folder
$HOME/.drush
insides the sites folder of your drupal site
Check the readme for more details.
BTW: You have a comma missing in your declaration of 'local' alias.
Modify it as:
'%files' => 'sites/default/files',
I don't understand why I get this error when I upload images...
The selected file intersection.png could not be uploaded. The file is not a known image format.
It is just a png file, and the problem came when I moved the website on the server. On localhost everything was perfect.
1) I've deleted the "files" folder and created it again with a php script (to make the server the owner)
2) drupal automatically creates 2 folders into it (imagecache and temp) so I assume it has the privilegies to write into it.
3) I've changed the temporary folder in Settings > Filesystem from "/tmp" to "temp", since I got an error before (probably the /tmp folder on the server is not writable by drupal
thanks
http://drupal.org/project/transliteration I think this module help me in my problem related this issue.
There's a known problem with Drupal 6.15 and IIS (see http://drupal.org/node/419734). If you're on 6.15, try backing down to 6.14 until a fix is completed.
I solved it. The rewrite module is not enabled on my IIS server, so I had to change a line of code inside the imagecache.module to add "index.php?q=
return url($GLOBALS['base_url'] . '/index.php?q=' . file_directory_path() .'/imagecache/'. $presetname .'/'. $path, $args);