Migrating code from Windows to Linux (Ubuntu)

Well, I’ve gotten myself into a fine mess this time.

I have a Windows server 2008 development server that I installed the latest copy of OEMR from the tip of the spear.

I did a bunch of mods to the code and found out I needed to upload this to an Ubuntu 16.x box.

So, I imported the code into the Ubuntu box and fixed all the permissions. But now it still won’t load the login page. I have checked the logs and there are no errors. I checked the console and no errors.
I downloaded a Linux copy of the program and installed it and it works fine on the same Ubuntu box.

What did I forget or is it that the Windows code is not going to run on the Ubuntu box?

Look in the log files. /var/log
In Apache and PHP log.

How did you copy the files over? I do from windows to Linux all the time and almost always when there is an issue it comes down to wrong user group or user or permissions from the copy. And man it’s cold in Florida this morning!

@APerez
Well, we got a covering of snow that is still melting here in VA.

I copied the files by zipping them on the windows web server folder that I am working. Downloaded it from the windows web server using wget to the Linux web server. Unzipped it into the web folder. Changed the user and group from root:root to ubuntu:ubuntu and set the appropriate permissions even on the documents folder making it www-data:www-data.

I even went as far as to download a clean copy of OpenEMR and install it in another folder and checked own and permissions against that to see what did I miss. I reset the sqlconf to 0 and went through the install of the database and that went well and got through all the of the setup screens and the login screen still gives the 500 error.

Still no log errors of any kind in the log files. I cleared the log files just to make sure I was not missing anything.

I think if I knew what the login page was looking for I could find the point of failure and fix it.

I just finished another round of troubleshooting and the login page is hanging on loading the globals. That is all I have for now.

Check your document’s tree and ensure www-data:www-data unless you have given ubuntu:ubuntu www-data privileges.

Finally, there is an error message in the log.

 [Thu Mar 15 23:27:09.982436 2018] [:error] [pid 15203] [client 72.84.80.247:55185] PHP Fatal error:  Uncaught Error: Class 'OpenEMR\\Common\\Logging\\Logger' not found in /var/www/html/mindfulemr3/services/VersionService.php:47\nStack trace:\n#0 /var/www/html/mindfulemr3/interface/globals.php(520): OpenEMR\\Services\\VersionService->__construct()\n#1 /var/www/html/mindfulemr3/interface/login/login.php(35): require_once('/var/www/html/m...')\n#2 {main}\n  thrown in /var/www/html/mindfulemr3/services/VersionService.php on line 47

I have no clue what it means. I will start digging into it to see where this rabbit hole goes.
The common > logging > logger.php file does exist.

Version check is first call when logging in but the class VersionService can’t load the Logger. Reason, can’t load the file logger.php most likely because of server privileges and/or file privileges. Again, I believe your ubuntu:ubuntu may not be part www-data or visa versa. Include ubuntu in www-data.

I forgot to mention that this is an AWS instance. So remote root login is not an option.
I added both to each group. No love.

I have burnt a whole week on this and I am just going to call this one no solution.
I’ll just have to copy all the mods over to the working copy. I can have that done in the next two days and stop this wishing game.

You should be able to get root via putty. However you changed root to ubuntu group/user, change back to root and try before giving up.

I did not change root group to ubuntu. I changed the folder owner from root to ubuntu. By default in AWS there is a ubuntu group.

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/putty.html?icmpid=docs_ec2_console

When a pem is created, this is used as the credentials to log into ASW Linux instance. There is no password to type in. The pem is used in place of a password and it auto logs me in as ubuntu, not root.
See instruction for more details.

Thanks for the advice!

so after you remote in to the command line the following doesn’t work?
sudo usermod -aG www-data ubuntu

I am sure that would work.
I ran the command no errors and then tried to log in and this is in the error log for today.

 [Fri Mar 16 14:31:57.404945 2018] [:error] [pid 2444] [client 69.73.35.106:56793] PHP Fatal error:  Uncaught Error: Class 'OpenEMR\\Common\\Logging\\Logger' not found in /var/www/html/mindfulemr/services/VersionService.php:47\nStack trace:\n#0 /var/www/html/mindfulemr/interface/globals.php(520): OpenEMR\\Services\\VersionService->__construct()\n#1 /var/www/html/mindfulemr/interface/login/login.php(33): require_once('/var/www/html/m...')\n#2 {main}\n  thrown in /var/www/html/mindfulemr/services/VersionService.php on line 47

So you can see:

ok, cool, that might fix the permissions issue (making ubuntu a member of the www-data group as jerry suggested)

Unfortunately, it did not fix the issue. It still exists. Here is another view.

That is why I am code copying today so that I can get back on track. I have blown to much time on this. I posted it in case it would help someone else in the future. Too bad there is no solution at this time.

what do you get when you enter groups at the command line? you may need to re-login

This should answer that question:

user ubuntu is not member of root and I don’t see ubuntu group but openemr tree is ubuntu:ubuntu . Please create a ubuntu group and add root as a member or add ubuntu user and add root to user ubuntu.:slight_smile: I think that is right.

Hi there. I’ve encountered this issue several times. Here are some troubleshooting steps:

  1. Verify that the virtual host is working. Create an index.php file in the /var/www/html/ folder with the following code:
<? php echo "This page works"; ?>

If you can see this page, your virtual host is working correctly. Can you verify that its working?

Well, thank everyone for their input thus far but this is what I have found out now.

@growlingflea your suggestion is the first thing I do always no exceptions.

The composer is breaking the code.

Let me tell you how I got to that conclusion.
In the clean install that works, I started moving the code changes. One of my code changes was to the composer.json file. There was one line put in that file that is this.

        "OpenEMR\\Staff\\" : "library/staff/src" 

Yes, the syntax is correct because it works on the Windows server. I added code and trying to be all studious and use namespace. I know that once lines are added composer. The command “composer update” has to be run to update the dependencies.

Once I run the update, the instance starts doing the

    PHP Fatal error:  Uncaught Error: Class 'OpenEMR\\Common\\Logging\\Logger' not found in /var/www/html/mindfulemr3/services/VersionService.php:47\nStack trace:\n#0 /var/www/html/mindfulemr3/interface/globals.php(517): OpenEMR\\Services\\VersionService->__construct()\n#1 /var/www/html/mindfulemr3/interface/main/tabs/main.php(30): require_once('/var/www/html/m...')\n#2 {main}\n  thrown in /var/www/html/mindfulemr3/services/VersionService.php on line 47, referer: http://52.35.13.101/mindfulemr3/interface/login/login.php?site=default

So I copied all the clean install files back and reset the sqlconf and everything goes back to working.

What is the proper way to update namespace using composer in Linux?

Here is more defined what was added.

    "psr-4" : {
        "OpenEMR\\Common\\" : "common",
        "OpenEMR\\Entities\\" : "entities",
        "OpenEMR\\Services\\" : "services",
        "OpenEMR\\Repositories\\" : "repositories",
        "OpenEMR\\Encounter\\Services\\" : "interface/patient_file/encounter/Services",
        "OpenEMR\\Admin\\" : "library/admin/src",
        "OpenEMR\\Core\\" : "library/core/src",
        "OpenEMR\\Menu\\" : "library/menu/src",
        "OpenEMR\\Calendar\\" : "library/calendar/src",
        "OpenEMR\\Sample\\" : "library/sample/src",
        "OpenEMR\\Reminder\\" : "library/reminder/src",
        "OpenEMR\\Billing\\" : "library/billing/src",
        "OpenEMR\\Pdf\\" : "library/pdf/src",
        "OpenEMR\\Rx\\Weno\\" : "library/weno/src",
        "OpenEMR\\Staff\\" : "library/staff/src"
     }
 },

If I don’t run the dependencies update then my code does not find the library file.

I just tried below command composer dump-autoload and the system stops functioning.