Forums

Resolved
0 votes
Hello!

I'd like to poke the Google Ads API with PHP (7.3), and the fancy new way of doing this makes use of gRPC. However, no matter what I try, I can't seem to get it to play nice for my setup. Ideally, I'd like to future proof things a little by not relying on the REST alternative (plus I'm terribly lazy and their SDK for PHP uses gRPC, so why re-invent the wheel?).
What have I tried? Well, all the steps here : https://cloud.google.com/php/grpc - that covers using PECL, attempting to build from source and halfway houses inbetween. From what I've read elsewhere CentOS doesn't play too well with the PECL route (so I'm also assuming - dangerous word - that ClearOS doesn't either - seems to lock up on the PHPIzing stage), and when building from source I hit "Error 1" style messages which relate to "issues" in the third party elements of the GIT repo. Delving into that quagmire isn't one I want to approach.

Really what I'm asking is, has anybody else cracked this egg? Is there a nice repository out there that has a simple "yum install grpc" kind of call that I can make use of (I've looked, but not turned up anything myself - I'm fairly new to the whole server side of things, coming mainly from a dev/front end background)? I shall keep persisting, but if anyone can throw any suggestions my way, that'd be much appreciated!

Thanks for reading!
Monday, October 25 2021, 01:36 PM
Share this post:
Responses (6)
  • Accepted Answer

    Monday, October 25 2021, 02:14 PM - #Permalink
    Resolved
    0 votes
    How are you making sure you are running with PHP 7.x?
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, October 26 2021, 11:00 AM - #Permalink
    Resolved
    0 votes
    Thanks for reading Nick, and for the quick response!

    php -v (by default) shows me 5.4.16 on the command line, though I've set up the .phpenv entry with "73" in the /usr/clearos/bin/ location (from within there, php -v returns 7.3.29 as the version available to me).

    What I've been doing, whenever I've needed to ensure that I'm running that version (either on the command line or in a PHP script or wherever), is simply specifying the full path/shebang along the lines of /opt/rh/rh-php73/root/usr/bin/php - same with if I've needed pecl, pear, phpize or anything else that goes hand in hand with a particular version.

    If I run the 'pecl install grpc' command, it downloads version 1.41.0 (which seems to be the latest), says it's running 'phpize7.3' (which suggests to me it's using the version of PHP I'm wanting this fetching for?), but then doesn't seem to get any further (and I've left it a looooong time to be sure of that!).
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, October 26 2021, 11:26 AM - #Permalink
    Resolved
    0 votes
    From what I understand you need the .phpenv file somewhere in the path of where you are calling the executable from so setting /root/.phpenv to 73 allows me to use php73 when called from /root, /root/cust etc. The magic for that is in /usr/clearos/bin/php.

    Having said that, using the full path in the shebang should also work.

    It is a pity that ClearOS injects /usr/clearos/bin into the PATH which defeats the normal "scl enable rh-php73 ...." command. You could try invoking:
    scl enable rh-php73 bash
    Then manipulate the path there to remove the /usr/clearos/bin from the PATH string and then see if it works running from there.

    Beyond that, I have no idea.
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, October 26 2021, 11:30 AM - #Permalink
    Resolved
    0 votes
    Do you have rh-php73-php-devel installed?
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, October 26 2021, 02:03 PM - #Permalink
    Resolved
    0 votes
    Definitely installed the devel version (not sure how to actually prove that though!). From memory I followed another thread that you'd had a large hand in, enabling unverified repositories and such to get other bits and bobs like ImageMagick and so on working - huge learning experience for me, all good stuff :)

    Think I'm just about getting my head around the concept of the various PHP's happily co-existing, so I will give your suggestion about getting 7.3 onto the command line a go, so I can just run things without fear of it going off and using a different version of PHP or whatever as I guess there is the possibility that is happening somewhere.

    Once again, many thanks for your help!
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, October 26 2021, 02:09 PM - #Permalink
    Resolved
    0 votes
    The devel package is directly available through yum without any special repos. You can check that you have it with "rpm -q rh-php73-php-devel".
    The reply is currently minimized Show
Your Reply