FROM php:5-apache

RUN apt-get update &&\
    apt-get install -y locales &&\
    locale-gen en_US.UTF-8
ENV LANG='en_US.UTF-8'
ENV LC_ALL='en_US.UTF-8'
ENV LANGUAGE='en_US.UTF-8'

# configure PHP environment and apache modules
RUN docker-php-ext-install mysqli pdo pdo_mysql
RUN cp /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load

# Add ssmtp mailer
RUN apt-get install -y ssmtp
ADD ssmtp.conf /etc/ssmtp/ssmtp.conf
RUN echo 'sendmail_path = /usr/sbin/sendmail -t -i' >> /usr/local/etc/php/php.ini

# mail() calls in PHP should end up in mhsendmail, which sends the mails to the mailhog container
#RUN apt-get install --no-install-recommends --assume-yes --quiet ca-certificates curl git &&\
#    rm -rf /var/lib/apt/lists/*
#RUN curl -Lsf 'https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz' | tar -C '/usr/local' -xvzf -
#ENV PATH /usr/local/go/bin:$PATH
#RUN go get github.com/mailhog/mhsendmail
#RUN cp /root/go/bin/mhsendmail /usr/bin/mhsendmail
#RUN echo 'sendmail_path = /usr/bin/mhsendmail --smtp-addr mailhog:1025' >> /usr/local/etc/php/php.ini

# xdebug
# RUN pecl install xdebug-2.5.5 && docker-php-ext-enable xdebug
# RUN echo 'zend_extension = /usr/local/lib/php/extensions/no-debug-non-zts-20151012/xdebug.so' >> /usr/local/etc/php/php.ini
# RUN echo 'xdebug.remote_port=9000' >> /usr/local/etc/php/php.ini
# RUN echo 'xdebug.remote_enable=1' >> /usr/local/etc/php/php.ini
# RUN echo 'xdebug.remote_connect_back=1' >> /usr/local/etc/php/php.ini
