Installing Zend Framework 2 skeleton application on Apache Web server - php

I've got this issue with installing ZF2 application on my Apache server. I am running PHP 5.3.5.
The composeer.phar self-update works fine then when I try to install dependencies it comes up with this:
C:\Apache2.2\htdocs\zf2-tutorial>phpcomposer.phar install
Loading composer repositories with package information
Installing dependences <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
Its saying my PHP isn't updated. But my phpinfo() shows i am running 5.3.5. Has anyone else had this problem?
Any advice would be appreciated.

Like the error says, ZF 2.3 requires PHP 5.3.23 or above. You have 5.3.5. You either need to be running a more recent version of PHP, or install ZF 2.2.x instead which will work with your version.

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.

Cant install Magento 2

I can't install Magento 2 on Server https://prnt.sc/tqrb6n
By trying to do command composer install. Maybe some one how. How to fix this issue.
[root#junisoft junisoft.ru]# composer instal
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Your requirements could not be resolved to an installable set of packages.
Problem 1
- This package requires php ~7.3.0||~7.4.0 but your PHP version (7.1.28) does not satisfy that requirement.
Problem 2
- Installation request for magento/composer 1.6.0 -> satisfiable by magento/composer[1.6.0].
- magento/composer 1.6.0 requires php ~7.3.0||~7.4.0 -> your PHP version (7.1.28) does not satisfy that requirement.
It seems that problem is with your current php version. it would require your php7.3 version to install magento
You can verify that your current php version by below command.
php -v
it will display the current PHP version.
You can change command-line PHP version by below command
update-alternatives --config php
in your case to resolve above error change it to php7.3 if require you can prefix the command with the sudo access rights.
for webversion php change you can run
a2enmod php7.*
replace 7.* with the version you required and after that restart apache or ngix services
incase of apache 2 you can run below command also
/etc/init.d/apache2 restart
if require sudo privilege you can run the command with the sudo access.
Note: For some server related operation please make sure to run this command with some knowledge or you can also ask server admin help to configure the same.
Try with the below way,
Use --ignore-platform-reqs
for example :- composer install --ignore-platform-reqs
it's will ignore platform requirement problem like php version and etc etc.
Thanks.
Your installed PHP version 7.1.* is not compatible with the Magento 2 version you are trying to install. The Magento 2 version that you want to install is looking for PHP 7.3.* or PHP 7.4.* which is not there on the server.
The very first line of the error statement clearly says that your PHP version is not compatible with the Magento 2 version you are trying to install.
You need to contact your Hosting service provider to update your PHP to the required version which is PHP7.3.* or PHP7.4.*. Only after updating your PHP, you will be able to install the Magento 2 version which is mentioned in your composer.json file.
I found one similar article here https://technicallysound.in/magento-2-upgrade-and-composer-issues/. This explains about composer incompatibility issue with the extensions you are trying to install via Composer.

Composer update: The requested PHP extension ext-http missing

I am creating a php website using the symfony framework and composer.
Operating system: Windows 10
PHP version: 7.3.2
Symfony: 4.2.3 (env: dev, debug: true)
Composer: 1.8.4 (2019-02-11)
When I try to do compose update inside the projects folder or when I try to install a bundle using composer require symfony/swiftmailer-bundle I get the following error:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested PHP extension ext-http * is missing from your system.
Install or enable PHP's http extension.
(It says 'Problem 1', but it is the only problem listed.)
I already looked for the extension in my php.ini file, but I can't find it. Do I need to install an extension manually? If so, where can I find it?
Thanks in advance!
Update:
It might be worth looking at the other answers too. Since I'm no longer working with PHP, I'm not going to set up a project and try to recreate the problem I had just to test the new suggested solutions. If another answer did help you, give it a vote '^' this way I know which answers are helpful.
The solution is found. For some reason my composer.json contained "ext-http": "*".
"require": {
"ext-http": "*"
}
Removing this line fixed the problem. I don't know why it contained "ext-http": "*" and I don't fully understand why removing it would fix the problem. (Is it because it is looking for the extension, but can not find it?)
(Thank you to everyone trying to help me fix the problem!)
in my case i'm using ubuntu, hope this solve the problem.
sudo apt install php-http
php-http is a standard which is implemented by different packages. ext-http is the Composer way to tell that your application requires at least one of those packages. See the section called "Composer virtual packages" at http://docs.php-http.org/en/latest/clients.html for additional details.
Differently than other packages, the ext-... lines do not actually install anything via composer, they just make composer check that you have some required dependency.
Usually you can just install the corresponding PHP library, e.g. ext-zip means that you need to install php-zip. In this case, there is no single PHP library but a series of compatible libraries.
You should be able to fix your issue by installing one of the provided packages, e.g.
composer require php-http/curl-client
For those who encountered with this problem:
- The requested PHP extension ext-http * is missing from your system.
The solution is just to install PHP extension:
sudo apt install php-pecl-http
In case someone needs it, one can also install it with pecl
(it needs extensions raphf and propro loaded to build):
yum install libcurl-devel brotli-devel
pecl install pecl_http
...
Build process completed successfully
Installing '/usr/lib64/php/modules/http.so'
Installing '/usr/include/php/ext/http/php_http.h'
Installing '/usr/include/php/ext/http/php_http_api.h'
Installing '/usr/include/php/ext/http/php_http_buffer.h'
Installing '/usr/include/php/ext/http/php_http_client.h'
Installing '/usr/include/php/ext/http/php_http_client_curl.h'
Installing '/usr/include/php/ext/http/php_http_client_curl_event.h'
Installing '/usr/include/php/ext/http/php_http_client_curl_user.h'
Installing '/usr/include/php/ext/http/php_http_client_request.h'
Installing '/usr/include/php/ext/http/php_http_client_response.h'
Installing '/usr/include/php/ext/http/php_http_cookie.h'
Installing '/usr/include/php/ext/http/php_http_curl.h'
Installing '/usr/include/php/ext/http/php_http_encoding.h'
Installing '/usr/include/php/ext/http/php_http_encoding_brotli.h'
Installing '/usr/include/php/ext/http/php_http_encoding_zlib.h'
Installing '/usr/include/php/ext/http/php_http_env.h'
Installing '/usr/include/php/ext/http/php_http_env_request.h'
Installing '/usr/include/php/ext/http/php_http_env_response.h'
Installing '/usr/include/php/ext/http/php_http_etag.h'
Installing '/usr/include/php/ext/http/php_http_exception.h'
Installing '/usr/include/php/ext/http/php_http_filter.h'
Installing '/usr/include/php/ext/http/php_http_header.h'
Installing '/usr/include/php/ext/http/php_http_header_parser.h'
Installing '/usr/include/php/ext/http/php_http_info.h'
Installing '/usr/include/php/ext/http/php_http_message.h'
Installing '/usr/include/php/ext/http/php_http_message_body.h'
Installing '/usr/include/php/ext/http/php_http_message_parser.h'
Installing '/usr/include/php/ext/http/php_http_misc.h'
Installing '/usr/include/php/ext/http/php_http_negotiate.h'
Installing '/usr/include/php/ext/http/php_http_object.h'
Installing '/usr/include/php/ext/http/php_http_options.h'
Installing '/usr/include/php/ext/http/php_http_params.h'
Installing '/usr/include/php/ext/http/php_http_querystring.h'
Installing '/usr/include/php/ext/http/php_http_response_codes.h'
Installing '/usr/include/php/ext/http/php_http_url.h'
Installing '/usr/include/php/ext/http/php_http_utf8.h'
Installing '/usr/include/php/ext/http/php_http_version.h'
install ok: channel://pecl.php.net/pecl_http-3.2.3
configuration option "php_ini" is not set to php.ini location
You should add "extension=http.so" to php.ini
I had the same problem too.
My problem was that when I use RuntimeException class, I made a mistake by import use http\Exception\RuntimeException; instead of the standard one use RuntimeException. And the class http\Exception\RuntimeException; required ext-http extension.
So my suggestion is that, you should search your all project and check whether you made the same mistake as mine or not. You can search all by keyword use http\.
Btw I don't think install or unstall ext-http plugin will solve the problem.
According to PHP Official Documentation, You'll have to find your extension in php.ini and uncomment it OR add it in general. It's probably something like extension=php_http.dll.
Have you already tried the options here for similar issues?
Composer: The requested PHP extension ext-intl * is missing from your system
I have not experienced this issue on WAMP stacks yet... but it looks like some related articles (where this particular item 'ext-http' is not the issue) could be helpful.
When I've had similar issues on LAMP stacks, it usually meant that I did need to install the item mentioned... though sometimes Composer was a bit misleading as to the actual item needed.
Example #1 (LAMP)... actual item described was needed:
composer require phpoffice/phpspreadsheet
Error produced: missing php-mstring
Solution:
yum install php-mbstring
Example #2 (LAMP)... something slightly different than the item described was needed:
composer require phpoffice/phpspreadsheet
Error produced: missing ext-zip
Solution:
yum install php-pecl-zip
Also, perhaps running composer in verbose mode?
But, I think your best bet to start is the first link provided in this answer (and then looking through similar WAMP Composer missing item issues).
Had the same problem in composer.json file. Also discovered, that I have an "ext-http": "*". To solve this problem just delete the "ext-http": "*" and try to install package again. Worked for me, hope for you too :)
In my case, the combination worked (Ubuntu php7.4)
sudo apt install php-pear
pecl install pecl_http

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.

Issue with installing zendframework2 skeleton

i'm new to zendframework 2 , while trying to install it , using composer , it gets installed but an error message appears saying :
Your requirements could not be resolved to an installable set of packages.
Problem1
- Installation request for zendframework/zendframework 2.3.* -> satisfiable by zendframework/zendframework[2.3.0].
- zendframework/zendframework 2.3.0 requires php >=5.3.23 -> no matching package found
knowing that I have php 5.4.3.
Could someone please explain to me what's wrong ?
thanks in advance
Make sure the PHP version you are using for the CLI is using PHP 5.4.3 too. The CLI version can use a different PHP version than the host. You can get the php version used by the console by using the php --version command.

Categories