1

Transferred an old CakePHP project to a new server to do some testing ( i don't have access to it's original server) . It's cakePHP 2.7 running on php 5.5. The project was originally built using PEAR, I've managed to install PEAR after a lot of issues with deprecated packages, but am unable to run the build.xml as it requires a package that is deprecated and I am unable to find anywhere. Fixed most of the path & redirect issues. But can't get it to find any Classes; not even App, as i have no idea where this is defined. Is it defined by PEAR? it doesn't seem to be in core.php or bootstrap.php or the initial index.php. Or if it is I can't find it.

so:

Any file that has App class for example:

App::objects('Controller');

returns:

Fatal error: Class 'App' not found in D:\xampp\htdocs\projectname\cake\app\webroot\test.php on line 2

hoping someone out there still has knowledge of cakePHP 2!

RainMan
  • 13
  • 3
  • 1
    Is the CakePHP core your only PEAR dependency? If so, just drop it and [**use composer instead**](https://book.cakephp.org/2/en/installation/advanced-installation.html#installing-cakephp-with-composer) (CakePHP 2.7 supports it), PEAR is dead for good. – ndm May 07 '22 at 18:57
  • @ndm I'd prefer using composer, I will try the guide you posted now and see how that goes. – RainMan May 07 '22 at 19:18
  • With the new server you have setup, do you have all the server mods setup correctly and enabled, like mod_rewrite? I also highly recommend trying to get composer to handle your dependencies – treckstar May 07 '22 at 19:18
  • I've changed over to composer. I ran the guide @ndm posted and installed a fresh version of cakephp 2.7 and then added all the files from old project into the framework. It now works a bit better, now getting an error; Create AppController::webroot() in file: app\Controller\AppController.php. but it doesn't say what to in webroot. Does it just require the full path to webroot? – RainMan May 07 '22 at 20:44
  • @treckstar I believe so, I tried similar with PEAR by doing a fresh install of cakephp2.7 and it threw up errors for everything that needed changing or including. Composer seemed to go ahead with no problems apart from needing mcrypt which i used mcrypt_compat which seems to work. – RainMan May 07 '22 at 20:51
  • Ok, well I have another suggestion you could maybe try. On this new server, download a complete fresh copy of CakePhp 2.x, setup another Vhost, etc. See if you can get a default plain copy of Cake running on the server. That would then rule out any server issues, I would think. If that goes well you could then start migrating dependencies and parts of your broken project over and see if that gets you somewhere. – treckstar May 07 '22 at 22:11
  • 1
    @treckstar thanks, I'm about to do exactly that, following ndm's advise got a lot of the project working, but still some issues deeper down. But I was still running it on the same dev environment and there was still issues with cakephp looking for pear in places like with PHPunit. I think you are right that I need a completely clean dev environment start afresh and to use composer from the start. – RainMan May 07 '22 at 22:34

0 Answers0