Unable to install php_pgsql in AWS ElasticBeanstalk - php

I am trying to connect to RDS instance from EB. But I am getting this nasty error
Fatal error: Call to undefined function pg_connect()
I tried to install php_pgsql by creating packages.config file in .ebextensions folder with following content.
packages:
yum:
php56-pgsql: []
commands:
01-install-pglib:
command: "yum install -y postgresql94-libs"
02-install-pg:
command: "yum install -y php56-pgsql"
03-install-pg:
command: "service httpd restart"
But it is not working. Is there any way to install pg client for PHP in ElasticBeanstalk.

I was able to resolve this issue by following commands.
container_commands:
110-remove-pg:
command: "yum remove -y php56-pgsql"
120-install-pglib:
command: "yum install -y postgresql94-libs"
130-install-pg:
command: "yum install -y php56-pgsql"
Hope it helps someone.

Related

Fatal error: Uncaught Error: Call to undefined function ssh2_connect() in Ubuntu 18.4

Hey there here i am trying to run a php code to connect with SSH and i am using phpseclib but i am facing a very frustrating situation here.
$connection_string = ssh2_connect('xyz', 22);
Check the documentation and try commands below:
1. sudo apt install php-pear
2. sudo pecl channel-update pecl.php.net
3. sudo sudo apt install phpуourversion-dev
4. sudo pecl install ssh2
Hope help you.

Cannot install PHP7 to AWS EC2 instance?

I have successfully installed apache 2.4.34 onto my instance but I am unable to install PHP7. I have tried the following:
sudo yum install php70
But I get the following error:
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
No package php70 available.
Error: Nothing to do
It could be possible that you are missing the right name. Check what php version is there with the command:
yum search php70
After that you should see a php version name. Copy and paste it to your command like:
yum install <php version name>
Make sure you put the whole php version name and don't forget to restart your apache!!!
apt-get update && apt-get upgrade
apt-get install software-properties-common
add-apt-repository ppa:ondrej/php
apt-get update
apt-get install php<Your desired version>
Confirm it installed by running:
php -V

Unable to install php-5 phalcon for ubuntu 16.04

My machine is running on ubuntu 16.04 and I have installed php 5.6, but when I am trying to run to install php5-phalcon, it returns error that package not found.
Following is command that I ran
sudo apt-get install php5-phalcon
It returns following output
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php5-phalcon
You need to add the correct repository in first...
curl -s "https://packagecloud.io/install/repositories/phalcon/stable/script.deb.sh" | sudo bash
sudo apt-get install php5-phalcon
# Ubuntu 16.04+, Debian 9+
sudo apt-get install php7.0-phalcon
(From https://phalconphp.com/en/download/linux)
After trying few methods, found that php5.6-phalcon is not available for ubuntu 16.04, following are steps to install php7.0-phalcon :
curl -s "https://packagecloud.io/install/repositories/phalcon/stable/script.deb.sh" | sudo bash
# Ubuntu 16.04+, Debian 9+
sudo apt-get install php7.0-phalcon

Error 1 ERROR: `make' failed when installing sqlsrv

I'm trying to install sqlsrv by using the commands from this page. However, when running
pecl install sqlsrv-4.2.0preview
I get the error: Error 1 ERROR: 'make' failed.
I tried :
apt-get update
apt-get install build-essential
apt-get install libpcre3-dev
apt-get install make
All of these are installed on the latest version.
I'm running a container using the php:7.0-apache image. Running apachectl -V returns Apache/2.4.10 (Debian).
Here is the full log output from the command I ran: https://pastebin.com/MYDY3xwU
I had this exact error.
/tmp/pear/temp/sqlsrv/shared/xplat.h:30:17: fatal error: sql.h: No such file or directory
#include <sql.h>
Apparently the header file its looking for is only in the package unixODBC-devel.
I installed that package and was able to successfully complete the build. yum install unixODBC-devel.
Possibly, a better explanation is here.
stackoverflow Question # 15447386
I had the following error on Ubuntu 18.04 when installing
/tmp/pear/temp/sqlsrv/shared/xplat.h:30:10: fatal error: sql.h: No such file or directory #include <sql.h>
Installing the package unixodbc-dev as Matthew Goheen proposed solved the issue
sudo apt-get install unixodbc-dev
try
sudo apt-get install unixodbc-dev

cloud9, cannot install php cURL

I'm trying to execute my php script with a Curl request in cloud9.
When I run, I have this Exception:
"Uncaught exception 'Exception' with message 'php function "curl_init" is missing' in /home/ubuntu/workspace/test.."
I tried to install curl with sudo apt-get install php-curl
or sudo apt-get install php5.5-curl,
also with "ppa:ondrej/php" repository.
Curl package seems to be installed successfully in the cloud9 virtual machine, but it hasn't been enabled in my php.ini.
Hope this works for you:
sudo apt-get update
Then:
sudo apt-get install php5-curl
If you are running Ubuntu, use
$ sudo apt-get install php-curl
This will install 'php7.2-curl' as at 16/05/2019.

Categories