mohatt / dashbrew

Vagrant build for developing PHP projects on different PHP versions and configurations
492 stars 38 forks source link

How do i enable GD #21

Open spoetnik opened 9 years ago

spoetnik commented 9 years ago

My environment.yaml:

php::builds:
  5.6.0:
    installed: true
    default: true
    variants:
      - dev
      - gd
    extensions:
      xdebug:
        enabled: true
        version: stable
      xhprof:
        enabled: true
        version: latest
    fpm:
      port: 9002
      autostart: true

My .dashbrew:

Zandmotor:
  title: Zandmotor
  php:
    build: default
  vhost:
    servername: zandmotor.dev
    serveraliases:
      - www.zandmotor.dev
    ssl: true
    extensions:
      gd:
        enabled: true
        version: default

Still, the Drupal install complaints about missing GD

DomagojGojak commented 9 years ago

I think that you might be doing it wrong. As far as I can tell you must add GD extension into the php build itself (extensions key in the environment.yaml file). By doing so provisioner will be able to build php version with the GD extension. Also, even if it's possible to add GD extension right into the .dashbrew file (which i doubt) it makes no sense to add it under the vhost configuration.

I also think that you must install the php5-gd library first via the os::packages directive.

EdBailey commented 9 years ago

I managed to get GD working with the following settings in the environment.yaml file:

5.6.0:
    default: true
    variants: dev+gd
    extensions:
      gd:
        enabled: true
        version: stable
    fpm:
      port: 9003
      autostart: true
nathan-van-der-werf commented 9 years ago

What am I doing wrong? Also tried dev+gd, doesn't work for me also.

==> default: [Debug] -------------------------------------------------------
==> default: [Debug] Finished running Dashbrew\Cli\Tasks\PackagesTask
==> default: [Debug] Running Dashbrew\Cli\Tasks\PhpTask
==> default: [Info] Checking php 5.6.0
==> default: [Info] Checking extensions
==> default: [Info] Installing gd extension
==> default: [Debug] -------------------------------------------------------
==> default: [Debug] Executing command: sudo -u vagrant bash /vagrant/provision/main/scripts/phpbrew/ext.install.sh 5.6.
0 gd stable
==> default: [Debug] -------------------------------------------------------
==> default: Invalid package version: gd @
==> default: [Debug] -------------------------------------------------------
==> default: [Error] Failed installing gd extension
php::builds:
  5.6.0:
    installed: true
    default: true
    variants:
      - dev
      - mcrypt
      - gd
    extensions:
      xdebug:
        enabled: true
        version: stable
      xhprof:
        enabled: true
        version: latest
      gd:
        enabled: true
        version: stable
    fpm:
      port: 9002
      autostart: true
jkenneydaniel commented 9 years ago

Please look at this issue over at phpbrew... I've had this same problem and it appears to be a problem with the Dashbrew environment. Applying the changes pointed out by phpid worked for me.

https://github.com/phpbrew/phpbrew/issues/480

Probably. I got all extensions fixed after deleting of the --purge option in:

phpbrew use ${BUILD}
#phpbrew ext clean --purge ${EXTNAME}
phpbrew ext clean ${EXTNAME}
#phpbrew --no-progress ext install ${EXTNAME} ${EXTVERSION}
phpbrew ext install ${EXTNAME} ${EXTVERSION}

These changes will occur in provision/main/scripts/phpbrew/ext.install.sh

nathan-van-der-werf commented 9 years ago

Above did not fix my problem, still same error https://github.com/phpbrew/phpbrew/issues/480#issuecomment-91298244

singleman68 commented 9 years ago

I fixed in the next way: $ vagrant ssh $ phpbrew --debug ext install gd exit $ vagrant provision

aliemre commented 9 years ago

@singleman68 It throws Invalid package version: gd @ error on Ubuntu 14.04 :/ @mdkholy Despite of installing manually gd extension, composer requirenments does not compansate gd extension. It still cannot find the gd extension. gregwar/captcha v1.1 requires ext-gd * -> the requested PHP extension gd is missing from your system.

gebeer commented 8 years ago

For me, jkenneydaniel's hint on removing the --purge option did the trick.

gd installed succesfully BUT without jpeg and freetype support. My app needs jpeg support for image manipulation, like most of modern apps. To get jpeg and freetype support, I followed advices from phpbrew here and here: First vagrant ssh into the box Then phpbrew ext show gd to get the source directory of your gd extension. For me it was "/opt/phpbrew/build/5.6.0/ext/gd" Go into the directory with cd /opt/phpbrew/build/5.6.0/ext/gd Type make clean (this is optional, I did it just to be sure things will work)

Then I looked up all the paths that we need for the phpbrew gd installer to find the required libraries Now with the paths on hand, I did

phpbrew ext install gd \
-- --with-libdir=/usr/lib/x86_64-linux-gnu \
--with-gd=shared \
--with-freetype-dir=/usr/lib/x86_64-linux-gnu \
--with-jpeg-dir=/usr/lib/x86_64-linux-gnu/ \
--with-png-dir=/lib/x86_64-linux-gnu/

After a little while I got the confirmation that gd extension is enabled. Then I did exit to leave the box and vagrant provision to re-provision and restart services.

It is quite tedious to do this manually. I don't know how I would implement the whole process into the dashbrew provision scripts. Maybe someone here can help out?