Link to home
Create AccountLog in
Avatar of Bernard Bailey
Bernard BaileyFlag for New Zealand

asked on

Migrate Wordpress alongside a SuiteCRM site on UBUNTU 18.04 server

I need to migrate my wordpress site to reside on the same UBUNTU 18.04 server with SuiteCRM running PHP Version 7.2.19-0; Ubuntu 18.04.2

I have a /var/www/html directory on the target server where the suitecrm folder is located.

I am not sure where I restore my wp-admin, wp-content & wp-includes directories and wp-*.php files.  Do these get copied to this /var/www/html/ folder and update the refs in the wp-config.php file?

The database has been copied into the same MySQL server that the SuiteCRM is stored in.
Avatar of David Favor
David Favor
Flag of United States of America image

1) Run WordPress + SugarCRM out of 2x different directory hierarchies.

Call the WordPress install blog.foo.com + the SugarCRM install crm.foo.com or something like this, where you're 2x different code bases are in 2x separate directories.

2) SugarCRM 7.11.4 or below will work on PHP-7.2 + docs page suggests SugarCRM 7.11.5 requires PHP-7.3, so if you're starting from scratch, start with PHP latest, which today is...

lxd: net16-template-lamp # php --version
PHP 7.3.12-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Nov 28 2019 07:37:16) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.12, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.12-1+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

Open in new window


3) WordPress will work with any PHP-7.X version.

4) Better to build a directory hierarchy outside /var/www/html.

I normally use /sites/$project/$site/wordpress for WordPress installs.

Anything outside /var/www/html will work, as /var/www/html is technically owned by the packaging system so some future update might overwrite files in this directory.

5) No changes are required to your wp-config.php file... unless you're doing something very odd...

6) You said, "The database has been copied into the same MySQL server that the SuiteCRM is stored in."

If you mean you've actually created SugarCRM tables in your WordPress database... this... to me... is a horrible idea, related to long term maintenance. Better to have 2x separate databases, as the the backup systems for each have no clue about the other.

In other words, Wordpress has no clue about SugarCRM + SugarCRM has no clue about WordPress.

If for example someone runs some brain dead WordPress database cleaner (most cleaners are highly brain dead), then all your SugarCRM tables will be seen as orphaned... or non-WordPress tables + could potentially be dropped.

I've had to fix this type of nonsense before. Then it happens a great deal of time + money are required to get a site running again.
Avatar of Bernard Bailey

ASKER

Thanks David, very helpful information.

4) I'll push the wp site into the path you have suggested.

6) You said, "The database has been copied into the same MySQL server that the SuiteCRM is stored in."

No problems there, it is in a different database, named differently ; and shows up if you are at the database level in  Navicat.

Cheers
Bernard
Perfect!

Sounds like you're on track!

Be sure to also setup a similar path for your CRM.

For my projects, I'd use...

/sites/$project/blog.foo.com/wordpress

/sites/$project/crm.foo.com/sugar

Open in new window


Where project relates to the common project both these relate to, which could also be a client name.

My target, since I work with 1000s of sites is to be able to know at a glance, exactly what site is running in what directory + exactly the code for the site.

Where site is either a domain name or host name.
Hi David, Thanks for the extra detail,  I have created a path as below:

I have sanitised my actual domainname with 'mydomainname'

/<root>
     /bin
     /boot
     /dbc_mydomainname                                (no '.com' at the end)
           /blog.dbc_mydomainname.com
                  /wordpress
           /crm.dbc_mydomainname.com
                  /suitecrm
       /dev
       /etc
et al

Is this what you mean?

I can access suitecrm with this url mydomainname.com/suitecrm/ ;

but with WordPress I get "No webpage was found for the web address: http://mydomainname.com/wordpress/"

From here can you point me to an effective installation process that will install a dummy website?  I.E. step1; step2 etc.



Cheers
Bernard
Hi David,

I have edited the wp_options in  the database to show the following:

siteurl      http://mydomainname.com/connections/blog.mydomainname.com/wordpress
home      http://mydomainname.com/connections/blog.mydomainname.com/wordpress

Is this correct?

I gather I need to have the .htaccess with both WP and suitecrm sections in it?

The .htaccess file should reside in the http://mydomainname.com/connections/ folder?

Cheers
Bernard
File Layout - Looks good. This allows you or anyone else working on these sites to instantly know what code is running where.

Host Names - Your hostnames seem off a bit.

For me, I'd setup....

1) crm.foo.com to serve the /dbc_mydomainname/crm.dbc_mydomainname.com/sugarcrm files.

2) blog.foo.com to serve the /dbc_mydomainname/blog.dbc_mydomainname.com/wordpress files.

So avoid the /wordpress + /sugarcrm in your actual URLs.

You'll accomplish this by setting your Apache DocumentRoot directive to a file path for each host - blog + crm.
Tip: If you actually edited your database changing wp_options then your WordPress site will be unstable (no guess now it will work).

WordPress database editing requires using https://wp-cli.org or some other serialized data aware tool.

serialized data requires a mechanical/software tool to make edits.

Unsure if SugarCRM requires a similar tool.

You should never, ever, ever reference directory paths in your siteurl + home variables. This is done via Apache, never WordPress.

Both siteurl + home should be set to https://blog.foo.com + nothing else.

Random Aside: Starting sometime this year using HTTP rather than HTTPS will trigger a suspicious site message in all browsers.

100% of your sites, at this point, should be - HTTPS + HTTP2 + Brotli - for best visitor experience. Be sure to use HTTPS enhancements of HSTS + OSCP Stapling for highest performance.
Hi David,

Thank you for your patience.

Clearly I was misreading your instructions when you indicated to set things like: "/sites/$project/blog.foo.com/wordpress".  I had always thought 'foo.com' was a placeholder for the real domainname and you were implying I should replace the 'foo.com' accordingly.

However in reading your latest notes, I gather the ApacheServer picks up the request to 'mydomainname.com'  (my substituted domainname)  and redirects this to the local server address 'crm.foo.com' and serves up WordPress content from there?

From this, for a single site instance for both Suitecrm and WP, then I would have the instance code implemented in the following path structure.

/<root>
     /bin
     /boot
     /blog.foo.com
     /crm.foo.com
     /dev
     /etc

Is this correct?

Cheers Bernard.
ASKER CERTIFIED SOLUTION
Avatar of David Favor
David Favor
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Thank you David,

For your comments and suggestions.

Cheers
Bernard
You're welcome!

Glad you got this working!