wordpress-docker-compose icon indicating copy to clipboard operation
wordpress-docker-compose copied to clipboard

How to install a php extension?

Open flip111 opened this issue 4 years ago • 4 comments

I would like to use intl to use some locale functions in php

flip111 avatar Apr 09 '20 17:04 flip111

I was thinking about this for a while, to make it more accessible, but also not making the build more complicated when someone needs a specific version of WordPress. Would you like to take a look at #57?

nezhar avatar Apr 30 '20 21:04 nezhar

Ok i will take a look at the custom build

flip111 avatar May 02 '20 09:05 flip111

With patch of custom build i can enable a php extension. I didn't try to install one though (that is making the .so file available)

flip111 avatar May 31 '20 21:05 flip111

Steps to install xdebug with tracing.

  1. make sure the container is not running
  2. mkdir traces in the root of this project (not in the wordpress root).
  3. Add in docker-compose.yml under volumes of the wp container: - ./traces:/home/traces
  4. run the container, it will now be rebuilded because you changed the docker-compose.yml file, any changes you make after this will be lost when changing it again.
  5. docker ps, copy the container ID which uses image wordpress:latest
  6. docker exec -it container_id_here /bin/bash
  7. By default the official wordpress container does not load a configuration file for php. The setup of this project together with xdebug is for development, therefor lets use the default php-development.ini file as a base for a new php.ini file: cp /usr/local/etc/php/php.ini-development /usr/local/etc/php/php.ini
  8. cd ~
  9. php -i, copy the output text into https://xdebug.org/wizard
  10. follow instructions on the xdebug page, the tgz file can be downloaded like this curl -O -J http://xdebug.org/files/xdebug-2.9.6.tgz. You need to enter text into a file, you can use nano apt update && apt install nano
  11. Add for tracing the following line to the php.ini configuration and then restart the container:
xdebug.auto_trace = true
xdebug.collect_params = 4
xdebug.trace_format = 0
xdebug.collect_return = true
xdebug.collect_assignments = true
xdebug.trace_output_dir = /root/traces
xdebug.trace_output_name = trace.%u

NOTE: work in progress, traces don't always show up

flip111 avatar Jul 19 '20 14:07 flip111