Comments (6)
That worked, thank you :).
from frankenphp.
I don't see how it's related to FrankenPHP. If it works with a standard PHP build, it should work with FrankenPHP as well. If it's not the case, could you provide a reproducer (if possible a minimal Docker image) and the related logs?
Thanks.
from frankenphp.
Thanks @dunglas for fast response :). It might not be improvement, I thought so it was, but more like "I dont know how to implement it with frankenphp".
This is instruction how to make it work with PHP
https://github.com/lwthiker/curl-impersonate/blob/main/docs/03_LIBCURL_IMPERSONATE_PHP.md
And as I take frankenphp in dockerfile
FROM dunglas/frankenphp:1-php8.3 AS php_upstream
I managed to make it work with php with
RUN git clone https://github.com/lwthiker/curl-impersonate.git
WORKDIR curl-impersonate
RUN mkdir build
WORKDIR build
RUN ../configure
RUN make chrome-build
RUN make chrome-install
RUN ldconfig
WORKDIR /app/curl-impersonate
RUN rm -Rf build
RUN patchelf --set-soname libcurl.so /usr/local/lib/libcurl-impersonate-chrome.so
RUN echo "/usr/local/lib/libcurl-impersonate-chrome.so" > /etc/ld.so.preload
And when I run
php -r 'print_r(curl_version());'
It gives me
[ssl_version] => BoringSSL
But when I make http request which is handled by frankenphp it does not return info via libcurl-impersonate, but via original libcurl
from frankenphp.
Can you please share a dockerfile that reproduces the issue and shows what you're trying to do? Trying to piece together one from your post is error-prone.
Is this a docker file that reproduces the issue?
FROM dunglas/frankenphp:1-php8.3 AS php_upstream
RUN git clone https://github.com/lwthiker/curl-impersonate.git
WORKDIR curl-impersonate
RUN mkdir build
WORKDIR build
RUN ../configure
RUN make chrome-build
RUN make chrome-install
RUN ldconfig
WORKDIR /app/curl-impersonate
RUN rm -Rf build
RUN patchelf --set-soname libcurl.so /usr/local/lib/libcurl-impersonate-chrome.so
RUN echo "/usr/local/lib/libcurl-impersonate-chrome.so" > /etc/ld.so.preload
RUN php -r 'print_r(curl_version());'
RUN frankenphp # some script?
from frankenphp.
I managed to make it work. Everything is ok with Frankenphp, I just did not realize that frankenphp must be rebuilt after adding curl impersonate.
Here is working dockerfile
FROM dunglas/frankenphp:1.2-builder-php8.3 AS frankenphp_builder
## install curl-imperonate
RUN set -eux; \
apt-get update && apt-get install --no-install-recommends -y \
git \
build-essential \
pkg-config \
cmake \
ninja-build \
curl \
autoconf \
automake \
libtool \
golang-go \
unzip \
patchelf \
vim \
;
RUN git clone https://github.com/lwthiker/curl-impersonate.git
WORKDIR curl-impersonate
RUN mkdir build
WORKDIR build
RUN ../configure
RUN make chrome-build
RUN make chrome-install
RUN ldconfig
WORKDIR /app/curl-impersonate
RUN rm -Rf build
RUN patchelf --set-soname libcurl.so /usr/local/lib/libcurl-impersonate-chrome.so
RUN echo "/usr/local/lib/libcurl-impersonate-chrome.so" > /etc/ld.so.preload
## rebuild frankenphp
ENV CGO_LDFLAGS="-lssl -lcrypto -lreadline -largon2 -lcurl -lonig -lz $PHP_LDFLAGS" CGO_CFLAGS="-DFRANKENPHP_VERSION=$FRANKENPHP_VERSION $PHP_CFLAGS" CGO_CPPFLAGS=$PHP_CPPFLAGS
WORKDIR /go/src/app/caddy/frankenphp
RUN GOBIN=/usr/local/bin go install -ldflags "-w -s -X 'github.com/caddyserver/caddy/v2.CustomVersion=FrankenPHP $FRANKENPHP_VERSION PHP $PHP_VERSION Caddy'" && \
setcap cap_net_bind_service=+ep /usr/local/bin/frankenphp && \
cp Caddyfile /etc/caddy/Caddyfile && \
frankenphp version
from frankenphp.
That's surprising that you need a full rebuild.
Could you try if cleaning the ldconfig cache works instead?
rm /etc/ld.so.cache
ldconfig
from frankenphp.
Related Issues (20)
- [QUESTION] Is frankenphp can be use to pipelines ? HOT 6
- Missing space on webpage HOT 2
- Intermittent File Write Failures with fwrite HOT 3
- Invalid post type. error when I click on "POSTS" in teh Wordpress admin menu HOT 12
- Why do I constantly getting slower results with FrankenPHP vs php:8.3-fpm HOT 15
- Cannot rebuild static binary HOT 11
- ERROR: failed to receive status: rpc error: code = Unavailable desc = error reading from server: EOF HOT 2
- Segmentation fault In latest static version HOT 3
- 1.2.5 Not expanding (some?) Caddy's variables HOT 1
- Segmentation fault with php-vips (buffer)
- frankenphp is exiting on SIGPIPE failure HOT 3
- Call to undefined function session_save_path() after building standalone binary HOT 5
- "No Active Transaction" Error After Reconnecting Database in Worker Mode HOT 1
- Question: how to build a standalone frankenphp binary with Caddy cache-handler HOT 3
- curl.cainfo setting from php.ini is being ignored and thus certs aren't available to cURL HOT 20
- Allow a way to define scripts to be run regularly or as a service HOT 2
- Question: about task scheduling in laravel HOT 1
- Deploying on render.com
- XDebug toggling optimizations HOT 4
- Error after build process HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from frankenphp.