Heroku PHP how to install OAuth - php

How the heck do you install the PHP OAuth package on Heroku?
The Heroku docs say this https://devcenter.heroku.com/articles/php-support#using-optional-extensions
which then says
The following third-party extensions can be enabled through composer.json (internal identifier names given in parentheses):
and then it refers to http://docs.php.net/oauth
I have it working locally as I installed it according to directions, but the Heroku directions are extremely lacking.
what are you suppose to put in composer.json?
Does anyone have any experience installing the OAuth package on heroku?

Related

Will anyone help me debug "proto descriptor was previously loaded" from Google Ads API

I'm getting this error when running this code:
$googleAdsClient->getGoogleAdsServiceClient()->search($customerId, $query, $page_size);
ERROR message:
proto descriptor was previously loaded (included in multiple metadata bundles?): google/ads/googleads/v5/enums/policy_topic_evidence_destination_not_working_dns_error_type.proto
$googleAdsClient is an instance of \Google\Ads\GoogleAds\Lib\V5\GoogleAdsClient.
The getGoogleAdsServiceClient method comes from the ServiceClientFactoryTrait trait /Google/Ads/GoogleAds/Lib/V5/ServiceClientFactoryTrait.php
I'm running:
php 7.4.1
grpc module version => 1.34.0
protobuf version => 3.14.0
Additional libs installed via composer:
google/grpc-gcp 0.1.5 gRPC GCP library for channel management
google/protobuf v3.13.0.1 proto library for PHP
googleads/google-ads-php v5.0.0 Google Ads API client for PHP
grpc/grpc 1.30.0 gRPC library for PHP
I don't know enough about descriptors or the protobuf library to understand this error. It just started happening a couple days ago and I don't think we made any changes that would effect this. Any help/guidance would be much appreciated.
EDIT: forgot to link to SDK https://github.com/googleads/google-ads-php
EDIT: updated the following libs:
google/apiclient v2.9.1 Client library for Google APIs
google/apiclient-services v0.161.0 Client library for Google APIs
google/auth v1.15.0 Google Auth Library for PHP
google/common-protos 1.3 Google API Common Protos for PHP
google/gax 1.7.0 Google API Core for PHP
google/grpc-gcp 0.1.5 gRPC GCP library for channel management
google/protobuf v3.15.3 proto library for PHP
googleads/google-ads-php v7.0.0 Google Ads API client for PHP
grpc/grpc 1.35.0 gRPC library for PHP
google/protobuf v3.15.3 proto library for PHP
I found the issue for me. I had the C implementation installed via pecl install protobuf. Sense I'm running my app in a docker container, every time I built a new image it would install the latest release of protobuf. Sense I started seeing this error around the 22nd of Feb I looked at the protobuf builds and I see a build on the 20th of Feb for version 3.15.0 which coincides with a new build I ran on the 22nd.
To fix this I downgraded to version 3.14.0 via the pecl install protobuf-3.14.0 command in my Dockerfile. This isn't a permanent fix as at some point I want to upgrade the package but I will have to wait for a version that deals with this issue.
This problem was addressed in https://github.com/googleads/google-ads-php/issues/540 and fixed in protobuf version 3.18.0 ( https://github.com/protocolbuffers/protobuf/releases/tag/v3.18.0 )
The error is because two library is your project are providing the proto descriptor for same file policy_topic_evidence_destination_not_working_dns_error_type.proto.
Looks like this issue was fixed in version v6 for google ads library link
Just update the libarry to v6 and above (latest is v7) and it should fix the problem
Latest Release
I have same error, I commented out the line
; extension=protobuf.so
in /etc/php/7.4/apache2/php.ini and
in /etc/php/7.4/cli/php.ini
and restart apache
sudo service apache2 restart
and error was gone, I hope this will be helpful for someone.

Error in installing Symfony4

I am new to Symfony skeleton. Can anyone please help to get out from this error for installation of Symfony? I had searched a lot on the internet but cannot find any working solutions. Composer is working well. I am using PHP7 and XAMP server.
Error is Could not find package Symfony/skeleton with stability Stable in a version installable using your PHP version 7.0.2.
Cerad's answer is correct. Please check Requirements for Running Symfony
It states the following:
Symfony 4.0 requires PHP 7.1.3 or higher to run, in addition to other minor requirements.
If you have to live with php7.0, you are able to install the symfony demo project via symfony installer, see how to install symfony installer for sf3.4.
After you have installed sf installer, you can install the demo project with old symfony version by doing:
$ symfony new blog 3.0.1
As mentioned by Cerad, you need have php7.1 or newest php version to install latest symfony demo project. But you can also have a try to install the demo project with older version by doing:
$ composer create-project symfony/website-skeleton:3.3
you can find the the release version which you need here
You just need to change your Php version from 7.02 to upper version.
I had the same issue, my path variable was pointing at php7.0., change it to php7.2. and the problem solved immediatly.
Important : Don't forget to restart you terminal.
I had a similar problem not being able to find 4.4 without php version part.
In case some one comes in contact with this (As I did), installing Symfony CLI and using it instead of direct composer, might solve the problem.
I was actually able to install Symfony 4.4 project as below
composer create-project symfony/website-skeleton:"^6.0" yourProjetName
try to specify the version 6.0
It solved my problem
I encountered this error while installing Symfony Demo App (Symfony 6). If your PHP runtime has passed symfony check:requirements, you may want to enable PDO-SQLite PHP extension or other project requirements such as the supported PHP version - Symfony Demo's Requirements.
Assuming that OP's goal is to setup and install Symphony, according to Synfony's Official Docs there are various ways one can go about doing it.
First of all, make sure one is satisfying all the requirements. For my example I will be using the most recent versions of Symphony and PHP:
Install PHP 8.1 or higher and these PHP extensions (which are
installed and enabled by default in most PHP 8 installations): Ctype,
iconv, PCRE, Session, SimpleXML, and Tokenizer;
Install Composer, which is used to install PHP packages.
Optionally, you can also install Symfony CLI. This creates a binary called symfony that provides all the tools you need to develop and run your Symfony application locally.
In this case, it seems that OP has already installed both PHP and composer, however OP might have to update the PHP version (as Cerad mentioned).
Now, depending on one's goals, there are different ways to move one:
If one is building a traditional web application open the CMD or Git Bash, and run
composer create-project symfony/skeleton:"6.1.*" my_project_directory
Then
cd my_project_directory
And
composer require webapp
If one is building a microservice, console application or API, then open the CMD or Git Bash and run
composer create-project symfony/skeleton:"6.1.*" my_project_directory
Notes:
In both cases, by specifying the version shouldn't give us the error that OP is facing.
If error keeps on appearing, would recommend using CMD or Git Bash as I've tried here and worked fine with both.
you forgot to specify the installation folder. Use a dot to install in the current folder.

Installing OAuth PECL package on PHP 5 on OS X

I'm trying to install the OAuth PECL package, and I'm using PHP 5.
When I run the install command, I get the error below that I must have PHP version 7.0.
Upgrading to PHP 7 is not an option right now, so how do I get the OAuth package installed for PHP 5?
chris$ sudo pecl install oauth
pecl/oauth requires PHP (version >= 7.0.0), installed version is 5.5.29
No valid packages found
install failed
It seems like the dependencies are messed up for Version 2.0.0 of oauth. You can install the previous version like this:
sudo pecl install oauth-1.2.3
I also filed an issue on their GitHub project on your behalf (here), as this seems to be an unintentional bug.
In package.xml, we have:
<required>
<php>
<min>7.0.0</min>
</php>
<!-- ... -->
</required>
Edit
Looks like there's some news from the bug report. Indeed, version 2.0.0 only supports PHP7 and the changelog was unclear. The maintainer of oauth has filed a bug against PECL to install the latest compatible version. So, yes, you're stuck with 1.2.3 and the instructions above are correct.
Edit Again
It looks like PECL won't be fixing this any time soon, so we're stuck installing the specific version :)
Extending upon the already accepted answer
If you are facing compilation errors like I did most probably you are using some application like MAMP.
Unfortunately the latest version of MAMP doesn't include all the components of php.
To install the missing headers download the respective php source code.
Source code for php-5.6.10 can be downloaded from here
After downloading the source code extract it in the php folder under include/php in my case the php folder was located at /Applications/MAMP/bin/php/php5.6.10 so I extracted files under /Applications/MAMP/bin/php/php5.6.10/include/php.
Note:
When you extract the files they are extracted in a folder like php-version in my case it was php-5.6.10 rename it to php and then move it to include folder.
Now go to /Applications/MAMP/bin/php/php5.6.10/include/php and then run ./configure this should build the required header files and then you can install oauth.

Windows 10 can't use AWS SDK for PHP v3 with Composer

I'm a student and pretty new to web development so forgive me if I'm missing something obvious. I recently attended a hackathon and was on a team with experienced developers who were building an app for deployment on AWS using the the Silex framework. Everyone else was using a Mac, while I have a PC running Windows 10. When they integrated AWS PHP SDK v3 from packagist I was unable to run the composer update function from the command line - I kept getting the following message:
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
- aws/aws-sdk-php 3.3.5 requires php >=5.5 -> your PHP version (5.4.24) or "
config.platform.php" value does not satisfy that requirement.
Because I was unable to run the composer update function, I wasn't able to update my app code and I couldn't continue to work on the project. This was frustrating, but I'm also just very confused about how to update PHP on my computer... I downloaded the zip file for PHP 5.6.13-nts and followed all the instructions I could find online for placing it in a folder structure, I also updated IIS so I can run phpinfo() on localhost and see that I have version 5.6.13 - yet when I try to run the composer update it still says I have PHP 5.4.24.
If anyone has any advice on this issue I'd appreciate it. Here's the version of the AWS SDK that's referenced above:
https://packagist.org/packages/aws/aws-sdk-php-silex
Welcome to StackOverflow, Blake!
It seems that you have multiple PHP versions installed and the CLI command php composer.phar ... uses php.exe from the old version. My guess is that the old version is still on the env path.
I suggest to check your environment path to find out, if the path to the old version of PHP is still added there. If so, simply replace it by the path to the new PHP version. And then execute a simple php -v on the CLI to see, if the new version is used. After that Composer should run fine.
You reach the dialog to change the environment variables by pressing WinBreak, then select "Advanced system settings", then "Environment Variables", then "Path".
(Sidenote and shameless plug: there are pre-configured web development stacks for Windows out there: WPN-XM or XAMPP, just to name a few. They are made to save developers some time, instead of doing software installation and configuration. Some of them ship Composer and other tools relevant for development with PHP right out of the box.)

Azure Cloud Service PHP Pear Packages

I am following this tutorial http://azure.microsoft.com/en-gb/documentation/articles/storage-php-how-to-use-blobs/ on ussing the Azure PHP SDK to access Azure Storage Blobs.
I need to read and write to these blobs from my live Cloud Service running my PHP App. It says that the SDK is dependent on some PEAR Packages and that they should be installed using the "Pear package Installer"
The PHP Client Libraries for Azure have a dependency on the HTTP_Request2, Mail_mime, and Mail_mimeDecode PEAR packages. The recommended way to resolve these dependencies is to install these packages using the PEAR package manager.
This is all well and good on my DEV server, I simply install PEAR and then install the packages. But obviously once the App is packaged and pushed to my Azure Production Cloud Service, it doesn't contain Pear or any of packages. PHP is installed on the Cloud Service when it is spun up using the ServiceDefinition.csdef Startup Tasks. Every new instance has PHP installed on startup.
So how do I get PEAR and these Packages on my Cloud Instance? I have Googled and cannot find anything that explains using Pear on Cloud Instances, yet all the SDK documentation says it is needed?!?
Am I misunderstanding something?
While the PEAR package manager has been a mainstay in days gone by, I think it's rapidly being replaced by Composer and the like.
You don't HAVE to install using the PEAR tool, however. All it is is an early package manager. You can download the PEAR libraries individually and place them in a common directory
http://pear.php.net/package/PEAR/download
The caveat here is that this is 100% manual and all on you to update packages but PEAR updates are few and far between. Download each package and then do something to set the base include directory.
set_include_path('/path/to/pear');

Categories