Phalcon Fatal error: Class 'Phalcon\Mvc\Application' not found in - php

I have this file directory:
When I open this project in browser: Fatal error: Class 'Phalcon\Mvc\Application' not found in...
I read that I have to install composer but when I install composer this errors occure:
How can I run my project?
My composer.json file consists:
"require": {
"phalcon/incubator-mailer": "^1.0",
"smi2/phpclickhouse": "^1.4",
"hybridauth/hybridauth": "^3.8"
}
}```

There are in fact two problems.
You are missing the phalcon php extension. You can find the instructions on how to install the extension in the official Phalcon documentation.
You need at least php version 7.3 to satisfy the requirements of smi2/phpclickhouse. Since php 7.x is EOL since 26th of November 2022, I'd strongly suggest to upgrade to the latest version which currently is php 8.1.
Once you resolved the two problems, composer install should run successfully, and the missing classes should be placed in the vendor directory.

Following up on some of the other comments, Phalcon 4 is NOT compatible with PHP 8.1. Phalcon 4 requires PHP 7.4.
If you plan on running PHP 8.1, you will need to install Phalcon 5.1.1.
You can find the Phalcon installation documentation on at https://phalcon.io

Related

How to change php version in composer dependencies

when I try to run a server on mamp i get the error message: "Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.1.0". You are running 8.0.8".
You don't change package dependencies, that's the responsibility of the package maintainer. Either see if there is another version available that requires the same or lower version of PHP than you have installed in your environment or install the required PHP version.
It appears that MAMP Pro has support for PHP 8.1 although this question seems to have a solution without requiring the Pro version.

Travis - Require PHP ext-simplexml in Composer

I am trying to require "ext-SimpleXML": "^7.1" in my composer.json and I am using travis as my testing framework. Locally everything works fine but on travis (when using composer install) I always get the error message:
The requested PHP extension ext-simplexml ^7.1 has the wrong version (0.1) installed. Install or enable PHP's simplexml extension.
Does anyone know how I can update or tell travis to install/use the correct version? I already tried it with sudo apt-get install php-xml without success.
Try use the line below.
"ext-SimpleXML": "*"
https://getcomposer.org/doc/01-basic-usage.md#platform-packages
Most of PHP extensions do not have own versions. They are fixed to a specific PHP build. Few are a thin shims to system libraries and the shims versions are meaningless.

How to use PHP 5.6 (or later) on cloudControl?

I have a Symfony 3.0 application that I want to deploy on cloudControl. The app is running on the pinky stack; my composer.json requires PHP >=5.5.9
"require": {
"php": ">=5.5.9",
...
}
When I try to push, I get
...
-----> WARN: No php version found in composer.json. Falling back to legacy build.
...
Your requirements could not be resolved to an installable set of packages.
Problem 1
- This package requires php >=5.5.9 but your PHP version (5.4.45) does
not satisfy that requirement.
The phpinfo() of the pinky stack shows, that PHP 5.6.12 is running.
How do I have to modify my composer.json (or any other file in my application) to make this run in PHP 5.6?
There is a blog post, about how to use specific PHP versions and extensions.
http://www.paasfinder.com/custom-php-version/
Since all systems are 64bit, you have to use e.g.:
{
"require": {
"php-64bit": "5.6.12"
}
}

Skip composer PHP requirement

We are using PHPCI and composer. The server which runs PHPCI is on PHP 5.3.
For a project we added the Facebook PHP SDK, using composer. It requires PHP 5.4.
Composer gets triggered by PHPCI and get executed. But because the CI server just got PHP 5.3 composer failed with the error message:
facebook/php-sdk-v4 4.0.9 requires php >=5.4.0 -> no matching package found.
This let fail my build in PHPCI, of course.
Is there a possibility to skip this requirement? Maybe by adding an option to composer.json? Or a parameter to composer.phar call?
I've found the option:
composer install --ignore-platform-reqs
Ignore platform requirements (php & ext- packages).
Alternative: Specify your projects' PHP version
You can skip the platform checks by configuring composer.json#/config/platform/php with the PHP version to use.
Composer will fetch packages based on that configured PHP version then.
So when you need to tell Composer the PHP version for your projects dependencies, you can (and should) specify the PHP version if different than the PHP version you execute composer with in your composer.json project configuration file (AKA root package):
{
"config": {
"platform": {
"php": "5.6.6"
}
}
}
Here PHP 5.6.6 version is exemplary, it could be 8.0.4 or any other PHP version.
This also documents the target (platform) PHP configuration. Additionally installed PHP extensions and library versions can be specified.
Compare: Config: platform - Composer documentation
For many commands, you can tell composer to bypass php version check, with parameter "--ignore-platform-reqs":
composer COMMAND --ignore-platform-reqs
this will bypass php version specification.
Be aware that the software may work or not: php version specification is there because somewhere in the code is needed at least the specified php version, so if you use that code the software will break.
If anything requires a specific version of PHP, it won't run in a lower version of PHP. You will properbly still recieve errors when bypassing the PHP requirement.
Btw, PHP 5.3 is no longer maintained, I would strongly recommend updating the PHPCI server.

How to install zend framework on Ubuntu?

I want to install zend framework on the Ubuntu and i have followed the instruction of installation from
http://framework.zend.com/manual/2.2/en/user-guide/skeleton-application.html
link but failed to install.
I have downloaded the ZendSkeletonApplication from here
https://github.com/zendframework/ZendSkeletonApplication
After that run of this command
php composer.phar self-update // it's working
But after the first command the second Command
php composer.phar install // Not working
And showing this error
Loading composer repositories with package information
Installing dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- zendframework/zendframework 2.3.1 requires php >=5.3.23 -> no matching package found.
- zendframework/zendframework 2.3.0 requires php >=5.3.23 -> no matching package found.
- Installation request for zendframework/zendframework 2.3.* -> satisfiable by zendframework/zendframework[2.3.0, 2.3.1].
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.
Update after some comments:
Now I've downloaded the ZendSkeletonApplication-master and move the
Library folder of ZendFramework-2.3.1
in the
ZendSkeletonApplication-master/vendor/ZF2/
But after that when i access this i'm getting this error on the page
ZendSkeletonApplication-master/public/index.php // in the browser it showing me this error
Fatal error: Declaration of Zend\Stdlib\ArrayObject::offsetGet() must be compatible with
that of ArrayAccess::offsetGet() in /var/www/html/demo/username/ZendSkeletonApplication
-master/vendor/ZF2/library/Zend/Stdlib/ArrayObject.php on line 22
Well two solutions are possible :
First upgrade php, However it could be possible that Ubuntu release on your system not having upgrades for php. So in that case search google to add APT repository for php 5.3.23 for your ubuntu-VERSION.
Second I personally experienced that, Checkout in folder you will found composer.json file, In that file you will get the settings something like
"require": {
"php": ">=5.3.23",
"zendframework/zendframework": "2.3.*"
}
Just change settings to get other version of ZF2
"require": {
"php": ">=5.3.3",
"zendframework/zendframework": "2.2.*"
}
It works for me. It should work for you.
Read the error, the main thing we need to focus on is this:
zendframework/zendframework 2.3.1 requires php >=5.3.23 -> no matching package found.
I'll break it down for you.
This states that the package you are attempting to install(zendframework/zendframework 2.3.1) REQUIRES a php version GREATER OR EQUAL TO 5.3.23. As your php -v output stated, you are running PHP 5.3.10. If you are running on a local server that you have access to updating the php version, then update php and run it again, you should see that it works fine. If you are on a remote server, contact your hosting company and see if they can upgrade you to a newer version of php and then run it again!
Hope this helps!
If you have more then one version of php installed and you have php environment variable linking to an old php executable then you may get this issue. Change your environment variable to the php you want to use.

Categories