Comments
Tiffel
pushed a commit
to Tiffel/eqdkp
that referenced
this issue
Jul 15, 2019
StefanPrintezis
changed the title
7.3.7 installing gd results in freetype-config not found
Installing gd on buster results in freetype-config not found
Jul 15, 2019
eerotal
pushed a commit
to eerotal/LibreSignage
that referenced
this issue
Jul 16, 2019
- This is a workaround for docker-library/php#865 which broke all LibreSignage Docker builds. The workaround will be used for the time being.
DuckThom
added a commit
to DuckThom/docker-images
that referenced
this issue
Jul 18, 2019
dargmuesli
added a commit
to dargmuesli/randomwinpicker
that referenced
this issue
Jul 19, 2019
dargmuesli
added a commit
to dargmuesli/jonas-thelemann
that referenced
this issue
Jul 19, 2019
tianon
added a commit
to docker-library/drupal
that referenced
this issue
Jul 19, 2019
The plan is to switch to buster once docker-library/php#865 is resolved in a clean way (either in the PHP image or in PHP itself).
tianon
added a commit
to infosiftr/php
that referenced
this issue
Jul 19, 2019
Toilal
added a commit
to inetum-orleans/generator-docker-devbox
that referenced
this issue
Jul 22, 2019
sinkcup
added a commit
to wifidog/wifidog-auth-laravel
that referenced
this issue
Aug 2, 2019
mnvx
mentioned this issue
Aug 4, 2019
ReactDevs007
added a commit
to ReactDevs007/dockerlib
that referenced
this issue
Feb 3, 2021
This was referenced
Jun 6, 2021
ene519
added a commit
to ene519/docker-library-php
that referenced
this issue
Jan 12, 2023
Are you looking at creating a website that displays custom fonts?
Then, your webserver needs PHP Freetype support.
However, enabling Freetype libraries on the server involves a series of steps.
At Bobcares, we receive requests to enable PHP FreeType support on the server as a part of our Server Management Services.
Today, let’s see how our Support Engineers install the FreeType support and fix related errors.
Why PHP FreeType Support?
Basically, FreeType software is a low-level font engine that supports font-related operations. It is efficient, customizable and helps in producing high-quality output. It finds wide usage in graphics libraries, font conversion tools, text image generation tools, and many other products as well.
By default, FreeType 2 support fonts like TrueType fonts, Type 1 fonts, CFF fonts, etc. Also due to its modular design, it is easy to enhance the library through optional APIs.
And, to enable support for FreeType 2 in PHP, we add –with-freetype-dir=DIR. For PHP 7.4.0 we use –with-freetype instead.
Installation of PHP FreeType Support
Now, let’s see how our Support Engineers install FreeType support in PHP. This requires the PHP version to have GD support.
Initially, we use the below command to install FreeType on a CentOS server.
yum install freetype
Or in an Ubuntu machine, as a root user, we execute the commands:
apt update && apt install freetype2-demos
This installs the necessary packages. After installing it, we restart the Apache server using the below command:
systemctl httpd restart
Also, we restart the php-fpm by executing
systemctl php-fpm restart
This enables the FreeType support in the PHP configuration. We confirm it from the loaded PHP configuration.
A sample output appears as:
[root@xxx ~]# php -i | grep -i freetype | grep -v configure
FreeType Support => enabled
FreeType Linkage => with freetype
FreeType Version => 2.8.0
Additionally, we also check and confirm Freetype support by adding a PHPinfo page on any of the websites.
Common error and fix for PHP FreeType Support
Normally, customers miss installing FreeType while installing the GD library. Then, they end up with errors related to missing the FreeType library.
Freetype software is essential for the GD library to work. Recently, one of our customers approached us with an error message:
Freetype-config not found error when we install gd in php7.2-apache in Docker
Here, the customer was trying to install the image php:7.2-apache from a Dockerfile. But, he ended up having a problem with the GD configuration.
Let’s see how our Support Engineers went troubleshooting this error and fix it.
He got the below error during the construction of the image:
configure: error: freetype-config not found.
We ran the below command that instructs to configure GD with freetype support.
RUN docker-php-ext-configure gd --with-freetype-dir --with-jpeg-dir=/usr/include/
Finally, this fixed the error.
[Need further assistance with PHP FreeType installation or fix its errors? We’ll help you]
Conclusion
In short, the PHP FreeType Support helps in using all font formats on websites. Also, it enables websites to provide higher-level features like text layout or graphics processing. Today, we discussed how our Support Engineers installed the FreeType Support and fixed its error.
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
GET STARTED
var google_conversion_label = «owonCMyG5nEQ0aD71QM»;
Compiling php-7.3.21 from source
checking for the location of libwebp… no
checking for the location of libjpeg… yes
checking for the location of libpng… yes
checking for the location of libXpm… no
checking for FreeType 2… yes
checking whether to enable JIS-mapped Japanese font support in GD… no
If configure fails try —with-webp-dir=<DIR>
checking for jpeg_read_header in -ljpeg… yes
checking for png_write_image in -lpng… yes
If configure fails try —with-xpm-dir=<DIR>
configure: error: freetype-config not found.
make: *** No targets specified and no makefile found. Stop.
make: *** No rule to make target ‘install’. Stop.
ln: failed to create symbolic link ‘/usr/local/php-7.3.21/sbin/php-7.3.21-fpm’: No such file or directory
Solution
Install PHP 7.4.X instead (such as 7.4.12 at the time of writing), which uses pkg-config instead and goes around that error.
But then you might run into
configure: error: re2c 0.13.4 is required to generate PHP lexers.
Which can be fixed with
apt-get install re2c
Then you might run into
checking for sqlite3 > 3.7.4… no
configure: error: Package requirements (sqlite3 > 3.7.4) were not met:
No package ‘sqlite3’ found
apt-get install libsqlite3-dev sqlite3
Then you might run into
checking for oniguruma… no
configure: error: Package requirements (oniguruma) were not met:
No package ‘oniguruma’ found
apt-get install libonig-dev
Finally success !!
Generating files configure: patching main/php_config.h.in configure: creating ./config.status creating main/internal_functions.c creating main/internal_functions_cli.c config.status: creating main/build-defs.h config.status: creating scripts/phpize config.status: creating scripts/man1/phpize.1 config.status: creating scripts/php-config config.status: creating scripts/man1/php-config.1 config.status: creating sapi/cli/php.1 config.status: creating sapi/fpm/php-fpm.conf config.status: creating sapi/fpm/www.conf config.status: creating sapi/fpm/init.d.php-fpm config.status: creating sapi/fpm/php-fpm.service config.status: creating sapi/fpm/php-fpm.8 config.status: creating sapi/fpm/status.html config.status: creating sapi/phpdbg/phpdbg.1 config.status: creating sapi/cgi/php-cgi.1 config.status: creating ext/phar/phar.1 config.status: creating ext/phar/phar.phar.1 config.status: creating main/php_config.h config.status: executing default commands
+--------------------------------------------------------------------+ | License: | | This software is subject to the PHP License, available in this | | distribution in the file LICENSE. By continuing this installation | | process, you are bound by the terms of this license agreement. | | If you do not agree with the terms of this license, you must abort | | the installation process at this point. | +--------------------------------------------------------------------+
Thank you for using PHP.
(...)
Post Views: 16,598
PHP compilation errors.
Compiling PHP is not an easy process by comparing with the installation of PHP using package managers like Yum or Apt-get.
The main advantage of compiling PHP from its source code is the customisation. That means you can customise your own PHP with custom modules.
There’re a lot of dependencies required for the compilation of PHP from its source code. By using package manager the dependencies are automatically detected and install with the corresponding package.
Here I am listing some common PHP compilation error and fix. This will helpful for compiling PHP on your server.
Php compilation on server means the building and installation of PHP from its source.
There’re chances to get a lot of error while compiling the PHP. See some common PHP compilation errors and their fixes.
ERROR I :
checking for BZip2 support… yes
checking for BZip2 in default path… not found
configure: error: Please reinstall the BZip2 distribution
Solution:
yum install bzip2-devel
ERROR II :
checking for cURL support… yes
checking if we should use cURL for url streams… no
checking for cURL in default path… not found
configure: error: Please reinstall the libcurl distribution -
easy.h should be in /include/curl/
Solution:
yum install curl-devel
ERROR III :
checking for fabsf… yes
checking for floorf… yes
configure: error: jpeglib.h not found.
checking for fabsf… yes
checking for floorf… yes
checking for jpeg_read_header in -ljpeg… yes
configure: error: png.h not found.
Solution:
yum install libpng-devel
ERROR IV :
checking for curl_multi_strerror in -lcurl… yes
checking for QDBM support… no
checking for GDBM support… no
checking for NDBM support… no
configure: error: DBA: Could not find necessary header file(s).
Solution:
yum install db4-devel
ERROR V :
checking for png_write_image in -lpng… yes
If configure fails try –with-xpm-dir=
configure: error: freetype.h not found.
Solution:
Fix: Reconfigure your PHP with the following option.
–with-xpm-dir=/usr
ERROR VI :
checking for png_write_image in -lpng… yes
configure: error: libXpm.(a|so) not found.
Solution:
yum install libXpm-devel
ERROR VII :
checking for bind_textdomain_codeset in -lc… yes
checking for GNU MP support… yes
configure: error: Unable to locate gmp.h
Solution:
yum install gmp-devel
ERROR VIII :
checking for utf8_mime2text signature… new
checking for U8T_DECOMPOSE…
configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing.
This should not happen. Check config.log for additional information.
Solution:
yum install libc-client-devel
ERROR IX :
checking for LDAP support… yes, shared
checking for LDAP Cyrus SASL support… yes
configure: error: Cannot find ldap.h
Solution:
yum install openldap-devel
ERROR X :
checking for mysql_set_character_set in -lmysqlclient… yes
checking for mysql_stmt_next_result in -lmysqlclient… no
checking for Oracle Database OCI8 support… no
checking for unixODBC support… configure: error: ODBC header file ‘/usr/include/sqlext.h’ not found!
Solution:
yum install unixODBC-devel
ERROR XI :
checking for PostgreSQL support for PDO… yes, shared
checking for pg_config… not found
configure: error: Cannot find libpq-fe.h.
Please specify correct PostgreSQL installation path
Solution:
yum install postgresql-devel
ERROR XII :
checking for sqlite 3 support for PDO… yes, shared
checking for PDO includes… (cached) /usr/local/src/php-5.3.7/ext
checking for sqlite3 files in default path… not found
configure: error: Please reinstall the sqlite3 distribution
Solution:
yum install sqlite-devel
ERROR XIII:
checking for utsname.domainname… yes
checking for PSPELL support… yes
configure: error: Cannot find pspell
Solution:
yum install aspell-devel
ERROR XIV :
checking whether to enable UCD SNMP hack… yes
checking for default_store.h… no
checking for kstat_read in -lkstat… no
checking for snmp_parse_oid in -lsnmp… no
checking for init_snmp in -lsnmp… no
configure: error: SNMP sanity check failed.
Please check config.log for more information.
Solution:
yum install net-snmp-devel
ERROR XV :
checking whether to enable XMLWriter support… yes, shared
checking for xml2-config path… (cached) /usr/bin/xml2-config
checking whether libxml build works… (cached) yes
checking for XSL support… yes, shared
configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution
Solution:
yum install libxslt-devel
ERROR XVI :
configure: error: xml2-config not found. Please check your libxml2 installation.
Solution:
yum install libxml2-devel
ERROR XVII :
checking for PCRE headers location… configure: error:
Could not find pcre.h in /usr
Solution:
yum install pcre-devel
ERROR XVIII :
libtool: link: cannot find the library `/usr/lib/libidn.la’ or unhandled argument `/usr/lib/libidn.la’
make: *** [sapi/cgi/php-cgi] Error 1
Solution:
cd /usr/src/
wget http://ftp.gnu.org/gnu/libidn/libidn-1.26.tar.gz
tar -zvxf libidn-1.26.tar.gz
cd libidn-1.26
./configure
make
make install
ln -s /usr/local/lib/libidn.la /usr/lib/libidn.la
ERROR XIX :
libtool: link: `/usr/lib/libxml2.la’ is not a valid libtool archive
make: *** [ext/xsl/xsl.la] Error 1
Solution:
cd /usr/src/
wget ftp://xmlsoft.org/libxml2/libxml2-2.7.3.tar.gz
tar -zvxf libxml2-2.7.3.tar.gz
cd libxml2-2.7.3
./configure –prefix=/usr
make
make install
ERROR XX :
configure: error: Your t1lib distribution is not installed correctly.
Please reinstall it.
Solution:
yum install t1lib-devel.x86_64
ERROR XXI:
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
Solution:
yum install libmcrypt-devel.x86_64
ERROR XXII :
configure: error: Cannot find libtidy
Solution:
yum install libtidy libtidy-devel
That’s it 🙂
How to enable allow_url_fopen, allow_url_include on a shared server using custom php.ini
You can simply enable/disable the php functions allow_url_include and allow_url_fopen by editing the php configuration file.
These functions may disabled in the php configuration file of some shared hosting server. You can simply manage these function by creating a custom php.ini file under your public folder. READ MORE..
Common php compile errors and the corresponding missing lib
Some of the package only available if you have set up epel for additional yum repo.
configure: error: Please reinstall the sqlite distribution from http://www.sqlite.org
$ yum install sqlite-devel.x86_64
configure: error: freetype-config not found.
$ yum install freetype-devel.x86_64 freetype.x86_64
configure: error: libXpm.(a|so) not found.
$ yum install libXpm-devel.x86_64 libXpm.x86_64
configure: error: jpeglib.h not found.
$ yum install libjpeg-devel.x86_64
or for centOS 6.x
$ yum install libjpeg-turbo.x86_64 libjpeg-turbo-devel.x86_64
configure: error: png.h not found.
$ yum install libpng-devel.x86_64
configure: error: Unable to locate gmp.h
$ yum install gmp-devel.x86_64
configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.
$ yum install libc-client-devel.x86_64
configure: WARNING: continuing without libevent support
$ yum install libevent-devel.x86_64
configure: error: Cannot find imap library (libc-client.a). Please check your c-client installation.
# you may find that you have the lic-client-devel.x86_64 installed but configure still complains, and it seems, we need
# the i686 version. or we can use –with-libdir=lib64 without install the i686 package
$ yum install libc-client-devel.i686
configure: error: Kerberos libraries not found.
# you find you have the 64bits version installed, but configure still complains
# install the i686 version too or we can use –with-libdir=lib64 without install the i686 package
$ yum install krb5-devel.i686
configure: error: Unable to detect ICU prefix or no failed. Please verify ICU install prefix and make sure icu-config works.
$ yum install libicu-devel.x86_64
configure: error: installation or configuration problem: C++ compiler cannot create executables.
$ yum install gcc-c++.x86_64
configure: error: Cannot find ldap.h
$ yum install openldap-devel.x86_64
configure: error: Cannot find ldap libraries in /usr/lib.
# on our 64 bits system, it needs something still in /usr/lib
# or we can use –with-libdir=lib64 without install the i686 package
$ yum install openldap-devel.i686
configure: error: mcrypt.h not found. Please reinstall libmcrypt.
$ yum install libmcrypt-devel.x86_64
mysql_config not found
# find out where mysql_config is and add –with-mysqli=/usr/bin/mysql_config
configure: error: Cannot find pspell
$ yum install aspell-devel.x86_64
configure: error: Cannot find libtidy
$ yum install libtidy-devel.x86_64
configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution
$ yum install libxslt-devel.x86_64
configure: error: Please reinstall the BZip2 distribution
$ yum install bzip2-devel.x86_64
configure: error: Cannot find libsphinxclient headers
configure: error: xml2-config not found. Please check your libxml2 installation.
$ yum install libxml2-devel.x86_64
configure: error: Cannot find OpenSSL’s
$ yum install openssl-devel.x86_64
checking for PCRE headers location… configure: error: Could not find pcre.h in /usr
$ yum install pcre-devel.x86_64
configure: error: Please reinstall the libcurl distribution –
easy.h should be in /include/curl/
$ yum install libcurl-devel.x86_64
configure: error: Unable to detect ICU prefix or shared,/usr/bin/icu-config failed. Please verify ICU install prefix and make sure icu-config works.
$ yum install icu.x86_64 libicu-devel.x86_64
configure: error: C++ preprocessor “/lib/cpp” fails sanity check
$ yum install gcc-c++.x86_64
checking for libmemcached location… configure: error: memcached support requires libmemcached. Use –with-libmemcached-dir=xxx to specify the prefix where libmemcached headers and library are located
$ yum install libmemcached.x86_64
and add “–with-libmemcached-dir=/usr” to configure cmd
checking for libmemcached location… configure: error: Unable to find memcached.h under /usr
$ yum install libmemcached-devel.x86_64
configure: error: no, libmemcached sasl support is not enabled. Run configure with –disable-memcached-sasl to disable this check
fix: let us go without SASL support by adding “–disable-memcached-sasl”
later we could build a memcached with SASL enabled and revisit this issue
configure: error: Cannot find enchant
$ yum install enchant.x86_64 enchant-devel.x86_64 enchant-aspell.x86_64
configure: error: Cannot find MySQL header files under /usr.
Note that the MySQL client library is not bundled anymore!
fix:
$ yum install mysql-libs.x86_64 mysql-devel.x86_64
configure: error: mysql configure failed. Please check config.log for more information.
conftest.c:36: undefined reference to `pthread_mutexattr_init’
conftest.c:37: undefined reference to `pthread_create’
fix:
This issue is similar the issue above. however in our case, we are using mysql.com latest mysql 5.6.22 RPM and there are something broken in
our env. and our fix is to build php 5.4.36 with the yum mysql client lib and dev lib.
configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path
$ yum install postgresql-libs.x86_64 postgresql-devel.x86_64
checking for sqlite3 files in default path… not found
configure: error: Please reinstall the sqlite3 distribution
$ yum install sqlite-devel.x86_64
configure: error: Could not find net-snmp-config binary. Please check your net-snmp installation.
$ yum install net-snmp-devel.x86_64 net-snmp-libs.x86_64
configure: error: Please install pecl/raphf and activate extension=raphf.so in your php.ini
$ yum install php-pecl-raphf-devel.x86_64 php-pecl-propro-devel.x86_64
still can not compile. we may have to leave pecl_http for later using pecl?
configure: WARNING: unrecognized options: –enable-magic-quotes, –with-sqlite
fix: these are no longer valid for php 5.4+, just remove these options.
ext/pecl_http/config.m4:5: warning: file `config9.m4′ included several times
fix: rename it to “http” which is the official ext name, though the downloaded ext file name is pecl_http