Migrate Wordpress alongside a SuiteCRM site on UBUNTU 18.04 server

Bernard Bailey
Bernard Bailey used Ask the Experts™
on
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.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
David FavorFractional CTO
Distinguished Expert 2018

Commented:
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.
Bernard BaileyDatabase Engineer

Author

Commented:
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
David FavorFractional CTO
Distinguished Expert 2018

Commented:
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.
11/26 Forrester Webinar: Savings for Enterprise

How can your organization benefit from savings just by replacing your legacy backup solutions with Acronis' #CyberProtection? Join Forrester's Joe Branca and Ryan Davis from Acronis live as they explain how you can too.

Bernard BaileyDatabase Engineer

Author

Commented:
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
Bernard BaileyDatabase Engineer

Author

Commented:
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
David FavorFractional CTO
Distinguished Expert 2018

Commented:
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.
David FavorFractional CTO
Distinguished Expert 2018

Commented:
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.
Bernard BaileyDatabase Engineer

Author

Commented:
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.
Fractional CTO
Distinguished Expert 2018
Commented:
Tip: Better to arrange all your sites under some common directory, like /sites or something.

This keeps sites easily organized, rather than polluting / with many odd site directories.

Your approach will work fine, till you start adding many sites + then someone comes along + tries to understand exactly what's occurring.

And yes, to your question. I normally arrange all sites under /sites/${project|client}/$site/$type, as some of my projects might have 100s of related sites living in many LXD containers, so for me, it's important to always have a self documenting site + type file layout, so I can know what I'm looking at instantly, rather than digging through files.
Bernard BaileyDatabase Engineer

Author

Commented:
Thank you David,

For your comments and suggestions.

Cheers
Bernard
David FavorFractional CTO
Distinguished Expert 2018

Commented:
You're welcome!

Glad you got this working!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial