Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deployment Issue: SourceGuardian PHP Extension on One-Click App #2061

Closed
amirsaam opened this issue May 18, 2024 · 7 comments
Closed

Deployment Issue: SourceGuardian PHP Extension on One-Click App #2061

amirsaam opened this issue May 18, 2024 · 7 comments

Comments

@amirsaam
Copy link

Hi there,

I am quite new to Docker and decided to use CapRover as my entry point to it, so cuz of that sorry if I am asking a naive question or have a dumb issue.

My problem:
I cannot properly config SourceGuardian PHP Extension on my CapCover app (Specifically Wordpress - No Database One-Click App)
I bashed added my php path to persistent directories in CapRover app, downloaded the extension, created the extension directory in my in app php path (/usr/local/etc/php/20220829) and then put the extension file into that path and added the extension line (extension=ixed.8.2.lin) into "php.ini-development", "php.ini-production" and even "php.ini" in my wordpress path in the app. after restarting the app in CapRover dashboard, I still get the error for it not being installed.

What should I do? I have my wordpress installed and configured and not able to redeploy the whole thing from scratch.

P.S. Another unrelated problem to above:
I have MariaDB installed, after server reboot all apps lose connection to it and I need to go the app deployment tab in dashboard and redeploy it using docker image to it start running again. Any suggestions?

@amirsaam
Copy link
Author

Any help?

@githubsaturn
Copy link
Collaborator

Hi @amirsaam - this is unrelated to CapRover. You should post this on Stackoverflow or other relevant forums.

But it looks like this answer is what you want: https://stackoverflow.com/questions/64043106/how-to-install-php-extensionson-sourceguardian-on-wordpress-docker-image

So just simply go to the deployment tab and find Method 4: Deploy plain Dockerfile and copy paste this conent:

FROM wordpress:php7.2-apache

# Install and enable Source Gaurdian loader
RUN PHP_VERSION=$(php -v | head -n1 | cut -d' ' -f2 | cut -d. -f1-2) \
    && mkdir -p /tmp/sourceguardian \
    && cd /tmp/sourceguardian \
    && curl -Os https://www.sourceguardian.com/loaders/download/loaders.linux-x86_64.tar.gz \
    && tar xzf loaders.linux-x86_64.tar.gz \
    && cp ixed.${PHP_VERSION}.lin "$(php -i | grep '^extension_dir =' | cut -d' ' -f3)/sourceguardian.so" \
    && echo "extension=sourceguardian.so" > /usr/local/etc/php/conf.d/15-sourceguardian.ini \
    && rm -rf /tmp/sourceguardian

@amirsaam
Copy link
Author

@githubsaturn
Hello there,
Thanks for answering and I appreciate your intention, but honestly this is a CapRover issue not Docker.
I searched a lot for how to it on plain Docker but in anyway I got some issue on CapRover about the solutions like even this one you suggested returns this after deployment:

PHP Warning: PHP Startup: Unable to load dynamic library 'ixed.8.2.lin' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20170718/ixed.8.2.lin (/usr/local/lib/php/extensions/no-debug-non-zts-20170718/ixed.8.2.lin: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20170718/ixed.8.2.lin.so (/usr/local/lib/php/extensions/no-debug-non-zts-20170718/ixed.8.2.lin.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

While I added that directory as persistent and redeployed what you suggested then saved and restarted the app and still got the same error with the same directory (I checked if the path changes but didn't)

Does like Wordpress has its own PHP or it's another hidden Docker container in CapRover and we should change that or what?

@amirsaam
Copy link
Author

Also what about MariaDB issue?

@maietta
Copy link

maietta commented May 22, 2024

@amirsaam This is certainly NOT a CapRover related issue.

CapRover is a thin wrapper around Docker API. It is not responsible for the behavior of Docker or your application.

@amirsaam
Copy link
Author

Uh, I am not trying to be rude, just any solution for plain Docker image is not working on CapRover.
Also I shared the Log for the error that I got even after I added the directory to persistent paths.

@githubsaturn
Copy link
Collaborator

@amirsaam - I understand the frustration, but @maietta is correct.

If you can run your application using Docker, for example, docker run p 8080:80 my-custom-wordpress:version, then you can exact do the same thing using CapRover, just deploy the same image.

So first, I suggest you figure out a working image with Docker (without CapRover) and then you can just simply run this on CapRover.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants