这几天在安装一个新的wordpress网站模板Rara Company。但该模板要求需要满足下列条件
Maximum Execution Time 360
Memory Limit 256M
Post Max Size 32M
Upload Max Filesize 32M
默认的php.ini设置的是Upload Max Filesize:2M, Maximum Execution Time:60 s …肯定是满足不了条件的。
由于wordpress 镜像的php.ini 不方便直接映射出来进行修改,可以用下列的方法来修改这些参数。
文件命名为upload.ini(随意),内容如下,这里面的设置可以覆盖php.ini里面对应的设置,这样就可以修改这些参数了。同理,修改其他php参数,统统写在这个配置文件即可。
file_uploads = On memory_limit = 256M upload_max_filesize = 32M post_max_size = 32M max_execution_time = 360
由于我是用docker-compose启动wordpress网站的,需要在docker-compose.yml增加这个配置文件的映射。
volumes: - ./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
完成后的yml文件整体内容如下:
version: '3' services: db: image: mysql:5.7 volumes: - ./db:/var/lib/mysql ports: - "3306:3306" restart: always environment: MYSQL_ROOT_PASSWORD: yourrootpwd MYSQL_DATABASE: wordpress MYSQL_USER: wordpress MYSQL_PASSWORD: wordpresspwd web: depends_on: - db image: wordpress:latest volumes: - ./www:/var/www/html - ./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini ports: - "80:80" - "443:443" restart: always environment: WORDPRESS_DB_HOST: db:3306 WORDPRESS_DB_USER: wordpress WORDPRESS_DB_PASSWORD: wordpresspwd
docker-compose stop
以后台的方式启动wordpress docker容器
docker-compose up -d
如果是不是用docker-compose方式启动的容器,可以参考下面的命令,加入upload.ini配置。
docker run --name some-wordpress --link=some-mysql:mysql -e WORDPRESS_DB_NAME=some_wordpress -v /var/docker/uploads.ini:/usr/local/etc/php/conf.d/uploads.ini -v /var/docker/phpinfo.php:/var/www/html/phpinfo.php -p 8081:80 -d wordpress
原文链接:https://blog.csdn.net/sitebus/article/details/97648177?ops_request_misc=&request_id=f9be889009634066a9778e49e56ea8bd&biz_id=&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~koosearch~default-20-97648177-null-null.268%5Ev1%5Econtrol&utm_term=docker%E3%80%81wordpress%E3%80%81wordpress%E5%BB%BA%E7%AB%99%E3%80%81wordpress%E4%B8%BB%E9%A2%98%E3%80%81%E5%AE%B9%E5%99%A8%E9%95%9C%E5%83%8F%E3%80%81