0

Using Symfony2.0 and Gregwar Captcha Bundle for Symfony 2.0 Operating System: Mac OS 10.10 (Yosemite)

After having installed the CaptchaBundle following the instructions, the first time I use it, I get the following error:

Fatal error: Call to undefined function Gregwar\CaptchaBundle\Generator\imagettfbbox() in /Users/pgbonino/Sites/preparatest/vendor/bundles/Gregwar/CaptchaBundle/Generator/CaptchaGenerator.php on line 176

My phpinfo informs this:

<h2><a name="module_gd">gd</a></h2>
<table border="0" cellpadding="3" width="600">
<tbody><tr><td class="e">GD Support </td><td class="v">enabled </td></tr>
<tr><td class="e">GD Version </td><td class="v">bundled (2.1.0 compatible) </td></tr>
<tr><td class="e">GIF Read Support </td><td class="v">enabled </td></tr>
<tr><td class="e">GIF Create Support </td><td class="v">enabled </td></tr>
<tr><td class="e">JPEG Support </td><td class="v">enabled </td></tr>
<tr><td class="e">libJPEG Version </td><td class="v">9 compatible </td></tr>
<tr><td class="e">WBMP Support </td><td class="v">enabled </td></tr>
<tr><td class="e">XBM Support </td><td class="v">enabled </td></tr>
</tbody></table>

So, apparently the GD module is correctly loaded.

Any idea on the error I am getting?

ElPiter
  • 4,046
  • 9
  • 51
  • 80

1 Answers1

2

Comparing your phpinfo() output to mine I find that although GD is active FreeType is missing in your PHP installation. The PHP docs on imagettfbbox() say that "This function requires both the GD library and the FreeType library."

Here is the corresponding section of my phpinfo():

gd

GD Support  enabled
GD Version  bundled (2.1.0 compatible)
FreeType Support    enabled
FreeType Linkage    with freetype
FreeType Version    2.5.3
GIF Read Support    enabled
GIF Create Support  enabled
JPEG Support    enabled
libJPEG Version 8
PNG Support enabled
libPNG Version  1.6.13
WBMP Support    enabled
XBM Support enabled

The Configure Command block at the beginning of phpinfo should list freetype too:

'./configure' '--prefix=/usr/local/Cellar/php55/5.5.18' '--localstatedir=/usr/local/var' '--sysconfdir=/usr/local/etc/php/5.5' '--with-config-file-path=/usr/local/etc/php/5.5' '--with-config-file-scan-dir=/usr/local/etc/php/5.5/conf.d' '--with-iconv-dir=/usr' '--enable-dba' '--with-ndbm=/usr' '--enable-exif' '--enable-intl' '--enable-soap' '--enable-wddx' '--enable-ftp' '--enable-sockets' '--enable-zip' '--enable-shmop' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-mbstring' '--enable-mbregex' '--enable-bcmath' '--enable-calendar' '--with-zlib=/usr/local/opt/zlib' '--with-ldap' '--with-ldap-sasl=/usr' '--with-xmlrpc' '--with-kerberos=/usr' '--with-gd' '--enable-gd-native-ttf' '--with-freetype-dir=/usr/local/opt/freetype' '--with-icu-dir=/usr/local/opt/icu4c' '--with-jpeg-dir=/usr/local/opt/jpeg' '--with-png-dir=/usr/local/opt/libpng' '--with-gettext=/usr/local/opt/gettext' '--with-libedit' '--with-unixODBC=/usr/local/opt/unixodbc' '--with-pdo-odbc=unixODBC,/usr/local/opt/unixodbc' '--mandir=/usr/local/Cellar/php55/5.5.18/share/man' '--with-mhash' '--with-curl' '--with-snmp=/usr' '--with-bz2=/usr' '--disable-debug' '--with-openssl=/usr' '--with-xsl=/usr' '--with-apxs2=/usr/sbin/apxs' '--libexecdir=/usr/local/Cellar/php55/5.5.18/libexec' '--with-mysql-sock=/tmp/mysql.sock' '--with-mysqli=mysqlnd' '--with-mysql=mysqlnd' '--with-pdo-mysql=mysqlnd' '--enable-pcntl' '--enable-zend-signals' '--enable-dtrace' '--enable-opcache'

POSSIBLE SOLUTION

From your comment on my instructions to install a full PHP on OSX Yosemite I know that you have installed PHP using the Homebrew package manager. So you might want to try this to solve your problem:

brew install freetype
Community
  • 1
  • 1
Jpsy
  • 20,077
  • 7
  • 118
  • 115
  • Thank you for your answer. And sorry about my ignorance on all this. I think then that we almost get it. When I go "brew install freetype", I get this: "Warning: freetype-2.5.5 already installed, it's just not linked". I guess that means exactly that I don't have the "--with-freetype" section in the "Configure Command" block. Now the question: how do I get that modifier into that block? Thanks again. – ElPiter Apr 02 '15 at 07:58
  • Hey... I saw something else: at the end of your post, you say that the new php.ini file should be located at /usr/local/etc/php/5.5/php.ini. However, after having restarted apache, in my phpinfo.php file what I get is the same php.ini indication: "Loaded Configuration File /etc/php.ini". Two things on this: 1. Should I copy the "/usr/local/etc/php/5.5/php.ini" version to the /etc directory? 2. Uhm, I don't think so, as I don't see anything about freetype either in that "/usr/local/etc/php/5.5/php.ini" version. I hope you can understand what I try to explain. Some more little help will be great – ElPiter Apr 02 '15 at 08:16
  • I saw now that the "brew install php55" executed with some errors like "Error: The `brew link` step did not complete successfully. The formula built, but is not symlinked into /usr/local Could not symlink . /usr/local/Library/LinkedKegs is not writable.". Now I gave write permissions to that LinkedKegs directory. And I got to brew link the libraries that had given those errors. HOWEVER I'm still not getting those modifiers in Configure block. And I don't see references to freetype in any php.ini file. And imagettfbbox() function still gives this Call undefined funcion. :( – ElPiter Apr 02 '15 at 08:31
  • As a new try, I installed now php5.6. but nothing changed. Coming to think of it, in your post you say about ONLY installing one of the two versions. But now, after all this tests, I installed both :(. Is that too bad? However... I have the feeling that the php executing in my server is exactly the same, as phpinfo.php hasn't changed a word :(. I leave it here till I read your new comments @Jpsy. Thanks – ElPiter Apr 02 '15 at 08:36
  • Forget it all! I made it work. I haven't completely followed your instructions, as I had left apart the fact of referencing the new php module in httpd.conf. Thanks a lot! – ElPiter Apr 02 '15 at 09:33
  • 1
    Hi @ElPiter, glad you finally made it. You are not the first who overlooked the final step of the installation instructions (see the other comments). Coming close to the stable the horses tend to gallop. :D – Jpsy Apr 02 '15 at 11:24
  • 1
    And as a final note: I guess it is absolutely no problem if you have PHP 5.5 and 5.6 installed in parallel. They reside in different directories and you can freely switch between both versions by changing the LoadModule line in Apache's httpd.conf. – Jpsy Apr 02 '15 at 11:26