I cannot get ImageMagick to work in TYPO3 6.2.3
If I make a test file with this code:
<?
print "<pre>";
phpinfo();
print "</pre>";
system('/usr/local/bin/safe/convert --help');
?>
I get the PHP output and that doesn't tell anything about ImageMagick. But below that I get the help section from ImageMagick so ImageMagick is installed.
If I put /usr/local/bin/safe/ in the Image handling settings in TYPO3 backend the Test scaling images fail.
What did I miss?
You'll need to install the Imagick PECL extension to be able to use Imagemagick with the PHP language.
sudo pecl install imagick
# Or manually
curl -O http://pecl.php.net/get/imagick-3.2.0RC1.tgz
tar zxvf imagick-3.2.0RC1.tgz
cd imagick-3.2.0RC1
phpize
./configure && make
sudo make install
# Add 'extension=imagick.so' to php.ini
The imagemagick module should show up in your phpinfo(), or be listed when executing php -m
Edit
TYPO3 is expecting to use the convert commands directly. No need for PECL's shared extension.
Ensure the safe path is configured in your php.ini file (see safe_mode_include_dir & safe_mode_exec_dir )
Updated TYPO3's $TYPO3_CONF_VARS['GFX'] to map the convert program & location
$TYPO3_CONF_VARS['GFX']['im'] = 1;
$TYPO3_CONF_VARS['GFX']['im_path'] = '/usr/local/bin/safe/';
Example with GraphicsMagick is a good reference. But phpinfo will not display any information about the Imagemagick version/install using this method.
Related
I'm trying to write a bash script for automating the installation of anydesk by wget with the help of the following code:
echo -e "[ - ] Installing AnyDesk..."
wget --max-redirect 1 --trust-server-names 'https://anydesk.com/en/downloads/thank-you?dv=deb_64' -O anydesk.deb
sudo apt install ./anydesk.deb
echo -e "[ ✔ ] AnyDesk ➜ INSTALLED\n"
The problem is that https://anydesk.com/en/downloads/thank-you?dv=deb_64 returns a HTML page, not a Debian package.
How can I parse the HTML page to find the download link to the Debian package?
I examined page source of https://anydesk.com/en/downloads/thank-you?dv=deb_64 and download is triggered by JavaScript depending on User-Agent of browser, wget does not support JavaScript execution therefore you are actually getting HTML page source not actual .deb file. Use tool which support JavaScript execution to get actual file.
You can run the following command:
wget -O anydesk.deb https://download.anydesk.com/linux/anydesk_6.2.1-1_amd64.deb
this will allow you to download Anydesk, via wget.
I'm converting a .Net 2.1 lambda to 3.1 (or higher) and struggling with resolving the references that convert html to pdf. I'm currently using code from this solution https://github.com/HakanL/WkHtmlToPdf-DotNet, which works fine running a console app in the container. The lambda package is introducing issues that break this logic. Using a new lambda solution with this WkHtmlToPdf-DotNet project, the deployed image fails with this exception
GetModule WkHtmlModuleLinux64 Exception System.DllNotFoundException: Unable to load shared library '/var/task/runtimes/linux-x64/native/libwkhtmltox.so' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libjpeg.so.62: cannot open shared object file: No such file or directory
I am using the LD_DEBUG environment variable which shows before the exception: file=runtimes/linux-x86/native/libwkhtmltox [0]; dynamically loaded by /var/lang/bin/shared/Microsoft.NETCore.App/5.0.12/libcoreclr.so [0]
And I also output to the log a search for the file which yields this line:
GetFilePath res: /var/task/runtimes/linux-x64/native/libwkhtmltox.so
Any suggestions how to continue to troubleshoot this?
Thanks,
Reuven
I was able to resolve this issue by installing few of the packages that is required by DinkToPdf library in a docker container environment.
The issue however for installing those packages were not straight forward in Amazon Linux 2 instances. Below is the docker file I had to add for the DinkToPdf work properly.
FROM public.ecr.aws/lambda/dotnet:core3.1
WORKDIR /var/task
COPY "bin/Release/lambda-publish" .
RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN yum install -y libgdiplus \
ca-certificates \
fontconfig \
freetype \
libX11 \
libXext \
libXrender \
For this to run I also had to copy the three dependent library files after build libwkhtmltox.dll, libwkhtmltox.dylib libwkhtmltox.dll.so.
I have a Docker image that is used for running tests in Jenkins and Bamboo. I need to upgrade the version of g++ used (to something with C++11 support).
I tried using a Dockerfile that looks roughly like the following one:
FROM docker.blahblahblah/centos/6.6:latest
RUN yum install -y git gcc-c++ imake centos-release-scl-rh devtoolset-7-toolchain
# I've tried putting this into /etc/bashrc, ~/.bashrc, ~/.bash_profile
RUN echo "source scl_source enable devtoolset-7" >> ~/.bashrc
My issue is that when g++ is used within the container, it uses the older one, instead of the newer one in devtoolset-7, even though the newer one should be sourced from the bashrc. (Maybe I'm misunderstanding how Docker will try to run everything.)
Could anyone point me in the right direction here?
I need install imagick module on my php 7.2
I see
brew search php72
==> Searching local taps...
==> Searching taps on GitHub...
==> Searching blacklisted, migrated and deleted formulae...
No formula found for "php72".
Closed pull requests:
...
php72-imagick 3.4.3 (new formula) (https://github.com/Homebrew/homebrew-php/pull/4267)
How can I do it?
Also I need support for argon
It all changed back in April 2018 I think. Homebrew no longer acts as the package manager for PHP, so all the php-imagick and php-redis and php-other-extension stuff has gone and you are now supposed to manage PHP packages using pecl like everyone else does.
So, how to get Imagick under PHP? Note that Imagick and ImageMagick are two different things:
ImageMagick is the entire ImageMagick suite
Imagick is just the PHP binding
Here are the steps - if anyone knows better or any improvements, let me know via comment and I will update.
Step 1 - Delete anything likely to conflict
Before starting, it is best to clean up all the stuff that is broken or unneeded. Do as many of these as you are comfortable with:
brew rm php php#5.6 php#7.0 php#7.1
brew rm imagemagick
Step 2 - Update Xcode command line tools and get build packages
Make sure you have installed Xcode command-line tools with:
xcode-select --install
Go to AppStore and click on Updates and update any Xcode related packages - especially if you have recently upgraded macOS.
Install homebrew building tools:
brew install pkg-config
Step 3 - Install ImageMagick
Check what ImageMagick options you want with:
brew options imagemagick
I like to use:
brew install imagemagick --with-x11 --with-librsvg --with-openexr --with-pango
hash -r
but you may like vanilla install:
brew install imagemagick
hash -r
Step 4 - Install homebrew PHP
Next, install the homebrew version of PHP with:
brew install php
hash -r # Update bash's internal paths
Now, critically ensure you are running the correct homebrew PHP:
type php
If that tells you:
/usr/local/...anything.../php
you are running homebrew PHP and you can go to the next step.
If it tells you:
/usr/bin/php
you are running the Apple-supplied PHP. If that is what you want to run, ignore my entire answer which is predicated on you wanting to use homebrew PHP. If you get this answer but want to run homebrew PHP, your PATH is set incorrectly. You need to put /usr/local/bin before /usr/bin to pick up all homebrew packages ahead of Apple programs, i.e.
export PATH=/usr/local/bin:$PATH
This step gives you pecl - the PHP Package Manager - as well, since it is part of homebrew PHP.
Step 5 - Install Imagick
Now you can install Imagick with pecl:
pecl install imagick
If anything goes wrong, here are some related questions and answers...
Q1. How can I find where my php.ini file is?
Try any of these commands:
pecl config-get php_ini # I get "/usr/local/etc/php/7.2/php.ini"
brew info php
php -i | grep "Loaded Configuration" # I get "Loaded Configuration File => /usr/local/etc/php/7.2/php.ini"
Q2. How can I find where pecl installs modules?
pecl config-get ext_dir # I get "/usr/local/lib/php/pecl/20170718"
Q3. How can I tell what PHP modules are loaded?
php -m
Q4. Why can't PHP find my module?
First locate your modules directory using Q2. I like to put that in the clipboard with:
pecl config-get ext_dir | pbcopy
Then edit the php.ini file from Q1. I use vi, so I would do:
vi "$(pecl config-get php_ini)"
Then find the line in that file that looks like this:
; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
and, then (using the contents of your paste buffer) make the following line look like this (no semi-colon at the start):
extension_dir = "/usr/local/lib/php/pecl/XXXXXX"
on my machine XXXXXX is 20170718. If you get this right, any and all modules you install via pecl will be visible to your homebrew PHP.
Q5. How can I see all my PHP settings?
Check PHP configuration, versions and settings with:
php -i
In my case (PHP 7.2.10 with Homebrew) works:
pecl install imagick
Open the file php.ini and remove extension line with imagick extension.
Check *.ini files with
php --ini
You can see paths to extension files. Create or edit imagick ini file.
subl /usr/local/etc/php/7.2/conf.d/ext-imagick.ini
The content of file may be (check the path to imagick.so)
[imagick]
extension="/usr/local/opt/php/pecl/20170718/imagick.so"
And restart php with
brew services restart php
Try, if the error message dissapear:
php -v
And check imagick extension with:
php -i | grep imagick
If you see line with imagick module => enabled you have solved a problem.
You want php72-gmagick, GraphicsMagick is a fork from ImageMagick 5.5.2.
Or, you can pecl install imagick still.
I have a requirement that before an application runs, some part of it needs to read the environmental variable. For this I have the following docker file
FROM nodesource/jessie:0.12.7
# install gettext for envsubst
RUN apt-get update
RUN apt-get install -y gettext-base
# cache package.json and node_modules to speed up builds
ADD package.json package.json
RUN npm install
# Add source files
ADD src src
# Substiture value for backend endpoint env var
RUN envsubst < src/js/envapp.js > src/js/app.js
ADD node_modules node_modules
EXPOSE 8000
CMD ["npm","start"]
The above envsubst line reads (should read) an env variable $MYENV and substitutes it. But when I open the file app.js, its empty.
I checked if the environmental variable exists in the container and it does. Any reason its value is not read and substituted?
I also tried the same command in teh container and it works. It only does not work when I run the image
This is likely because $MYENV is not available for envsubst when you run the image.
Each RUN command runs on its own shell.
From the Docker documentations:
RUN (the command is run in a shell - /bin/sh -c - shell form)
You need to source your profile as well, for example if the $MYENV environment variable is available in the .bashrc file, you can modify your Dockerfile like this:
RUN source ~/.bashrc && envsubst < src/js/envapp.js > src/js/app.js
I encountered the same issues, and after much research and fishing through the internet. I managed to find a few work arounds to this issue. Below I'll list them and identifiable risks at the time of this "Answer post"
Solutions:
1.) apt-get install -y gettext its a standard GNU package language library, one of these libraries that it includes is envsubst` and I can confirm that it works for docker UBUNTU:latest and it should work for every flavored version.
2.) npm install envsub dependent on the "use case" - this approach would be better supported by node based projects.
3.) enstub cli project lib in my opinion it seems a bit overkill to downloading a custom cli from a random stranger but, it's also another option.
Risk:
apt-get install -y gettext:
1.) gettext - this approach would NOT be ideal for VM's as with any package library, it requires maintenance and updates as time passes. However, this isn't necessary for docker because once an a container is initialized and up and running we can create a bashscript to add the package, substitute env vars and then remove the package.
2.) It's a bad idea for VM's because it can be used to execute arbitrary code
npm install ensub
1.) envsub - updating packages and this approach wouldn't be ideal if your dealing with a different stack and not using nodejs.
NOTE:
There's also a PHP version for those developing a PHP application and it seems to work PHP's cli if you need a custom environment.
Resources:
GetText package library info: https://www.gnu.org/software/gettext/
GetText Risk - https://ubuntu.com/security/notices/USN-3815-2
PHP-GetText - apt-get install -y php-gettext
Custom ensubst cli: https://github.com/a8m/envsubst
I suggest that since your are using Node, you use the npm envsub module.
This module is well tested and is developed with docker in mind.
It avoids the need for relying on other dependencies when you already have the full Node arsenal at your fingertips.
envsub is described as
envsub is envsubst for NodeJS
NodeJS global CLI module providing file-level environment variable substitution via Handlebars
I am the author of the package. I think you will enjoy it.
I had some issues with envsubst in Docker.
For some reasons envsubst doesn't work when I try to copy the output in the same file. For example, this is not working:
RUN envsubst < file.conf > file.conf
But when I when I tried to use a temp file the issue disappeared:
RUN envsubst < file.conf > file.conf.temp && cp -f file.conf.temp file.conf