Fatal error: Cannot declare class Cpdf, because the name is already in use in /Applications/XAMPP/xamppfiles/lib/php/Cpdf.php

benzev wrote on Monday, February 20, 2017:

I am installing the windows Zip version of Openemr 5.0.0 on a Macbook pro (Macos Sierra 10.12.3) through Xampp 7.1.1. Installation goes well, some warnings in earlier stage, but ends up this:

OpenEMR Setup

Step 4

Installing and Configuring Access Controls (php-GACL)…

Fatal error: Cannot declare class Cpdf, because the name is already in use in /Applications/XAMPP/xamppfiles/lib/php/Cpdf.php on line 19

Not sure how to proceed

bradymiller wrote on Monday, February 20, 2017:

Hi Ben,

It’s seems really odd that xampp is bringing in php libraries like this into OpenEMR. What happens if you delete the /Applications/XAMPP/xamppfiles/lib/php/Cpdf.php file?

Also, out of curiosity, what else is sitting in /Applications/XAMPP/xamppfiles/lib/php/ ?

-brady
OpenEMR

benzev wrote on Monday, February 20, 2017:

I deleted the Cpdf.php file, paged back in the Firefox browser to the previous step, and pressed continue to get this:

OpenEMR Setup

Step 4

Installing and Configuring Access Controls (php-GACL)…

Fatal error: Cannot unset $this in /Applications/XAMPP/xamppfiles/htdocs/openemr/vendor/adodb/adodb-php/adodb-xmlschema.inc.php on line 160

benzev wrote on Monday, February 20, 2017:

Here are 2 screenshots of the lib/php folder:

On 20 Feb 2017, at 11:57, Brady Miller bradymiller@users.sf.net wrote:

Hi Ben,

It’s seems really odd that xampp is bringing in php libraries like this into OpenEMR. What happens if you delete the /Applications/XAMPP/xamppfiles/lib/php/Cpdf.php file?

Also, out of curiosity, what else is sitting in /Applications/XAMPP/xamppfiles/lib/php/ ?

-brady
OpenEMR http://www.open-emr.org/
Fatal error: Cannot declare class Cpdf, because the name is already in use in /Applications/XAMPP/xamppfiles/lib/php/Cpdf.php https://sourceforge.net/p/openemr/discussion/202505/thread/0d45ca7c/?limit=25#dd6b
Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/openemr/discussion/202505/ https://sourceforge.net/p/openemr/discussion/202505/
To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/ https://sourceforge.net/auth/subscriptions/

bradymiller wrote on Monday, February 20, 2017:

Hi Ben,

Php 7.1 is not compatible with the current adodp package used by OpenEMR. I am going to update the adodb package in the development codebase, but will take awhile before it gets into 5.0.0 patch (and it may not get into a patch since it involves quite a few changes it appears and needs to be tested for awhile since it is a core package). Recommend not using the xampp 7.1 version and instead using either the 7.0 or 5.6 version:
https://www.apachefriends.org/download.html

-brady
OpenEMR

benzev wrote on Tuesday, February 21, 2017:

Hi Brady,

This method worked very well. Thanks so much! I installed the xampp 5.6 version and used Openemr 5.0.0 Zip windows version, using Firefox as the browser. It did, however, stop at this stage:

Step 4
Installing and Configuring Access Controls (php-GACL)…
Fatal error: Cannot declare class Cpdf, because the name is already in use in /Applications/XAMPP/xamppfiles/lib/php/Cpdf.php on line 19

I then deleted Cpdf.php, paged back and it completed the setup fine. I have added the extra lines to the Apache config file. Next to edit php config file and I will start the process of setting up my homeopathic practice.

So what I can confirm is that the following combination manages the xampp install for Mac: MacBook pro (2013 model), Macos Sierra 10.12.3 - the latest version; Xampp for Mac Version 5.6.30-0 - not the latest version; and Firefox 51.0.1 - also the latest version. The only pitfall was the need to delete the Cpdf.php file. Also perhaps important, is to open the xampp Manager-Osx before installation and check that the Apache Web Server and MySQL database are running. If you like I could offer an edit of my install on the Wiki page?

Thanks once again
All the best

Ben

bradymiller wrote on Wednesday, February 22, 2017:

Hi Ben,

Would be very nice to have updated install docs for Mac. Feel free to post on the wiki and can request a wiki account here(which I will gladly confirm):
http://www.open-emr.org/wiki/index.php/Special:RequestAccount

I’m still a bit taken aback that Xampp would include php libraries (like Cpdf.php) in the application like that; that is really odd. I haven’t noted this in the Windows xampp package, however, I haven’t used a xampp windows package for a year or so.

-brady
OpenEMR

@bradymiller

I would like to make report about this similar error message. This started yesterday.

OEMR v5.0.2 (3)
Ubuntu 18.04.4 LTS (GNU/Linux 5.3.0-1028-aws x86_64)
PHP 7.2.24-0ubuntu0.18.04.6 (cli)
Apache / 2.4.29 (Ubuntu)
No modifications to the program at all.

 PHP Fatal error:  Cannot use OpenEMR\\Common\\Csrf\\CsrfUtils as CsrfUtils because the name is already in use in /var/www/html/todd/interface/usergroup/user_admin.php on line 553, referer: https://todd.com/interface/main/tabs/main.php?token_main=t44SgYoPZAfP2Y4VVxnDJVGzcEcQDAjNAVSju1V5

Should I run composer update?
It is working again. Don’t know what happened. I removed all the code from the page and put it back a little at a time looking for the offending code. Didn’t find any and ended up with a working page.

1 Like

After looking at this bug it looks like namespaces are failing to respond on certain files in the file system. Chowning the EMR install seems like your best bet yet I have also opened up a separate issue on the GitHub repo to get everyone’s opinion:

This will never be sorted out until someone goes through codebase and declares a OpenEMR namespace.
Currently we don’t have a declared OpenEMR namespace but instead the global default namespace is used where all non declared namespaced classes reside. This goes back to pre class PHP and has had namespace issues for non declared classes every since.

Also many of our older pre 7.0 classes, controller comes to mind, have invalid class structures. Namely class inits. So, to fix this and other unexplained issues dealing with classes, somebody needs to do a core run through and update classes and add namespaces appropriate for the class environment.

This should be part of modernization project! It’s not glamorous but instead an exercise in engineering where a great deal can be learned. Just sayin…