cakephp 3 installation issue - unexpected T_OBJECT_OPERATOR in config/bootstrap.php on line 107 - cakephp

I have php 5.4.42 on Linux with Apache and mysql. All the required extensions are loaded and I did a fresh install of cakephp 3 using the command
composer create-project --prefer-dist cakephp/app c3
It installed everything but when I open the URL in browser, it shows me an error in the browser
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in c3/config/bootstrap.php on line 107

Got the solution from cakephp github. My php version is not correct. Issue is that command line on linux (php -v) shows version as 5.4.42 but correct version is shown only using phpinfo() on a webpage and there it shows 5.3.29

Related

How can I install cakephp2 in 2022?

can anyone tell me how can I install cakephp 2 in 2022 I tried many ways to install it I also have its zip file which I extract it and when I tried to run it it shows.
Fatal Error
Error: Cannot use 'String' as class name as it is reserved
File: E:\xampp\htdocs\cakephp2.3\lib\Cake\Utility\String.php
Line: 27
Notice: If you want to customize this error message, create app\View\Errors\fatal_error.ctp
CakePHP 2 needs php5
since Version 2.8 you can use php70
php71 is possible but you need to install mcrypt seperatly.
Its possible to run a CakePHP 2.8 on php72 with some core hacks. But i wouldn't recommend this.
I got my answer we can download its zip file from github and copy its file in htdocs folder and run it without an issue. By the way I downloaded cakephp 2.10. and it is also running in xampp with php version 8. If in your system it is not running then try to use xampp with php version 7.

PHPUnit gives No Code Coverage Driver Is Available

I have a laravel project and I tried to run phpunit to give me a coverage report. I ran the command vendor/bin/phpunit --coverage-html storage/test-output-data/coverage-html and it gave the output:
PHPUnit 8.5.8 by Sebastian Bergmann and contributors.
Error: No code coverage driver is available
I tried to resolve this situation by doing a sudo pecl install pcov, but running the phpunit still gave the same error above.
I noticed that I have the file /usr/lib/php/20170718/pcov.so. So I added the line extension=/usr/lib/php/20170718/pcov.so to my /etc/php/7.4/cli/php.ini file. But when I type php -v, I get this error:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20170718/pcov.so' (tried: /usr/lib/php/20170718/pcov.so (/usr/lib/php/20170718/pcov.so: undefined symbol: _zval_ptr_dtor), /usr/lib/php/20190902//usr/lib/php/20170718/pcov.so.so (/usr/lib/php/20190902//usr/lib/php/20170718/pcov.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 7.4.11 (cli) (built: Oct 10 2020 19:44:50) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.11, Copyright (c), by Zend Technologies
I also have a folder called /usr/lib/php/20190902 but it does not have a pcov.so file.
I also tried doing a sudo pecl install xdebug, but I run into similar errors as above where phpunit says there's no driver and typing php -v says some global variable is missing similar to the pcov issue.
What am I doing wrong?
I noticed that I have the file /usr/lib/php/20170718/pcov.so. So I added the line extension=/usr/lib/php/20170718/pcov.so to my /etc/php/7.4/cli/php.ini file.
This file is for PHP 7.2 (based on 20170718 part) while you are trying to use it in PHP 7.4.
You need to get the right version of Xdebug (or PCOV) for your PHP 7.4. (NOTE: for PHP 7.4 the API version (and the right folder in the path) will be 20190902.)
Try this solution from the following answer to switch / install extensions via PECL for specific PHP version (7.4 instead of your current 7.2): https://stackoverflow.com/a/54594604/783119
sudo pecl -d php_suffix=7.4 install <package-name>
This has nothing to do with PHPUnit. You have a problem with your PHP environment: "PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20170718/pcov.so' (tried: /usr/lib/php/20170718/pcov.so (/usr/lib/php/20170718/pcov.so: undefined symbol: _zval_ptr_dtor), /usr/lib/php/20190902//usr/lib/php/20170718/pcov.so.so (/usr/lib/php/20190902//usr/lib/php/20170718/pcov.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0"
You just need to install xdebug, so the coverage knows how to run.
For example, for PHP 7.1, it's this package:
sudo apt install php7.1-xdebug
Just fixed it today for my scenario. In your case, just change the PHP version to:
sudo apt install php7.4-xdebug

ionic build fails error 65

Building my ionic app fails since this weekend:
** BUILD FAILED **
The following build commands failed:
CompileC build/App.build/Debug-iphonesimulator/App.build/Objects-normal/i386/IonicKeyboard.o App/Plugins/com.ionic.keyboard/IonicKeyboard.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/me/Documents/app/platforms/ios/cordova/build-debug.xcconfig,-project,app.xcodeproj,ARCHS=i386,-target,app,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/me/Documents/app/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/me/Documents/app/platforms/ios/build/sharedpch
OSX 10.11.3
XCode 7.2.1 (7C1002)
ionic -v
1.7.14
Today I reinstalled cordova and ionic, but I still keep getting the error. I had to adjust another issue with macports (here), which I fixed by setting the rights right, but still keep getting the above error.
Error 65 seems to have originate from within Cordova plugins. I've been able to "band-aid" this issue by:
cordova plugin remove <plugin name>
ionic platform remove <os>
ionic platform add <os>
cordova plugin add <plugin name>
I've also tried using sudo while running these commands with mixed results.
I fixed with following steps
in xCode go-to "Build Phase" >> Under "Compile Sources" >>
did you notice any missing or .m files failed to link... in my case it was "IonicKeyboard.m" file
I just added the file to the list "plugins/cordova-plugin-ionic-keyboard/src/ios/IonicKeyboard.m"
then Build Project - worked
iOS
Open platforms/ios on XCode
Find & Replace io.ionic.starter in all files for a unique identifier
Click the project to open settings
Signing > Select a team
Go to your device Settings > General > DeviceManagement
Trust your account/team
ionic cordova run ios --device --livereload

Windows + Xampp + CakePHP - Composer throws error on update

I am trying to create a local development environment on a Windows machine using Xampp. Xampp has been setup correctly and I am able to access localhost, locahost/phpmyadmin and a virtual host I created domain.local. This Virtual Host is a CakePHP application that I had been running on a Linux Box (nginx). I use that code to setup the site, but when I try to run
php composer.phar update
to have composer download all dependencies, I get the following error:
Fatal error: Class 'Cake\Composer\Installer\PluginInstaller' not found in
phar://C:/Users/admin/Documents/Sites/domain.local/website/composer.phar/src/Composer/Plugin/PluginManager.php
on line 244
I have tried a bunch of things without success.
Also to note php composer.phar self-update, runs without issue.
Not sure what to do at this point. Any help is appreciated.
After more tryouts, I finally decided to delete the vendor folder and surprisingly it fixed my issue. Composer downloaded all dependencies and everything works as expected.

An error occured when executing the cache:clear --no-warmup” while installing fosuserbundle

I am installing fosuserbundle using composer but I am getting error while installing it.
[Symfony\Component\Debug\Exception\ContextErrorException]
Warning: constant(): Couldn't find constant Monolog\Logger::DEBUG in /home/trainee/web/projects/Symfony-demo/vendor/symfony/monolog-bundle/Symfony/Bundle/MonologBundle/DependencyInjection/MonologExtension.php line 110
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-update-cmd event terminated with an exception
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command.
I am using this command
php composer.phar require friendsofsymfony/user-bundle --prefer-dist
Please provide a version constraint for the friendsofsymfony/user-bundle requirement: dev-master
Can anyone help me?
Thanx in advance.
I got the solution of my problem. For that, first I need to install composer using
php composer.phar install
then I need to install fosuserbundle using
php composer.phar require fosuserbundle/user-bundle --prefre-dist
so it will be installed

Resources