How to Setting PDO PHP 7.0 on AWS Server EC2 - amazon-ec2

I have trouble on setting PDO on AWS Server. Like this :
[root#ip-172-31-31-52 /]# sudo yum install php-pdo
Loaded plugins: priorities, update-motd, upgrade-helper
amzn-main | 2.1 kB 00:00
amzn-updates | 2.5 kB 00:00
Resolving Dependencies
--> Running transaction check
---> Package php-pdo.x86_64 0:5.3.29-1.8.amzn1 will be installed
--> Processing Dependency: php-common(x86-64) = 5.3.29-1.8.amzn1 for package: php-pdo-5.3.29-1.8.amzn1.x86_64
--> Running transaction check
---> Package php-common.x86_64 0:5.3.29-1.8.amzn1 will be installed
--> Processing Conflict: php70-common-7.0.33-1.32.amzn1.x86_64 conflicts php-common < 5.5.22-1.98
--> Finished Dependency Resolution
Error: php70-common conflicts with php-common-5.3.29-1.8.amzn1.x86_64
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
How to solve this. I need PDO settings. Please help me

Step 1:
Take snapshot of your server
Step 2:
Check your php version and install the php packages corresponding to php version.
Additional info:
Laravel 5.4 requires PHP >= 5.6.4
Make sure you install php 5.6.4 or greater.
Specifically call out the exact package for php version.
Example:
For PHP 5.6 support, the package is php56-mysqlnd.
For PHP 7.0 support, the package is php70-mysqlnd.
For PHP 7.1 support, the package is php71-mysqlnd.
These package will install pdo support.
Advice, Install latest stable version of php and laravel.
Happy coding!

Related

Laravel Horizon install fail in my local machine

I have install laravel Laravel Framework 6.7.0 in local machine. I have working redis queue and jobs. but i have install horizon using this link https://laravel.com/docs/6.x/horizon. but i have not install .
I have atteched sceenshort below Please check.
As the output Using version ^4.2 for laravel/horizon states composer tries to install version 4 of laravel/horizon - which is Laravel7 only. You need to install version 3, which is compatible with Laravel6:
composer require laravel/horizon ^3.0

Installing GoCD Agent with Yum fails with `sysvinit-tools` not found

I'm' trying to install GoCD Agent with sudo yum install -y go-agent
However, I'm getting the following error.
Resolving Dependencies
--> Running transaction check
---> Package go-agent.noarch 0:19.6.0-9515 will be installed
--> Processing Dependency: sysvinit-tools for package: go-agent-19.6.0-9515.noarch
--> Finished Dependency Resolution
Error: Package: go-agent-19.6.0-9515.noarch (gocd)
Requires: sysvinit-tools
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
I tried installing sysvinit-tools with sudo yum install sysvinit-tools
I'm getting the following error.
Loaded plugins: priorities, update-motd, upgrade-helper
amzn-main | 2.1 kB 00:00:00
amzn-updates | 2.5 kB 00:00:00
No package sysvinit-tools available.
Error: Nothing to do
I'm on Amazon Linux AMI
In your case you appear to be on Amazon Linux AMI 2018.03 which is rather old and does not have sysvinit-tools.
I would recommend upgrading your machine, and to avoid upgrading sysvinit manually.
for centos7:
you can find that package in the epel repositories
First add the epel repository:
yum install epel-release
now you will be able to install sysvinit-tools:
yum install sysvinit-tools

How to install Imap on Amazon Linux with PHP 7.2.13

I am setting up a new instance and trying to install php-imap on it with no luck.
I am using: sudo yum install php-imap
And getting the following output:
Loaded plugins: priorities, update-motd, upgrade-helper
amzn-main | 2.1 kB 00:00
amzn-updates | 2.5 kB 00:00
Resolving Dependencies
--> Running transaction check
---> Package php-imap.x86_64 0:5.3.29-1.8.amzn1 will be installed
--> Processing Dependency: php-common(x86-64) = 5.3.29-1.8.amzn1 for package: php-imap-5.3.29-1.8.amzn1.x86_64
--> Running transaction check
---> Package php-common.x86_64 0:5.3.29-1.8.amzn1 will be installed
--> Processing Conflict: php72-common-7.2.13-1.7.amzn1.x86_64 conflicts php-common < 5.5.22-1.98
--> Finished Dependency Resolution
Error: php72-common conflicts with php-common-5.3.29-1.8.amzn1.x86_64
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
Anyone have been able to install it on Amazon Linux (free tier) with Php version 7.2.13?

PHP7 : install ext-dom issue

I'm running laravel 5.4 on Ubuntu 16.04 server with PHP7. trying to install cviebrock/eloquent-sluggable package throw some error:
pish#let:/home/sherk/ftp/www$ sudo composer require cviebrock/eloquent-sluggable
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Using version ^4.2 for cviebrock/eloquent-sluggable
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- phpunit/php-code-coverage 4.0.7 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/php-code-coverage 4.0.7 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- Installation request for phpunit/php-code-coverage (installed at 4.0.7) -> satisfiable by phpunit/php-code-coverage[4.0.7].
To enable extensions, verify that they are enabled in those .ini files:
- /etc/php/7.0/cli/php.ini
- /etc/php/7.0/cli/conf.d/10-mysqlnd.ini
- /etc/php/7.0/cli/conf.d/10-opcache.ini
- /etc/php/7.0/cli/conf.d/10-pdo.ini
- /etc/php/7.0/cli/conf.d/20-calendar.ini
- /etc/php/7.0/cli/conf.d/20-ctype.ini
- /etc/php/7.0/cli/conf.d/20-exif.ini
- /etc/php/7.0/cli/conf.d/20-fileinfo.ini
- /etc/php/7.0/cli/conf.d/20-ftp.ini
- /etc/php/7.0/cli/conf.d/20-gd.ini
- /etc/php/7.0/cli/conf.d/20-gettext.ini
- /etc/php/7.0/cli/conf.d/20-iconv.ini
- /etc/php/7.0/cli/conf.d/20-json.ini
- /etc/php/7.0/cli/conf.d/20-mbstring.ini
- /etc/php/7.0/cli/conf.d/20-mcrypt.ini
- /etc/php/7.0/cli/conf.d/20-mysqli.ini
- /etc/php/7.0/cli/conf.d/20-pdo_mysql.ini
- /etc/php/7.0/cli/conf.d/20-phar.ini
- /etc/php/7.0/cli/conf.d/20-posix.ini
- /etc/php/7.0/cli/conf.d/20-readline.ini
- /etc/php/7.0/cli/conf.d/20-shmop.ini
- /etc/php/7.0/cli/conf.d/20-sockets.ini
- /etc/php/7.0/cli/conf.d/20-sysvmsg.ini
- /etc/php/7.0/cli/conf.d/20-sysvsem.ini
- /etc/php/7.0/cli/conf.d/20-sysvshm.ini
- /etc/php/7.0/cli/conf.d/20-tokenizer.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.
Installation failed, reverting ./composer.json to its original content.
I have no problem installing this package on local version of the app .
First of all, read the warning! It says do not run composer as root!
Secondly, you're probably using Xammp on your local which has the required php libraries as default.
But in your server you're missing ext-dom. php-xml has all the related packages you need. So, you can simply install it by running:
sudo apt-get update
sudo apt install php-xml
Most likely you are missing mbstring too. If you get the error, install this package as well with:
sudo apt-get install php-mbstring
Then run:
composer update
composer require cviebrock/eloquent-sluggable
sudo apt install php-xml will work but the thing is it will download the plugin for the latest PHP version.
If your PHP version is not the latest, then you can add version in it:
# PHP 7.1
sudo apt install php7.1-xml
# PHP 7.2:
sudo apt install php7.2-xml
# PHP 7.3
sudo apt install php7.3-xml
# PHP 7.4
sudo apt install php7.4-xml
# PHP 8
sudo apt install php-xml
For CentOS, RHEL, Fedora:
$ yum search php-xml
============================================================================================================ N/S matched: php-xml ============================================================================================================
php-xml.x86_64 : A module for PHP applications which use XML
php-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol
php-xmlseclibs.noarch : PHP library for XML Security
php54-php-xml.x86_64 : A module for PHP applications which use XML
php54-php-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol
php55-php-xml.x86_64 : A module for PHP applications which use XML
php55-php-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol
php56-php-xml.x86_64 : A module for PHP applications which use XML
php56-php-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol
php70-php-xml.x86_64 : A module for PHP applications which use XML
php70-php-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol
php71-php-xml.x86_64 : A module for PHP applications which use XML
php71-php-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol
php72-php-xml.x86_64 : A module for PHP applications which use XML
php72-php-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol
php73-php-xml.x86_64 : A module for PHP applications which use XML
php73-php-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol
Then select the php-xml version matching your php version:
# php -v
PHP 7.2.11 (cli) (built: Oct 10 2018 10:00:29) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
# sudo yum install -y php72-php-xml.x86_64
you need just update your local composer file:
first you need remove "composer.lock" file from you app
then, exec in your bash:
composer update --ignore-platform-req=ext-curl
so try again
composer require cviebrock/eloquent-sluggable

How do I install mcrypt extension for php 7.1 on MacOS 12 for Laravel development?

This is driving me crazy and following all the online tutorials hasn't helped.
I have just upgraded to a new mac running MacOS Sierra (10.12.1) and am trying to get my development environment configured. However, whenever I run composer update or composer install on my project I get the following message:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20131226/mcrypt.so' - dlopen(/usr/lib/php/extensions/no-debug-non-zts-20131226/mcrypt.so, 9): image not found in Unknown on line 0
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
- Installation request for laravel/framework v5.0.35 -> satisfiable by laravel/framework[v5.0.35].
- laravel/framework v5.0.35 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
Problem 2
- laravel/framework v5.0.35 requires ext-mcrypt * -> the requested PHP extension mcrypt is missing from your system.
- tom-lingham/searchy 2.0.10 requires illuminate/support 5.* -> satisfiable by laravel/framework[v5.0.35].
- Installation request for tom-lingham/searchy 2.0.10 -> satisfiable by tom-lingham/searchy[2.0.10].
To enable extensions, verify that they are enabled in those .ini files:
- /etc/php.ini
I have run brew install mcrypt and it is already installed.
Warning: mcrypt-2.6.8 already installed
The system is running php 7.1 so I have also run brew install php71-mcrypt
extension=mcrypt.so has been included in the php.ini files, both on my machine and I have tried it inside the vagrant machine.
Any help would be much appreciated as I have been at this for 2 days now!
Since you are running vagrant, you need to install mcrypt within the vagrant machine. check which version of php you have installed on vagrant and install mcrypt using
sudo apt-get install *{mcrypt-version-here}*
restart apache using
sudo service apache2 restart
I had troubles of installing mcrypt-1.0.3 with PHP 7.1 on MacOS 12 Monterey.
~/projects/rest-api php -v
PHP 7.1.33 (cli) (built: Jun 7 2022 17:45:50) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.1.33, Copyright (c) 1999-2018, by Zend Technologies
pecl install mcrypt-1.0.3 and pecl install --force mcrypt-1.0.3 failed with next error:
...
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
ERROR: `/private/tmp/pear/temp/mcrypt/configure --with-php-config=/opt/homebrew/opt/php#7.1/bin/php-config --with-mcrypt' failed
But I managed to install it with next command:
pecl install --force mcrypt-1.0.3 <<<"$(ls -d $(brew --prefix)/Cellar/mcrypt/* | tail -1)"
Last lines of result:
...
Build process completed successfully
Installing '/opt/homebrew/Cellar/php#7.1/7.1.33_4/pecl/20160303/mcrypt.so'
install ok: channel://pecl.php.net/mcrypt-1.0.3
Extension mcrypt enabled in php.ini
~/projects/rest-api php -m | grep mcrypt
mcrypt
Please see solution source.

Resources