migration php 5 to php 7 cakephp - cakephp

I am trying to make test environment for my cake project however the migration from php 5.X to 7.1.0 proves to be a nuisance.
I have succesfully installed a new fresh apache2.4 vc14 x64 bit installation.
This apache installation uses a fresh PHP vc14 x64 7.1.0 installation. Both have been checked and are indeed working perfectly.
Now the problem:
I have a cakephp product using a shared created library in the plugins folder, this was working perfectly in CakePHP 2.8.5 using php 5.x. This plugin is loaded in the bootstrap and used the way cakephp intends us to. However the moment i try to run the old project in the fresh installation it is suddenly unable the load the plugin files. Again everything is loaded in the bootstrap and usage has not been changed whilst moving the content to its new location. I have checked a fresh cakephp installation in the new environment and this is also working splenditly.
I am quite baffled at the moment has anyone having experience using cakephp encoutered this particular problem feel free to fire away with some ideas as to what i might have missed.
i will show some code how everything is loaded and used.
CakePlugin::Load('RemFlex');
<?php echo $this->Html->css('RemFlex.flexdetail'); ?>
<?php echo $this->Html->script('RemFlex.flexportal'); ?>
the plugin directory looks like this
Cakephp_program
-App
-Plugin
-RemFlex
-webroot
-js
-Css
-Controller
-Vendor

Fixed this problem by enabling the rewrite_module in the httpd.conf file of the apache installation. This enabled my htacces to actually work.

Related

ugprade cakephp 3 to latest version

i have cakephp3.3 windows and i need to upgrade to cakephp3.6. Checking the docs i see there is no tool available. Checking the migration guides i am not seeing any issues with my code in cake3.3 with newer versions.
Do i simply create a new instance of cake3.6 and create models,controllers again using bake and then copy over code to see if this works? what is an efficient way
The docs in cakephp are not clear on this process. do i upgrade to 3.4 then 3.5,3.6?
https://book.cakephp.org/3.0/en/appendices/3-x-migration-guide.html
Use composer.
For Windows, you can download it from here. After installation, locate composer.json file in your CakePHP application directory, and look for "require" part, and update line regarding CakePHP as follows:
"require": {
"php": ">=5.6",
"cakephp/cakephp": "3.6.*",
....
}
Then, in command line, navigate to your CakePHP installation directory and fire composer update. After a while you should have your CakePHP upgraded.
More info about updating to new version can be found in docs:
Keeping up to date with latest CakePHP changes
Another solution was given which was to install a new instance of cakephp and just copy over scr folder and other relevant code in the new instance. This is more work but the conversion from 3.3 to 3.6 isnt very clean with a composer update

ERR_TOO_MANY_REDIRECTS after moving CakePHP project from a dedicated server to another dedicated server

I'm new to CakePHP and my employer asked me to move our CakePHP app from a dedicated server to another server (for testing purposes). I've copied all the files, changed app's database.php config but I'm getting a ERR_TOO_MANY_REDIRECTS when accessing the app on the new server.
I did not work on the app so I don't know much about it, but I have all the files.
LE: So, I've uploaded the app on a fresh install of CakePHP. I now have 3 .htaccess files, CakePHP says it's working, but when I try to upload DebugKit (following the install notes & having the proper version for CakePHP 2.4.3.) I get the ERR_TOO_MANY_REDIRECTS.
A look in Chrome's console shows me this. If I delete the DebugKit altogether, the page looks like this & it also has the footer from the app.
The new structure of the app is the standard one.
Please advise!
Best guess is the (apache?) DocumentRoot setting may be clashing with your APP config on the new server and/or the PHP settings. Have you checked your php.ini on the new server? What's the output of phpinfo() ? Once fixed HIGHLY RECOMMEND check other environment variables by turning on the DEBUG flag in config/app.php For your version try pr(Debugger::trace()); or even better for dev. install the Debug kit. Anyway, DocumentRoot should be set to webroot (assuming default install and directory structure).

How do I view and share a running Angular app through Vagrant?

I have a basic Angular app installed using a Yeoman fullstack installer, and I can see the basic pages running on http://localhost:9000 when I run 'grunt serve'.
I also have a Vagrant installation running using the ubuntu/trusty64 box. I was originally seeing a 404 when trying to view http://127.0.0.1:4567/, but following some instructions I found online, I edited the file in 'vagrant ssh' at /etc/apache2/sites-enabled/000-default.conf by removing the html part of the path in that file. After doing 'vagrant reload' I now see the list of files in my project dir when I go to that URL.
How do I go about viewing my angular app like it is at localhost:9000? If I get this working will this mean that if I share via Vagrant, they'll see the angular app running as it should? Do I still need to be running grunt serve in combination with Vagrant?
I'm pretty new to all this setup, so I'm just following the instructions at https://github.com/DaftMonk/generator-angular-fullstack & https://docs.vagrantup.com/v2/getting-started/index.html
I'm not great with Linux/cmd line stuff as yet, hence my problems... :)
Thanks!
I started writing instructions for you on how to get it done. But then realised that you are not very comfortable with linux commands. I have created a angular-seed project that uses vagrant, angular and requirejs. Its easy to set up and I have written instructions on how to do that in my github page.
Just clone it, follow the instruction and you will have a working seed project in no time. Some of the features of the seed are:
Uses vagrant and puppet to provision the vm. All required dependencies are automatically installed.
Grunt tasks for:
autoloading bower dependencies
compile sass or scss
livereload
server for access of site locally
If you have any difficulties or questions, feel free to contact me.

How to install CakePHP plugin for PHP IDE Netbeans 7.2

I have the PHP IDE version of NetBeans 7.2 and have installed the plugin successfully (it is shown as enabled in the plugins list and appears in the project properties). However, nowhere do I see a place to select the framework as shown in the download page (http://plugins.netbeans.org/plugin/44579). When creating a new IDE there is no step 4, just 1,2, and 3...so obviously something is missing. Is there a dependent plugin I need or maybe I need the full, huge version of NetBeans?
I am using Windows 7, PHP 5.3, CakePHP 2.1.2
Thanks
The plugin was working correctly, however it requires that there only be 1 app in the project folder in the same directory as the CakePHP lib folder. The NetBeans project folder is not the 'app' folder that contains the Controllers and Views folders, instead it must be the folder that contains the app and lib folders.
Just go to NetBeans' main menu Tools > Plugins > Available Plugins. Choose the plugin you want and install it.

cakephp 2.1 migration cache error

I'm trying to migrate my app from cakephp 2.0 to 2.1. I've been using 2.1 for a couple of weeks on my local development server, and everything works fine. I've just tried uploading to the production server, and I'm getting the error message:
Fatal error: Class 'Cache' not found in app/Config/core.php on line 265
I'm probably missing something obvious, but I can't work out what. If anyone has experienced something similar or can offer any suggestions I'd be very grateful!
(I'm using the CakePHP 2.1.0 stable release)
Are you very sure you uploaded all the "core" files (the lib directory)? It seems the Cache class is missing, which is a core class of CakePHP. The error message is indicating an incomplete CakePHP install on your server.
Verify if the file lib/Cake/Cache/Cache.php exists and is readable by the webserver you are using (e.g. ownership is set to apache.apache or www-data.www-data and chmod is set properly. If using SELinux, also make sure the files have httpd_sys_content_t or public_content_rw_t context set).

Resources