├── .editorconfig ├── Dockerfile-apache ├── Dockerfile-env ├── Dockerfile-nginx ├── Dockerfile-php-cli ├── Dockerfile-php-fpm ├── LICENSE ├── README-apache.md ├── README-cli.md ├── README-nginx.md ├── README.md ├── build ├── files ├── apache │ ├── apache │ ├── ports.conf │ └── vhost │ │ ├── drupal.conf │ │ ├── fpm.conf │ │ ├── html.conf │ │ ├── laravel.conf │ │ ├── symfony2.conf │ │ ├── symfony3.conf │ │ ├── symfony4.conf │ │ └── wordpress.conf ├── base_packages.sh ├── nginx │ ├── nginx │ ├── nginx.conf │ └── vhost │ │ ├── drupal6.conf │ │ ├── drupal7.conf │ │ ├── drupal8.conf │ │ ├── fpm.conf │ │ ├── html.conf │ │ ├── laravel.conf │ │ ├── symfony2-dev.conf │ │ ├── symfony2-prod.conf │ │ ├── symfony3-dev.conf │ │ ├── symfony3-prod.conf │ │ ├── symfony4.conf │ │ └── wordpress.conf └── php │ ├── bin_clean_directories.sh │ ├── bin_install_composer.sh │ ├── bin_install_modules.sh │ ├── bin_link_ini.sh │ ├── bin_rm_symlinked_ini.sh │ ├── fpm-xdebug │ ├── fpm.conf │ ├── php-fpm │ ├── php.ini │ └── xdebug ├── test └── testing ├── Dockerfile-runner └── index.php /.editorconfig: -------------------------------------------------------------------------------- 1 | [{build,*.sh}] 2 | indent_style = space 3 | indent_size = 4 4 | -------------------------------------------------------------------------------- /Dockerfile-apache: -------------------------------------------------------------------------------- 1 | ARG PHP_VER_DOT 2 | FROM jtreminio/php:$PHP_VER_DOT 3 | LABEL maintainer="Juan Treminio " 4 | 5 | RUN printf "deb [arch=amd64] http://ppa.launchpad.net/ondrej/apache2/ubuntu bionic main\n" \ 6 | >/etc/apt/sources.list.d/ondrej-apache2.list &&\ 7 | apt-get update &&\ 8 | apt-get install --no-install-recommends --no-install-suggests -y \ 9 | apache2 &&\ 10 | apt-get -y --purge autoremove &&\ 11 | rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/{man,doc} 12 | 13 | RUN a2enmod env headers proxy proxy_http proxy_fcgi rewrite 14 | 15 | # Set proper permissions for Apache 16 | RUN chown -R www-data:www-data \ 17 | /var/www &&\ 18 | rm -rf /var/www/html 19 | 20 | COPY files/apache/ports.conf /etc/apache2/ports.conf 21 | COPY files/apache/vhost/* /etc/apache2/sites-available/ 22 | RUN rm -f /etc/apache2/sites-enabled/000-default.conf 23 | 24 | # runit config 25 | RUN mkdir /etc/service/apache 26 | COPY files/apache/apache /etc/service/apache/run 27 | RUN chmod +x /etc/service/apache/run 28 | 29 | RUN mkdir /etc/service/fpm-xdebug 30 | COPY files/php/fpm-xdebug /etc/service/fpm-xdebug/run 31 | RUN chmod +x /etc/service/fpm-xdebug/run &&\ 32 | touch /var/log/fpm-xdebug-tail 33 | 34 | # Default Apache vhost to basic FPM config 35 | ENV VHOST=fpm 36 | 37 | # Replace 0.0.0.0:9000 38 | ENV FPM.listen="127.0.0.1:9000" 39 | 40 | EXPOSE 8080 41 | 42 | CMD ["/sbin/my_init"] 43 | -------------------------------------------------------------------------------- /Dockerfile-env: -------------------------------------------------------------------------------- 1 | FROM phusion/baseimage:18.04-1.0.0 2 | 3 | # Upgrade security packages only 4 | RUN apt-get update &&\ 5 | apt-get -s dist-upgrade |grep "^Inst" |grep -i securi || true &&\ 6 | apt-get autoclean &&\ 7 | apt-get -y --purge autoremove &&\ 8 | rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/{man,doc} 9 | 10 | ENV PHP.allow_url_fopen=1 \ 11 | PHP.allow_url_include= \ 12 | PHP.always_populate_raw_post_data= \ 13 | PHP.asp_tags= \ 14 | PHP.auto_append_file= \ 15 | PHP.auto_detect_line_endings=0 \ 16 | PHP.auto_globals_jit=1 \ 17 | PHP.auto_prepend_file= \ 18 | PHP.browscap= \ 19 | PHP.child_terminate= \ 20 | PHP.default_charset=UTF-8 \ 21 | PHP.default_mimetype=text/html \ 22 | PHP.default_socket_timeout=60 \ 23 | PHP.disable_classes= \ 24 | PHP.disable_functions= \ 25 | PHP.display_errors=Off \ 26 | PHP.display_startup_errors= \ 27 | PHP.docref_ext= \ 28 | PHP.docref_root= \ 29 | PHP.doc_root= \ 30 | PHP.error_append_string= \ 31 | PHP.error_log= \ 32 | PHP.error_prepend_string= \ 33 | PHP.error_reporting=0 \ 34 | PHP.exit_on_timeout= \ 35 | PHP.expose_php=1 \ 36 | PHP.file_uploads=1 \ 37 | PHP.html_errors=0 \ 38 | PHP.ignore_repeated_errors= \ 39 | PHP.ignore_repeated_source= \ 40 | PHP.ignore_user_abort=0 \ 41 | PHP.implicit_flush=1 \ 42 | PHP.include_path=.:/usr/share/php \ 43 | PHP.last_modified= \ 44 | PHP.log_errors=1 \ 45 | PHP.log_errors_max_len=1024 \ 46 | PHP.max_execution_time=0 \ 47 | PHP.max_input_nesting_level=64 \ 48 | PHP.max_input_vars=1000 \ 49 | PHP.max_input_time=-1 \ 50 | PHP.memory_limit=-1 \ 51 | PHP.open_basedir= \ 52 | PHP.output_buffering=0 \ 53 | PHP.output_handler= \ 54 | PHP.enable_post_data_reading=1 \ 55 | PHP.post_max_size=8M \ 56 | PHP.precision=14 \ 57 | PHP.realpath_cache_size=4096K \ 58 | PHP.realpath_cache_ttl=120 \ 59 | PHP.register_argc_argv=1 \ 60 | PHP.report_memleaks=1 \ 61 | PHP.report_zend_debug=0 \ 62 | PHP.request_order=GP \ 63 | PHP.sendmail_from= \ 64 | PHP.sendmail_path="/usr/sbin/sendmail -t -i" \ 65 | PHP.serialize_precision=-1 \ 66 | PHP.short_open_tag= \ 67 | PHP.SMTP=localhost \ 68 | PHP.smtp_port=25 \ 69 | PHP.track_errors=0 \ 70 | PHP.unserialize_callback_func= \ 71 | PHP.upload_max_filesize=2M \ 72 | PHP.max_file_uploads=20 \ 73 | PHP.upload_tmp_dir= \ 74 | PHP.user_agent= \ 75 | PHP.user_dir= \ 76 | PHP.variables_order=GPCS \ 77 | PHP.windows_show_crt_warning= \ 78 | PHP.xbithack= \ 79 | PHP.xmlrpc_errors=0 \ 80 | PHP.xmlrpc_error_number=0 \ 81 | \ 82 | PHP.apc.cache_by_default= \ 83 | PHP.apc.enabled= \ 84 | PHP.apc.enable_cli= \ 85 | PHP.apc.file_update_protection= \ 86 | PHP.apc.filters= \ 87 | PHP.apc.gc_ttl= \ 88 | PHP.apc.include_once_override= \ 89 | PHP.apc.localcache= \ 90 | PHP.apc.localcache.size= \ 91 | PHP.apc.max_file_size= \ 92 | PHP.apc.mmap_file_mask= \ 93 | PHP.apc.num_files_hint= \ 94 | PHP.apc.report_autofilter= \ 95 | PHP.apc.rfc1867= \ 96 | PHP.apc.rfc1867_freq=0 \ 97 | PHP.apc.rfc1867_name= \ 98 | PHP.apc.rfc1867_prefix= \ 99 | PHP.apc.shm_segments=1 \ 100 | PHP.apc.shm_size= \ 101 | PHP.apc.slam_defense= \ 102 | PHP.apc.stat= \ 103 | PHP.apc.stat_ctime= \ 104 | PHP.apc.ttl= \ 105 | PHP.apc.user_entries_hint= \ 106 | PHP.apc.user_ttl= \ 107 | PHP.apc.write_lock= \ 108 | \ 109 | PHP.apd.dumpdir= \ 110 | PHP.apd.statement_tracing= \ 111 | \ 112 | PHP.arg_separator.input=& \ 113 | PHP.arg_separator.output=& \ 114 | \ 115 | PHP.assert.active=1 \ 116 | PHP.assert.bail=0 \ 117 | PHP.assert.callback= \ 118 | PHP.assert.quiet_eval=0 \ 119 | PHP.assert.warning=1 \ 120 | \ 121 | PHP.axis2.client_home= \ 122 | PHP.axis2.enable_exception= \ 123 | PHP.axis2.enable_trace= \ 124 | PHP.axis2.log_path= \ 125 | \ 126 | PHP.bcmath.scale=0 \ 127 | \ 128 | PHP.bcompiler.enabled= \ 129 | \ 130 | PHP.birdstep.max_links= \ 131 | \ 132 | PHP.blenc.key_file= \ 133 | \ 134 | PHP.cgi.check_shebang_line= \ 135 | PHP.cgi.discard_path= \ 136 | PHP.cgi.fix_pathinfo= \ 137 | PHP.cgi.force_redirect= \ 138 | PHP.cgi.nph= \ 139 | PHP.cgi.redirect_status_env= \ 140 | PHP.cgi.rfc2616_headers= \ 141 | \ 142 | PHP.cli.pager= \ 143 | PHP.cli.prompt="\b \>" \ 144 | PHP.cli_server.color= \ 145 | \ 146 | PHP.coin_acceptor.auto_initialize= \ 147 | PHP.coin_acceptor.auto_reset= \ 148 | PHP.coin_acceptor.command_function= \ 149 | PHP.coin_acceptor.delay_coins= \ 150 | PHP.coin_acceptor.delay_prom= \ 151 | PHP.coin_acceptor.lock_on_close= \ 152 | PHP.coin_acceptor.start_unlocked= \ 153 | \ 154 | PHP.com.allow_dcom= \ 155 | PHP.com.autoregister_casesensitive= \ 156 | PHP.com.autoregister_typelib= \ 157 | PHP.com.autoregister_verbose= \ 158 | PHP.com.code_page= \ 159 | PHP.com.typelib_file= \ 160 | \ 161 | PHP.curl.cainfo= \ 162 | \ 163 | PHP.daffodildb.default_host= \ 164 | PHP.daffodildb.default_password= \ 165 | PHP.daffodildb.default_socket= \ 166 | PHP.daffodildb.default_user= \ 167 | PHP.daffodildb.port= \ 168 | \ 169 | PHP.date.default_latitude=31.7667 \ 170 | PHP.date.default_longitude=35.2333 \ 171 | PHP.date.sunrise_zenith=90.583333 \ 172 | PHP.date.sunset_zenith=90.583333 \ 173 | PHP.date.timezone=UTC \ 174 | \ 175 | PHP.dba.default_handler= \ 176 | \ 177 | PHP.etpan.default.charset= \ 178 | PHP.etpan.default.protocol= \ 179 | \ 180 | PHP.exif.decode_jis_intel=JIS \ 181 | PHP.exif.decode_jis_motorola=JIS \ 182 | PHP.exif.decode_unicode_intel=UCS-2LE \ 183 | PHP.exif.decode_unicode_motorola=UCS-2BE \ 184 | PHP.exif.encode_jis= \ 185 | PHP.exif.encode_unicode=ISO-8859-15 \ 186 | \ 187 | PHP.expect.logfile= \ 188 | PHP.expect.loguser= \ 189 | PHP.expect.timeout= \ 190 | \ 191 | PHP.fastcgi.impersonate= \ 192 | PHP.fastcgi.logging= \ 193 | \ 194 | PHP.fbsql.allow_persistent= \ 195 | PHP.fbsql.autocommit= \ 196 | PHP.fbsql.batchsize= \ 197 | PHP.fbsql.default_database= \ 198 | PHP.fbsql.default_database_password= \ 199 | PHP.fbsql.default_host= \ 200 | PHP.fbsql.default_password= \ 201 | PHP.fbsql.default_user= \ 202 | PHP.fbsql.generate_warnings= \ 203 | PHP.fbsql.max_connections= \ 204 | PHP.fbsql.max_links= \ 205 | PHP.fbsql.max_persistent= \ 206 | PHP.fbsql.max_results= \ 207 | PHP.fbsql.show_timestamp_decimals= \ 208 | \ 209 | PHP.filter.default=unsafe_raw \ 210 | PHP.filter.default_flags= \ 211 | \ 212 | PHP.gd.jpeg_ignore_warning= \ 213 | \ 214 | PHP.geoip.custom_directory= \ 215 | \ 216 | PHP.hidef.ini_path= \ 217 | \ 218 | PHP.highlight.comment="#FF8000" \ 219 | PHP.highlight.default="#0000BB" \ 220 | PHP.highlight.html="#000000" \ 221 | PHP.highlight.keyword="#007700" \ 222 | PHP.highlight.string="#DD0000" \ 223 | \ 224 | PHP.htscanner.config_file= \ 225 | PHP.htscanner.default_docroot= \ 226 | PHP.htscanner.default_ttl= \ 227 | PHP.htscanner.stop_on_error= \ 228 | \ 229 | PHP.http.etag.mode= \ 230 | PHP.http.force_exit= \ 231 | PHP.http.log.allowed_methods= \ 232 | PHP.http.log.cache= \ 233 | PHP.http.log.composite= \ 234 | PHP.http.log.not_found= \ 235 | PHP.http.log.redirect= \ 236 | PHP.http.only_exceptions= \ 237 | PHP.http.persistent.handles.ident= \ 238 | PHP.http.persistent.handles.limit= \ 239 | PHP.http.request.datashare.connect= \ 240 | PHP.http.request.datashare.cookie= \ 241 | PHP.http.request.datashare.dns= \ 242 | PHP.http.request.datashare.ssl= \ 243 | PHP.http.request.methods.allowed= \ 244 | PHP.http.request.methods.custom= \ 245 | PHP.http.send.deflate.start_auto= \ 246 | PHP.http.send.deflate.start_flags= \ 247 | PHP.http.send.inflate.start_auto= \ 248 | PHP.http.send.inflate.start_flags= \ 249 | PHP.http.send.not_found_404= \ 250 | \ 251 | PHP.ibase.allow_persistent= \ 252 | PHP.ibase.dateformat= \ 253 | PHP.ibase.default_charset= \ 254 | PHP.ibase.default_db= \ 255 | PHP.ibase.default_password= \ 256 | PHP.ibase.default_user= \ 257 | PHP.ibase.max_links= \ 258 | PHP.ibase.max_persistent= \ 259 | PHP.ibase.timeformat= \ 260 | PHP.ibase.timestampformat= \ 261 | \ 262 | PHP.ibm_db2.binmode= \ 263 | PHP.ibm_db2.i5_all_pconnect= \ 264 | PHP.ibm_db2.i5_allow_commit= \ 265 | PHP.ibm_db2.i5_dbcs_alloc= \ 266 | PHP.ibm_db2.instance_name= \ 267 | PHP.ibm_db2.i5_ignore_userid= \ 268 | \ 269 | PHP.iconv.input_encoding= \ 270 | PHP.iconv.internal_encoding= \ 271 | PHP.iconv.output_encoding= \ 272 | \ 273 | PHP.imlib2.font_cache_max_size= \ 274 | PHP.imlib2.font_path= \ 275 | \ 276 | PHP.ingres.allow_persistent= \ 277 | PHP.ingres.array_index_start= \ 278 | PHP.ingres.auto= \ 279 | PHP.ingres.blob_segment_length= \ 280 | PHP.ingres.cursor_mode= \ 281 | PHP.ingres.default_database= \ 282 | PHP.ingres.default_password= \ 283 | PHP.ingres.default_user= \ 284 | PHP.ingres.describe= \ 285 | PHP.ingres.fetch_buffer_size= \ 286 | PHP.ingres.max_links= \ 287 | PHP.ingres.max_persistent= \ 288 | PHP.ingres.reuse_connection= \ 289 | PHP.ingres.scrollable= \ 290 | PHP.ingres.trace= \ 291 | PHP.ingres.trace_connect= \ 292 | PHP.ingres.utf8= \ 293 | \ 294 | PHP.ldap.max_links= \ 295 | \ 296 | PHP.mail.add_x_header= \ 297 | PHP.mail.force_extra_parameters= \ 298 | PHP.mail.log= \ 299 | \ 300 | PHP.maxdb.default_db= \ 301 | PHP.maxdb.default_host= \ 302 | PHP.maxdb.default_pw= \ 303 | PHP.maxdb.default_user= \ 304 | PHP.maxdb.long_readlen= \ 305 | \ 306 | PHP.mbstring.detect_order= \ 307 | PHP.mbstring.encoding_translation=0 \ 308 | PHP.mbstring.func_overload=0 \ 309 | PHP.mbstring.http_input= \ 310 | PHP.mbstring.http_output= \ 311 | PHP.mbstring.internal_encoding= \ 312 | PHP.mbstring.language=neutral \ 313 | PHP.mbstring.script_encoding= \ 314 | PHP.mbstring.strict_detection=0 \ 315 | PHP.mbstring.substitute_character= \ 316 | \ 317 | PHP.mcrypt.algorithms_dir= \ 318 | PHP.mcrypt.modes_dir= \ 319 | \ 320 | PHP.memcache.allow_failover= \ 321 | PHP.memcache.chunk_size= \ 322 | PHP.memcache.default_port= \ 323 | PHP.memcache.hash_function= \ 324 | PHP.memcache.hash_strategy= \ 325 | PHP.memcache.max_failover_attempts= \ 326 | \ 327 | PHP.mime_magic.debug= \ 328 | PHP.mime_magic.magicfile= \ 329 | \ 330 | PHP.mongo.allow_empty_keys= \ 331 | PHP.mongo.chunk_size= \ 332 | PHP.mongo.cmd= \ 333 | PHP.mongo.default_host= \ 334 | PHP.mongo.default_port= \ 335 | PHP.mongo.is_master_interval= \ 336 | PHP.mongo.long_as_object= \ 337 | PHP.mongo.native_long= \ 338 | PHP.mongo.ping_interval= \ 339 | PHP.mongo.utf8= \ 340 | \ 341 | PHP.msql.allow_persistent= \ 342 | PHP.msql.max_links= \ 343 | PHP.msql.max_persistent= \ 344 | \ 345 | PHP.mssql.allow_persistent= \ 346 | PHP.mssql.batchsize= \ 347 | PHP.mssql.charset= \ 348 | PHP.mssql.compatability_mode= \ 349 | PHP.mssql.connect_timeout= \ 350 | PHP.mssql.datetimeconvert= \ 351 | PHP.mssql.max_links= \ 352 | PHP.mssql.max_persistent= \ 353 | PHP.mssql.max_procs= \ 354 | PHP.mssql.min_error_severity= \ 355 | PHP.mssql.min_message_severity= \ 356 | PHP.mssql.secure_connection= \ 357 | PHP.mssql.textlimit= \ 358 | PHP.mssql.textsize= \ 359 | PHP.mssql.timeout= \ 360 | \ 361 | PHP.mysql.allow_local_infile= \ 362 | PHP.mysql.allow_persistent= \ 363 | PHP.mysql.max_persistent= \ 364 | PHP.mysql.max_links= \ 365 | PHP.mysql.trace_mode= \ 366 | PHP.mysql.default_port= \ 367 | PHP.mysql.default_socket= \ 368 | PHP.mysql.default_host= \ 369 | PHP.mysql.default_user= \ 370 | PHP.mysql.default_password= \ 371 | PHP.mysql.connect_timeout= \ 372 | \ 373 | PHP.mysqli.allow_local_infile=1 \ 374 | PHP.mysqli.allow_persistent=1 \ 375 | PHP.mysqli.max_persistent=-1 \ 376 | PHP.mysqli.max_links=-1 \ 377 | PHP.mysqli.default_port=3306 \ 378 | PHP.mysqli.default_socket= \ 379 | PHP.mysqli.default_host= \ 380 | PHP.mysqli.default_user= \ 381 | PHP.mysqli.default_pw= \ 382 | PHP.mysqli.reconnect= \ 383 | PHP.mysqli.cache_size= \ 384 | \ 385 | PHP.mysqlnd_memcache.enable= \ 386 | PHP.mysqlnd_ms.enable= \ 387 | PHP.mysqlnd_ms.force_config_usage= \ 388 | PHP.mysqlnd_ms.ini_file= \ 389 | PHP.mysqlnd_ms.config_file= \ 390 | PHP.mysqlnd_ms.collect_statistics= \ 391 | PHP.mysqlnd_ms.multi_master= \ 392 | PHP.mysqlnd_ms.disable_rw_split= \ 393 | PHP.mysqlnd_mux.enable= \ 394 | PHP.mysqlnd_qc.enable_qc= \ 395 | PHP.mysqlnd_qc.ttl= \ 396 | PHP.mysqlnd_qc.cache_by_default= \ 397 | PHP.mysqlnd_qc.cache_no_table= \ 398 | PHP.mysqlnd_qc.use_request_time= \ 399 | PHP.mysqlnd_qc.time_statistics= \ 400 | PHP.mysqlnd_qc.collect_statistics= \ 401 | PHP.mysqlnd_qc.collect_statistics_log_file= \ 402 | PHP.mysqlnd_qc.collect_query_trace= \ 403 | PHP.mysqlnd_qc.query_trace_bt_depth= \ 404 | PHP.mysqlnd_qc.collect_normalized_query_trace= \ 405 | PHP.mysqlnd_qc.ignore_sql_comments= \ 406 | PHP.mysqlnd_qc.slam_defense= \ 407 | PHP.mysqlnd_qc.slam_defense_ttl= \ 408 | PHP.mysqlnd_qc.std_data_copy= \ 409 | PHP.mysqlnd_qc.apc_prefix= \ 410 | PHP.mysqlnd_qc.memc_server= \ 411 | PHP.mysqlnd_qc.memc_port= \ 412 | PHP.mysqlnd_qc.sqlite_data_file= \ 413 | PHP.mysqlnd_uh.enable= \ 414 | PHP.mysqlnd_uh.report_wrong_types= \ 415 | \ 416 | PHP.nsapi.read_timeout= \ 417 | \ 418 | PHP.oci8.connection_class= \ 419 | PHP.oci8.default_prefetch= \ 420 | PHP.oci8.events= \ 421 | PHP.oci8.max_persistent= \ 422 | PHP.oci8.old_oci_close_semantics= \ 423 | PHP.oci8.persistent_timeout= \ 424 | PHP.oci8.ping_interval= \ 425 | PHP.oci8.privileged_connect= \ 426 | PHP.oci8.statement_cache_size= \ 427 | \ 428 | PHP.odbc.allow_persistent= \ 429 | PHP.odbc.check_persistent= \ 430 | PHP.odbc.defaultbinmode= \ 431 | PHP.odbc.defaultlrl= \ 432 | PHP.odbc.default_db= \ 433 | PHP.odbc.default_pw= \ 434 | PHP.odbc.default_user= \ 435 | PHP.odbc.max_links= \ 436 | PHP.odbc.max_persistent= \ 437 | \ 438 | PHP.odbtp.datetime_format= \ 439 | PHP.odbtp.detach_default_queries= \ 440 | PHP.odbtp.guid_format= \ 441 | PHP.odbtp.interface_file= \ 442 | PHP.odbtp.truncation_errors= \ 443 | \ 444 | PHP.opcache.blacklist_filename= \ 445 | PHP.opcache.consistency_checks=0 \ 446 | PHP.opcache.dups_fix=0 \ 447 | PHP.opcache.enable=1 \ 448 | PHP.opcache.enable_cli=1 \ 449 | PHP.opcache.enable_file_override=0 \ 450 | PHP.opcache.error_log= \ 451 | PHP.opcache.fast_shutdown= \ 452 | PHP.opcache.file_update_protection=2 \ 453 | PHP.opcache.force_restart_timeout=180 \ 454 | PHP.opcache.inherited_hack=1 \ 455 | PHP.opcache.interned_strings_buffer=16 \ 456 | PHP.opcache.load_comments= \ 457 | PHP.opcache.log_verbosity_level=1 \ 458 | PHP.opcache.max_accelerated_files=40000 \ 459 | PHP.opcache.max_file_size=0 \ 460 | PHP.opcache.max_wasted_percentage=5 \ 461 | PHP.opcache.memory_consumption=256 \ 462 | PHP.opcache.mmap_base= \ 463 | PHP.opcache.optimization_level=0x7FFFBFFF \ 464 | PHP.opcache.preferred_memory_model= \ 465 | PHP.opcache.protect_memory=0 \ 466 | PHP.opcache.revalidate_freq=0 \ 467 | PHP.opcache.revalidate_path=0 \ 468 | PHP.opcache.save_comments=1 \ 469 | PHP.opcache.use_cwd=1 \ 470 | PHP.opcache.validate_timestamps=1 \ 471 | \ 472 | PHP.opendirectory.max_refs= \ 473 | PHP.opendirectory.separator= \ 474 | \ 475 | PHP.pam.servicename= \ 476 | \ 477 | PHP.pcre.backtrack_limit=1000000 \ 478 | PHP.pcre.recursion_limit=100000 \ 479 | \ 480 | PHP.pdo.dsn.*= \ 481 | \ 482 | PHP.pdo_odbc.connection_pooling= \ 483 | \ 484 | PHP.pgsql.allow_persistent= \ 485 | PHP.pgsql.auto_reset_persistent= \ 486 | PHP.pgsql.ignore_notice= \ 487 | PHP.pgsql.log_notice= \ 488 | PHP.pgsql.max_links= \ 489 | PHP.pgsql.max_persistent= \ 490 | \ 491 | PHP.phar.extract_list= \ 492 | PHP.phar.readonly=1 \ 493 | PHP.phar.require_hash=1 \ 494 | \ 495 | PHP.python.append_path= \ 496 | PHP.python.prepend_path= \ 497 | \ 498 | PHP.runkit.internal_override= \ 499 | PHP.runkit.superglobal= \ 500 | \ 501 | PHP.session.auto_start=0 \ 502 | PHP.session.cache_expire=180 \ 503 | PHP.session.cache_limiter=nocache \ 504 | PHP.session.cookie_domain= \ 505 | PHP.session.cookie_httponly= \ 506 | PHP.session.cookie_lifetime=0 \ 507 | PHP.session.cookie_path=/ \ 508 | PHP.session.cookie_secure=0 \ 509 | PHP.session.entropy_file= \ 510 | PHP.session.entropy_length= \ 511 | PHP.session.gc_divisor=1000 \ 512 | PHP.session.gc_maxlifetime=1440 \ 513 | PHP.session.gc_probability=0 \ 514 | PHP.session.hash_bits_per_character=6 \ 515 | PHP.session.hash_function= \ 516 | PHP.session.name=PHPSESSID \ 517 | PHP.session.referer_check= \ 518 | PHP.session.save_handler=files \ 519 | PHP.session.save_path=/var/lib/php/sessions \ 520 | PHP.session.serialize_handler=php \ 521 | PHP.session.use_cookies=1 \ 522 | PHP.session.use_only_cookies=1 \ 523 | PHP.session.use_trans_sid=0 \ 524 | \ 525 | PHP.session_pgsql.create_table= \ 526 | PHP.session_pgsql.db= \ 527 | PHP.session_pgsql.disable= \ 528 | PHP.session_pgsql.failover_mode= \ 529 | PHP.session_pgsql.gc_interval= \ 530 | PHP.session_pgsql.keep_expired= \ 531 | PHP.session_pgsql.sem_file_name= \ 532 | PHP.session_pgsql.serializable= \ 533 | PHP.session_pgsql.short_circuit= \ 534 | PHP.session_pgsql.use_app_vars= \ 535 | PHP.session_pgsql.vacuum_interval= \ 536 | \ 537 | PHP.simple_cvs.authMethod= \ 538 | PHP.simple_cvs.compressionLevel= \ 539 | PHP.simple_cvs.cvsRoot= \ 540 | PHP.simple_cvs.host= \ 541 | PHP.simple_cvs.moduleName= \ 542 | PHP.simple_cvs.userName= \ 543 | PHP.simple_cvs.workingDir= \ 544 | \ 545 | PHP.soap.wsdl_cache=1 \ 546 | PHP.soap.wsdl_cache_dir=/tmp \ 547 | PHP.soap.wsdl_cache_enabled=1 \ 548 | PHP.soap.wsdl_cache_limit=86400 \ 549 | PHP.soap.wsdl_cache_ttl=5 \ 550 | \ 551 | PHP.sql.safe_mode= \ 552 | \ 553 | PHP.sqlite.assoc_case= \ 554 | \ 555 | PHP.sybase.allow_persistent= \ 556 | PHP.sybase.interface_file= \ 557 | PHP.sybase.max_links= \ 558 | PHP.sybase.max_persistent= \ 559 | PHP.sybase.min_error_severity= \ 560 | PHP.sybase.min_message_severity= \ 561 | \ 562 | PHP.sybct.deadlock_retry_count= \ 563 | PHP.sybct.login_timeout= \ 564 | PHP.sybct.packet_size= \ 565 | PHP.sybct.timeout= \ 566 | \ 567 | PHP.sysvshm.init_mem= \ 568 | \ 569 | PHP.tidy.clean_output= \ 570 | PHP.tidy.default_config= \ 571 | \ 572 | PHP.uploadprogress.file.filename_template= \ 573 | \ 574 | PHP.url_rewriter.tags="form=" \ 575 | \ 576 | PHP.user_ini.cache_ttl=300 \ 577 | PHP.user_ini.filename=.user.ini \ 578 | \ 579 | PHP.valkyrie.auto_validate= \ 580 | PHP.valkyrie.config_path= \ 581 | \ 582 | PHP.vld.active= \ 583 | PHP.vld.execute= \ 584 | PHP.vld.skip_append= \ 585 | PHP.vld.skip_prepend= \ 586 | \ 587 | PHP.xmms.path= \ 588 | PHP.xmms.session= \ 589 | \ 590 | PHP.yami.response.timeout= \ 591 | \ 592 | PHP.yaz.keepalive= \ 593 | PHP.yaz.log_mask= \ 594 | \ 595 | PHP.zend.enable_gc=1 \ 596 | PHP.zend.multibyte=0 \ 597 | PHP.zend.script_encoding= \ 598 | PHP.zend.signal_check=0 \ 599 | \ 600 | PHP.zlib.output_compression= \ 601 | PHP.zlib.output_compression_level=-1 \ 602 | PHP.zlib.output_handler= \ 603 | \ 604 | PHP.xdebug.cli_color=0 \ 605 | PHP.xdebug.client_discovery_header= \ 606 | PHP.xdebug.client_host=host.docker.internal \ 607 | PHP.xdebug.client_port=9003 \ 608 | PHP.xdebug.collect_assignments=Off \ 609 | PHP.xdebug.collect_return=Off \ 610 | PHP.xdebug.connect_timeout_ms=200 \ 611 | PHP.xdebug.discover_client_host=false \ 612 | PHP.xdebug.dump.COOKIE= \ 613 | PHP.xdebug.dump.ENV= \ 614 | PHP.xdebug.dump.FILES= \ 615 | PHP.xdebug.dump.GET= \ 616 | PHP.xdebug.dump.POST= \ 617 | PHP.xdebug.dump.REQUEST= \ 618 | PHP.xdebug.dump.SERVER= \ 619 | PHP.xdebug.dump.SESSION= \ 620 | PHP.xdebug.dump_globals=On \ 621 | PHP.xdebug.dump_once=On \ 622 | PHP.xdebug.dump_undefined=Off \ 623 | PHP.xdebug.file_link_format= \ 624 | PHP.xdebug.filename_format= \ 625 | PHP.xdebug.force_display_errors=Off \ 626 | PHP.xdebug.force_error_reporting=0 \ 627 | PHP.xdebug.halt_level=0 \ 628 | PHP.xdebug.idekey= \ 629 | PHP.xdebug.log= \ 630 | PHP.xdebug.log_level=7 \ 631 | PHP.xdebug.max_nesting_level=256 \ 632 | PHP.xdebug.max_stack_frames=-1 \ 633 | PHP.xdebug.mode=debug \ 634 | PHP.xdebug.output_dir= \ 635 | PHP.xdebug.profiler_aggregate=Off \ 636 | PHP.xdebug.profiler_append=Off \ 637 | PHP.xdebug.profiler_output_name=cachegrind.out.%p \ 638 | PHP.xdebug.remote_cookie_expire_time=3600 \ 639 | PHP.xdebug.scream=Off \ 640 | PHP.xdebug.show_error_trace=Off \ 641 | PHP.xdebug.show_exception_trace=Off \ 642 | PHP.xdebug.show_local_vars=Off \ 643 | PHP.xdebug.start_with_request=trigger \ 644 | PHP.xdebug.trace_format=0 \ 645 | PHP.xdebug.trace_options=0 \ 646 | PHP.xdebug.trace_output_name=trace.%c \ 647 | PHP.xdebug.trigger_value= \ 648 | PHP.xdebug.var_display_max_children=128 \ 649 | PHP.xdebug.var_display_max_data=512 \ 650 | PHP.xdebug.var_display_max_depth=3 \ 651 | \ 652 | FPM.access.format="%R - %u %t \"%m %r\" %s" \ 653 | FPM.listen="0.0.0.0:9000" \ 654 | FPM.listen.backlog=511 \ 655 | FPM.listen.mode=0660 \ 656 | FPM.pid="/var/run/php-fpm/php-fpm.pid" \ 657 | FPM.pm=dynamic \ 658 | FPM.pm.max_children=5 \ 659 | FPM.pm.start_servers=2 \ 660 | FPM.pm.min_spare_servers=1 \ 661 | FPM.pm.max_spare_servers=3 \ 662 | FPM.pm.process_idle_timeout=10s \ 663 | FPM.pm.max_requests=0 \ 664 | FPM.security.limit_extensions=.php \ 665 | -------------------------------------------------------------------------------- /Dockerfile-nginx: -------------------------------------------------------------------------------- 1 | ARG PHP_VER_DOT 2 | FROM jtreminio/php:$PHP_VER_DOT 3 | LABEL maintainer="Juan Treminio " 4 | 5 | RUN printf "deb [arch=amd64] http://ppa.launchpad.net/ondrej/nginx/ubuntu bionic main\n" \ 6 | >/etc/apt/sources.list.d/ondrej-nginx.list &&\ 7 | apt-get update &&\ 8 | apt-get install --no-install-recommends --no-install-suggests -y \ 9 | nginx \ 10 | libnginx-mod-http-perl &&\ 11 | apt-get -y --purge autoremove &&\ 12 | rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/{man,doc} 13 | 14 | # Set proper permissions for Nginx 15 | RUN chown -R www-data:www-data \ 16 | /var/lib/nginx \ 17 | /var/www &&\ 18 | install -d -m 0755 -o www-data -g www-data \ 19 | /var/cache/nginx \ 20 | /var/run/nginx &&\ 21 | rm -rf /var/www/html 22 | 23 | COPY files/nginx/nginx.conf /etc/nginx/nginx.conf 24 | COPY files/nginx/vhost/* /etc/nginx/sites-available/ 25 | RUN rm -f /etc/nginx/sites-enabled/default 26 | 27 | # runit config 28 | RUN mkdir /etc/service/nginx 29 | COPY files/nginx/nginx /etc/service/nginx/run 30 | RUN chmod +x /etc/service/nginx/run 31 | 32 | RUN mkdir /etc/service/fpm-xdebug 33 | COPY files/php/fpm-xdebug /etc/service/fpm-xdebug/run 34 | RUN chmod +x /etc/service/fpm-xdebug/run &&\ 35 | touch /var/log/fpm-xdebug-tail 36 | 37 | # Default Nginx vhost to basic FPM config 38 | ENV VHOST=fpm 39 | 40 | # Replace 0.0.0.0:9000 41 | ENV FPM.listen="127.0.0.1:9000" 42 | 43 | EXPOSE 8080 44 | 45 | CMD ["/sbin/my_init"] 46 | -------------------------------------------------------------------------------- /Dockerfile-php-cli: -------------------------------------------------------------------------------- 1 | FROM jtreminio/phpenv:latest 2 | LABEL maintainer="Juan Treminio " 3 | 4 | ENV DEBIAN_FRONTEND=noninteractive 5 | ENV APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn 6 | 7 | RUN update-alternatives --install /bin/sh sh /bin/bash 100 8 | 9 | RUN mkdir /docker_build 10 | 11 | COPY ./files/base_packages.sh /docker_build/base_packages.sh 12 | RUN chmod +x /docker_build/base_packages.sh &&\ 13 | /docker_build/base_packages.sh 14 | 15 | ENV COMPOSER_HOME /.composer 16 | ARG PHP_VER_DOT 17 | ARG PHP_VER 18 | ENV PHP_VER=$PHP_VER 19 | 20 | COPY ./files/php/bin_* /docker_build/ 21 | RUN chmod +x /docker_build/bin_* &&\ 22 | /docker_build/bin_install_modules.sh ${PHP_VER} &&\ 23 | /docker_build/bin_clean_directories.sh ${PHP_VER} 24 | 25 | RUN /docker_build/bin_install_composer.sh &&\ 26 | /docker_build/bin_rm_symlinked_ini.sh ${PHP_VER} cli &&\ 27 | /docker_build/bin_link_ini.sh ${PHP_VER} &&\ 28 | rm -rf /docker_build 29 | 30 | # Save INI file into non-versioned directory 31 | # This makes managing them across several different PHP versions easier 32 | COPY files/php/php.ini /etc/php/php.ini 33 | 34 | # Default sessions directory 35 | RUN install -d -m 0755 -o www-data -g www-data /var/lib/php/sessions 36 | 37 | # Xdebug CLI debugging 38 | COPY files/php/xdebug /usr/bin/xdebug 39 | RUN chmod +x /usr/bin/xdebug 40 | 41 | WORKDIR /etc/php/${PHP_VER} 42 | 43 | USER www-data 44 | -------------------------------------------------------------------------------- /Dockerfile-php-fpm: -------------------------------------------------------------------------------- 1 | ARG PHP_VER 2 | ARG PHP_VER_DOT 3 | FROM jtreminio/php-cli:$PHP_VER_DOT 4 | LABEL maintainer="Juan Treminio " 5 | 6 | USER root 7 | 8 | RUN apt-get update &&\ 9 | apt-get install --no-install-recommends --no-install-suggests -y \ 10 | php${PHP_VER}-fpm \ 11 | &&\ 12 | apt-get -y --purge autoremove &&\ 13 | rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/{man,doc} 14 | 15 | RUN mkdir /docker_build 16 | 17 | COPY ./files/php/bin_* /docker_build/ 18 | RUN chmod +x /docker_build/bin_* &&\ 19 | /docker_build/bin_clean_directories.sh ${PHP_VER} &&\ 20 | /docker_build/bin_rm_symlinked_ini.sh ${PHP_VER} fpm &&\ 21 | rm -rf /docker_build 22 | 23 | # Save INI and FPM conf files into non-versioned directory 24 | # This makes managing them across several different PHP versions easier 25 | COPY files/php/fpm.conf /etc/php/fpm.conf 26 | RUN ln -s /etc/php/fpm.conf /etc/php/${PHP_VER}/fpm/php-fpm.conf 27 | 28 | RUN rm -rf /etc/apache2 29 | 30 | # Standardize PHP-FPM executable location 31 | RUN rm -f /usr/sbin/php-fpm &&\ 32 | ln -s /usr/sbin/php-fpm${PHP_VER} /usr/sbin/php-fpm 33 | 34 | # Only set PHP_INI_SCAN_DIR inside following file so it does not affect PHP CLI 35 | # runit config 36 | RUN mkdir /etc/service/fpm 37 | COPY files/php/php-fpm /etc/service/fpm/run 38 | RUN chmod +x /etc/service/fpm/run 39 | 40 | # PID directory 41 | RUN install -d -m 0755 -o www-data -g www-data /var/run/php-fpm 42 | 43 | EXPOSE 9000 44 | 45 | CMD ["/sbin/my_init"] 46 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Juan Treminio 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README-apache.md: -------------------------------------------------------------------------------- 1 | #### Supported tags and respective `Dockerfile` links 2 | 3 | * `jtreminio/php-apache:8.1` 4 | * `jtreminio/php-apache:8.0` 5 | * `jtreminio/php-apache:7.4` 6 | 7 | [All minor version tags can be found here.](https://hub.docker.com/r/jtreminio/php-apache/tags/) 8 | 9 | [Dockerfile can be found here.](https://github.com/jtreminio/php-docker/blob/master/Dockerfile-apache) 10 | 11 | #### [This README best viewed on Github for formatting](https://github.com/jtreminio/php-docker/blob/master/README-apache.md) 12 | 13 | ## How to use this image 14 | 15 | ### Apache config 16 | 17 | These PHP-FPM + Apache images come several vhost configs baked in. 18 | 19 | [You can see the full list by going here](https://github.com/jtreminio/php-docker/tree/master/files/apache/vhost). 20 | 21 | You can choose what vhost to use by passing the `VHOST` environment variable: 22 | 23 | ```shell 24 | docker container run --rm -it \ 25 | -e VHOST=html \ 26 | jtreminio/php-apache:8.1 27 | 28 | *** Running /etc/my_init.d/00_regen_ssh_host_keys.sh... 29 | *** Running /etc/my_init.d/10_syslog-ng.init... 30 | Dec 20 03:17:48 5f92dfc2d54d syslog-ng[13]: syslog-ng starting up; version='3.13.2' 31 | *** Booting runit daemon... 32 | *** Runit started as PID 20 33 | Using /etc/apache2/sites-available/html.conf 34 | [... snip ...] 35 | 36 | ``` 37 | 38 | `VHOST` can be one of 39 | 40 | * drupal 41 | * fpm 42 | * html 43 | * laravel 44 | * symfony2 45 | * symfony3 46 | * symfony4 47 | * wordpress 48 | 49 | Visit the Github link above to explore the details of each. If `VHOST` is not defined the image defaults to `fpm`: 50 | 51 | ```shell 52 | docker container run --rm -it \ 53 | jtreminio/php-apache:8.1 54 | 55 | *** Running /etc/my_init.d/00_regen_ssh_host_keys.sh... 56 | *** Running /etc/my_init.d/10_syslog-ng.init... 57 | Dec 20 03:20:13 1ebf826685db syslog-ng[13]: syslog-ng starting up; version='3.13.2' 58 | *** Booting runit daemon... 59 | *** Runit started as PID 20 60 | Using /etc/apache2/sites-available/fpm.conf 61 | [... snip ...] 62 | 63 | ``` 64 | 65 | The default FPM vhost config looks like: 66 | 67 | ```apacheconf 68 | # /etc/apache2/sites-available/fpm.conf 69 | # Basic FPM 70 | 71 | 72 | ServerName default.localhost 73 | ServerAlias * 74 | 75 | DocumentRoot /var/www 76 | 77 | 78 | 79 | SetHandler proxy:fcgi://127.0.0.1:${PHPFPM_XDEBUG_PORT} 80 | 81 | 82 | SetHandler proxy:fcgi://127.0.0.1:9000 83 | 84 | 85 | 86 | 87 | Options Indexes FollowSymlinks MultiViews 88 | AllowOverride All 89 | Require all granted 90 | DirectoryIndex index.html index.php 91 | 92 | 93 | ErrorLog "/dev/stderr" 94 | CustomLog "/dev/stdout" combined 95 | LogLevel warn 96 | ServerSignature Off 97 | SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1 98 | 99 | 100 | ``` 101 | 102 | The expected location of your `index.php` file is at `/var/www/index.php`. 103 | 104 | ### Custom Vhost Config 105 | 106 | You can use your own custom vhost config by writing to file `/etc/apache2/sites-enabled/default.conf`. 107 | 108 | If `/etc/apache2/sites-enabled/default.conf` exists then `VHOST` env var will be ignored. 109 | 110 | If you wish to use the built-in Xdebug support make sure to use the following `FilesMatch` directive: 111 | 112 | ```apacheconf 113 | 114 | 115 | SetHandler proxy:fcgi://127.0.0.1:${PHPFPM_XDEBUG_PORT} 116 | 117 | 118 | SetHandler proxy:fcgi://127.0.0.1:9000 119 | 120 | 121 | 122 | ``` 123 | 124 | You can read about this in greater detail at my blog post [All-in-One PHP-FPM + Nginx/Apache Containers](https://jtreminio.com/blog/all-in-one-php-fpm-nginx-apache-containers/). 125 | 126 | #### Built-in Xdebug support 127 | 128 | These images come with Xdebug support but it is **disabled** by default. 129 | 130 | To enabled Xdebug support you must pass environment variable `PHPFPM_XDEBUG=on`. 131 | 132 | A second PHP-FPM instance will be created with Xdebug enabled, listening to port 9999. **The main PHP-FPM instance listening on port 9000 will _not_ have Xdebug enabled!** 133 | 134 | You can debug your applications by [using PhpStorm's bookmarklets](https://www.jetbrains.com/phpstorm/marklets/). 135 | 136 | For more information please refer to my blog post [Developing at Full Speed with Xdebug](https://jtreminio.com/blog/developing-at-full-speed-with-xdebug/), and [All-in-One PHP-FPM + Nginx/Apache Containers](https://jtreminio.com/blog/all-in-one-php-fpm-nginx-apache-containers/). 137 | 138 | Note: If `PHPFPM_XDEBUG` is not set to `on`, the second PHP-FPM instance will NOT be created. 139 | 140 | ### docker-compose 141 | 142 | The following example uses [Traefik](https://hub.docker.com/_/traefik/). First spin up a Traefik container: 143 | 144 | ```shell 145 | docker network create --driver bridge traefik_webgateway 146 | 147 | docker container run -d \ 148 | --name traefik_proxy \ 149 | --network traefik_webgateway \ 150 | --publish 80:80 \ 151 | --publish 8080:8080 \ 152 | --restart always \ 153 | --volume /var/run/docker.sock:/var/run/docker.sock \ 154 | --volume /dev/null:/traefik.toml \ 155 | traefik:1.7 --api --docker \ 156 | --docker.domain=docker.localhost --logLevel=DEBUG 157 | 158 | ``` 159 | 160 | Then create a `docker-compose.yml` that would look like this: 161 | 162 | ```yaml 163 | version: '3.2' 164 | networks: 165 | public: 166 | external: 167 | name: traefik_webgateway 168 | services: 169 | web: 170 | image: jtreminio/php-apache:8.1 171 | labels: 172 | - traefik.backend=php-apache 173 | - traefik.docker.network=traefik_webgateway 174 | - traefik.frontend.rule=Host:php-apache.localhost 175 | - traefik.port=8080 176 | networks: 177 | - public 178 | volumes: 179 | - ${PWD}/index.php:/var/www/index.php 180 | 181 | ``` 182 | 183 | You can pass PHP INI settings like so: 184 | 185 | ```yaml 186 | version: '3.2' 187 | networks: 188 | public: 189 | external: 190 | name: traefik_webgateway 191 | services: 192 | web: 193 | image: jtreminio/php-apache:8.1 194 | labels: 195 | - traefik.backend=php-apache 196 | - traefik.docker.network=traefik_webgateway 197 | - traefik.frontend.rule=Host:php-apache.localhost 198 | - traefik.port=8080 199 | networks: 200 | - public 201 | volumes: 202 | - ${PWD}/index.php:/var/www/index.php 203 | environment: 204 | - PHP.display_errors=On 205 | - PHP.error_reporting=-1 206 | 207 | ``` 208 | 209 | If you want to enable Xdebug support you must also pass `PHPFPM_XDEBUG`: 210 | 211 | ```yaml 212 | version: '3.2' 213 | networks: 214 | public: 215 | external: 216 | name: traefik_webgateway 217 | services: 218 | web: 219 | image: jtreminio/php-apache:8.1 220 | labels: 221 | - traefik.backend=php-apache 222 | - traefik.docker.network=traefik_webgateway 223 | - traefik.frontend.rule=Host:php-apache.localhost 224 | - traefik.port=8080 225 | networks: 226 | - public 227 | volumes: 228 | - ${PWD}/index.php:/var/www/index.php 229 | environment: 230 | - PHP.display_errors=On 231 | - PHP.error_reporting=-1 232 | - PHPFPM_XDEBUG=On 233 | 234 | ``` 235 | 236 | You can easily switch vhost configs by using `VHOST`: 237 | 238 | ```yaml 239 | version: '3.2' 240 | networks: 241 | public: 242 | external: 243 | name: traefik_webgateway 244 | services: 245 | web: 246 | image: jtreminio/php-apache:8.1 247 | labels: 248 | - traefik.backend=php-apache 249 | - traefik.docker.network=traefik_webgateway 250 | - traefik.frontend.rule=Host:php-apache.localhost 251 | - traefik.port=8080 252 | networks: 253 | - public 254 | volumes: 255 | - ${PWD}/index.php:/var/www/index.php 256 | environment: 257 | - PHP.display_errors=On 258 | - PHP.error_reporting=-1 259 | - PHPFPM_XDEBUG=On 260 | - VHOST=symfony2 261 | 262 | ``` 263 | 264 | Or, you can easily use a custom vhost config: 265 | 266 | ```yaml 267 | version: '3.2' 268 | networks: 269 | public: 270 | external: 271 | name: traefik_webgateway 272 | services: 273 | web: 274 | image: jtreminio/php-apache:8.1 275 | labels: 276 | - traefik.backend=php-apache 277 | - traefik.docker.network=traefik_webgateway 278 | - traefik.frontend.rule=Host:php-apache.localhost 279 | - traefik.port=8080 280 | networks: 281 | - public 282 | volumes: 283 | - ${PWD}/index.php:/var/www/index.php 284 | - ${PWD}/vhost.conf:/etc/apache2/sites-enabled/default.conf 285 | environment: 286 | - PHP.display_errors=On 287 | - PHP.error_reporting=-1 288 | - PHPFPM_XDEBUG=On 289 | 290 | ``` 291 | 292 | You would need to create an `index.php` file at the same location as your `docker-compose.yml` file. 293 | 294 | The resulting container would then be available at http://php-apache.localhost if you are using Chrome, or have installed dnsmasq. 295 | 296 | ## About these images 297 | 298 | These images are built from [jtreminio/php](https://hub.docker.com/r/jtreminio/php/) 299 | 300 | All PHP INI and env var features from those images apply here. 301 | -------------------------------------------------------------------------------- /README-cli.md: -------------------------------------------------------------------------------- 1 | #### Supported tags 2 | 3 | * `jtreminio/php-cli:8.1` 4 | * `jtreminio/php-cli:8.0` 5 | * `jtreminio/php-cli:7.4` 6 | 7 | [All minor version tags can be found here.](https://hub.docker.com/r/jtreminio/php-cli/tags/) 8 | 9 | [Dockerfile can be found here.](https://github.com/jtreminio/php-docker/blob/master/Dockerfile-php-cli) 10 | 11 | #### [This README best viewed on Github for formatting](https://github.com/jtreminio/php-docker/blob/master/README-cli.md) 12 | 13 | ## How to use this image 14 | 15 | ### With Command Line 16 | 17 | For PHP projects run through the command line interface (CLI), you can do the following. 18 | 19 | #### Create a Dockerfile in your PHP project 20 | 21 | ```dockerfile 22 | FROM jtreminio/php-cli:8.1 23 | COPY . /usr/src/myapp 24 | WORKDIR /usr/src/myapp 25 | CMD [ "php", "./your-script.php" ] 26 | 27 | ``` 28 | 29 | Then, run the commands to build and run the Docker image: 30 | 31 | ```shell 32 | docker build -t my-php-app . 33 | docker run -it --rm --name my-running-app my-php-app 34 | 35 | ``` 36 | 37 | #### Run a single PHP script 38 | For many simple, single file projects, you may find it inconvenient to write a complete `Dockerfile`. In such cases, you can run a PHP script by using the PHP Docker image directly: 39 | 40 | ```shell 41 | docker run -it --rm \ 42 | --name my-running-script \ 43 | -v "$PWD":/usr/src/myapp \ 44 | -w /usr/src/myapp \ 45 | jtreminio/php-cli:8.1 php your-script.php 46 | 47 | ``` 48 | 49 | Note that all variants of the PHP image contain the PHP CLI. 50 | 51 | ## With PHP-FPM 52 | 53 | I have created images with PHP-FPM. 54 | 55 | [Click here for `jtreminio/php`](https://hub.docker.com/r/jtreminio/php). 56 | 57 | ## With Nginx or Apache 58 | 59 | I have created full-featured Nginx/Apache versions of these images. 60 | 61 | [Click here for `jtreminio/php-nginx`](https://hub.docker.com/r/jtreminio/php-nginx). 62 | 63 | [Click here for `jtreminio/php-apache`](https://hub.docker.com/r/jtreminio/php-apache). 64 | 65 | ## About these images 66 | 67 | These images are built from [Ondřej Surý's PPA](https://launchpad.net/~ondrej/+archive/ubuntu/php) 68 | 69 | They come with the most common PHP modules baked in. For a full list please see below. 70 | 71 | `Composer` is installed at `/usr/local/bin/composer` 72 | 73 | PHP-CLI INI files are saved to standard location across all versions to make managing them simpler. 74 | 75 | * PHP INI use by CLI is at `/etc/php/cli.ini` 76 | 77 | Two blank INI files have been provided for you to write your custom INI settings. 78 | 79 | * /etc/php/cli-custom.ini 80 | * /etc/php/php-custom.ini 81 | 82 | Use `-v your-file.ini:/etc/php/cli-custom.ini` to add your settings. These two files are loaded last so its contents will take precedence over everything else. 83 | 84 | ## INI Through Environment Variables 85 | 86 | You can set a large number of PHP INI settings using environment variables. 87 | 88 | [A full list of supported directives can be found here](https://github.com/jtreminio/php-docker/blob/master/Dockerfile-env). 89 | 90 | [You can read about this in more detail here](https://jtreminio.com/blog/docker-php/php-fpm-configuration-via-environment-variables/). 91 | 92 | ```shell 93 | docker container run -it --rm \ 94 | jtreminio/php-cli:8.1 php -i | grep display_errors 95 | 96 | 100:display_errors => Off => Off 97 | 98 | ``` 99 | 100 | vs 101 | 102 | ```shell 103 | docker container run -it --rm \ 104 | -e PHP.display_errors=1 \ 105 | jtreminio/php-cli:8.1 php -i | grep display_errors 106 | 107 | 100:display_errors => STDOUT => STDOUT 108 | 109 | ``` 110 | 111 | ## Installed Modules 112 | 113 | Many modules are installed and enabled by default: 114 | 115 | * php-bcmath 116 | * php-cli 117 | * php-curl 118 | * php-intl 119 | * php-json 120 | * php-mbstring 121 | * php-mysql 122 | * php-opcache 123 | * php-xml 124 | * php-zip 125 | 126 | More modules are installed but _not_ enabled by default: 127 | 128 | * php-amqp 129 | * php-apcu 130 | * php-gd 131 | * php-igbinary 132 | * php-imagick 133 | * php-mailparse 134 | * php-memcached 135 | * php-mongodb 136 | * php-oauth 137 | * php-raphf 138 | * php-redis 139 | * php-soap 140 | * php-solr 141 | * php-sqlite3 142 | * php-uuid 143 | * php-zmq 144 | * php-xdebug 145 | 146 | PHP 7.4 also comes with 147 | 148 | * apcu_bc 149 | * geoip 150 | * gnupg 151 | * radius 152 | * ssh2 153 | * stomp 154 | * uploadprogress 155 | 156 | You can enable these modules by using the `PHP_INI_SCAN_DIR` env var. A special shortcut has been created to more easily add modules: 157 | 158 | ```shell 159 | docker container run -it --rm \ 160 | -e PHP_INI_SCAN_DIR=:/p/amqp:/p/mailparse \ 161 | jtreminio/php-cli:8.1 php -v 162 | 163 | ``` 164 | 165 | The `/p` directory contains symlinks to other directories (if PHP version supports the module) 166 | 167 | ``` 168 | /p/amqp -> /etc/php/extra-mods/amqp 169 | /p/apcu -> /etc/php/extra-mods/apcu 170 | /p/geoip -> /etc/php/extra-mods/geoip 171 | /p/gnupg -> /etc/php/extra-mods/gnupg 172 | /p/imagick -> /etc/php/extra-mods/imagick 173 | /p/lua -> /etc/php/extra-mods/lua 174 | /p/mailparse -> /etc/php/extra-mods/mailparse 175 | /p/memcached -> /etc/php/extra-mods/memcached 176 | /p/mongodb -> /etc/php/extra-mods/mongodb 177 | /p/oauth -> /etc/php/extra-mods/oauth 178 | /p/pdo_sqlite -> /etc/php/extra-mods/pdo_sqlite 179 | /p/radius -> /etc/php/extra-mods/radius 180 | /p/raphf -> /etc/php/extra-mods/raphf 181 | /p/redis -> /etc/php/extra-mods/redis 182 | /p/solr -> /etc/php/extra-mods/solr 183 | /p/sqlite3 -> /etc/php/extra-mods/sqlite3 184 | /p/ssh2 -> /etc/php/extra-mods/ssh2 185 | /p/stomp -> /etc/php/extra-mods/stomp 186 | /p/uploadprogress -> /etc/php/extra-mods/uploadprogress 187 | /p/uuid -> /etc/php/extra-mods/uuid 188 | /p/xdebug -> /etc/php/extra-mods/xdebug 189 | /p/zmq -> /etc/php/extra-mods/zmq 190 | 191 | ``` 192 | 193 | You can add as many of these as you want to `PHP_INI_SCAN_DIR`, make sure to prepend `:`. 194 | 195 | You can read about this in greater detail by going to [PHP Modules Toggled via Environment Variables](https://jtreminio.com/blog/php-modules-toggled-via-environment-variables/). 196 | 197 | ## Xdebug 198 | 199 | Xdebug is _installed_ but _disabled_ by default: 200 | 201 | ```shell 202 | docker container run -it --rm jtreminio/php-cli:7.2 php -v 203 | 204 | PHP 8.1.2 (cli) (built: Jan 24 2022 10:42:15) (NTS) 205 | Copyright (c) The PHP Group 206 | Zend Engine v4.1.2, Copyright (c) Zend Technologies 207 | with Zend OPcache v8.1.2, Copyright (c), by Zend Technologies 208 | 209 | ``` 210 | 211 | To enable Xdebug (ONLY on non-public servers!) you may use the `PHP_INI_SCAN_DIR` env var: 212 | 213 | ```shell 214 | docker container run -it --rm \ 215 | -e PHP_INI_SCAN_DIR=:/p/xdebug \ 216 | jtreminio/php-cli:8.1 php -v 217 | 218 | PHP 8.1.2 (cli) (built: Jan 24 2022 10:42:15) (NTS) 219 | Copyright (c) The PHP Group 220 | Zend Engine v4.1.2, Copyright (c) Zend Technologies 221 | with Zend OPcache v8.1.2, Copyright (c), by Zend Technologies 222 | with Xdebug v3.1.2, Copyright (c) 2002-2021, by Derick Rethans 223 | 224 | ``` 225 | 226 | Note the prepended `:` in `:/p/xdebug`. 227 | 228 | `xdebug.remote_host` is set to `host.docker.internal` by default. [This will not work in Linux (yet)](https://github.com/docker/for-linux/issues/264). 229 | You must either pass your host IP directly, or use a gateway. I have found `172.17.0.1` to work in most cases: 230 | 231 | ```shell 232 | docker container run -it --rm \ 233 | -e PHP_INI_SCAN_DIR=:/p/xdebug \ 234 | -e PHP.xdebug.client_host=172.17.0.1 \ 235 | jtreminio/php-cli:8.1 php -i | grep xdebug.client_host 236 | 237 | 639:xdebug.client_host => 172.17.0.1 => 172.17.0.1 238 | 239 | ``` 240 | 241 | A helper script has been created at `/usr/bin/xdebug` to help you debug CLI applications. 242 | 243 | To use it, call it instead of `php` directly: 244 | 245 | ```shell 246 | docker container run -it --rm \ 247 | jtreminio/php-cli:8.1 xdebug -v 248 | 249 | PHP 8.1.2 (cli) (built: Jan 24 2022 10:42:15) (NTS) 250 | Copyright (c) The PHP Group 251 | Zend Engine v4.1.2, Copyright (c) Zend Technologies 252 | with Zend OPcache v8.1.2, Copyright (c), by Zend Technologies 253 | with Xdebug v3.1.2, Copyright (c) 2002-2021, by Derick Rethans 254 | 255 | ``` 256 | -------------------------------------------------------------------------------- /README-nginx.md: -------------------------------------------------------------------------------- 1 | #### Supported tags and respective `Dockerfile` links 2 | 3 | * `jtreminio/php-nginx:8.1` 4 | * `jtreminio/php-nginx:8.0` 5 | * `jtreminio/php-nginx:7.4` 6 | 7 | [All minor version tags can be found here.](https://hub.docker.com/r/jtreminio/php-nginx/tags/) 8 | 9 | [Dockerfile can be found here.](https://github.com/jtreminio/php-docker/blob/master/Dockerfile-nginx) 10 | 11 | #### [This README best viewed on Github for formatting](https://github.com/jtreminio/php-docker/blob/master/README-nginx.md) 12 | 13 | ## How to use this image 14 | 15 | ### Nginx config 16 | 17 | These PHP-FPM + Nginx images come several vhost configs baked in. 18 | 19 | [You can see the full list by going here](https://github.com/jtreminio/php-docker/tree/master/files/nginx/vhost). 20 | 21 | You can choose what vhost to use by passing the `VHOST` environment variable: 22 | 23 | ```shell 24 | docker container run --rm -it \ 25 | -e VHOST=html \ 26 | jtreminio/php-nginx:7.3 27 | 28 | ** Running /etc/my_init.d/00_regen_ssh_host_keys.sh... 29 | *** Running /etc/my_init.d/10_syslog-ng.init... 30 | Dec 20 03:33:24 195edf7f2180 syslog-ng[13]: syslog-ng starting up; version='3.13.2' 31 | *** Booting runit daemon... 32 | *** Runit started as PID 20 33 | Using /etc/nginx/sites-available/html.conf 34 | [... snip ...] 35 | 36 | ``` 37 | 38 | `VHOST` can be one of 39 | 40 | * drupal6 41 | * drupal7 42 | * drupal8 43 | * fpm 44 | * html 45 | * laravel 46 | * symfony2-dev (DEVELOPMENT ONLY) 47 | * symfony2-prod 48 | * symfony3-dev (DEVELOPMENT ONLY) 49 | * symfony3-prod 50 | * symfony4 51 | * wordpress 52 | 53 | Visit the Github link above to explore the details of each. If `VHOST` is not defined the image defaults to `fpm`: 54 | 55 | ```shell 56 | docker container run --rm -it \ 57 | jtreminio/php-nginx:7.3 58 | 59 | ** Running /etc/my_init.d/00_regen_ssh_host_keys.sh... 60 | *** Running /etc/my_init.d/10_syslog-ng.init... 61 | Dec 20 03:35:07 4768163b60c4 syslog-ng[13]: syslog-ng starting up; version='3.13.2' 62 | *** Booting runit daemon... 63 | *** Runit started as PID 22 64 | Using /etc/nginx/sites-available/fpm.conf 65 | [... snip ...] 66 | 67 | ``` 68 | 69 | The default FPM vhost config looks like: 70 | 71 | ``` 72 | # /etc/nginx/sites-available/fpm.conf 73 | # Basic FPM 74 | 75 | map $cookie_XDEBUG_SESSION $my_fastcgi_pass { 76 | default 127.0.0.1:9000; 77 | xdebug 127.0.0.1:${phpfpm_xdebug_port}; 78 | } 79 | 80 | server { 81 | listen *:8080 default_server; 82 | 83 | server_name _; 84 | root /var/www; 85 | index index.html index.php; 86 | 87 | location / { 88 | try_files $uri $uri/ /index.php$is_args$args; 89 | } 90 | 91 | location ~ \.php$ { 92 | set $path_info $fastcgi_path_info; 93 | 94 | fastcgi_pass $my_fastcgi_pass; 95 | fastcgi_index index.php; 96 | fastcgi_split_path_info ^(.+\.php)(/.*)$; 97 | 98 | include fastcgi_params; 99 | 100 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 101 | fastcgi_param DOCUMENT_ROOT $realpath_root; 102 | } 103 | } 104 | 105 | ``` 106 | 107 | The expected location of your `index.php` file is at `/var/www/index.php`. 108 | 109 | ### Custom Vhost Config 110 | 111 | You can use your own custom vhost config by writing to file `/etc/nginx/sites-enabled/default`. 112 | 113 | If `/etc/nginx/sites-enabled/default` exists then `VHOST` env var will be ignored. 114 | 115 | If you wish to use the built-in Xdebug support make sure to use the following `map` and `fastcgi_pass` directives, like above: 116 | 117 | ``` 118 | map $cookie_XDEBUG_SESSION $my_fastcgi_pass { 119 | default 127.0.0.1:9000; 120 | xdebug 127.0.0.1:${phpfpm_xdebug_port}; 121 | } 122 | 123 | server { 124 | [...] 125 | 126 | fastcgi_pass $my_fastcgi_pass; 127 | 128 | [...] 129 | } 130 | 131 | ``` 132 | 133 | You can read about this in greater detail at my blog post [All-in-One PHP-FPM + Nginx/Apache Containers](https://jtreminio.com/blog/all-in-one-php-fpm-nginx-apache-containers/). 134 | 135 | #### Built-in Xdebug support 136 | 137 | These images come with Xdebug support but it is **disabled** by default. 138 | 139 | To enabled Xdebug support you must pass environment variable `PHPFPM_XDEBUG=on`. 140 | 141 | A second PHP-FPM instance will be created with Xdebug enabled, listening to port 9999. **The main PHP-FPM instance listening on port 9000 will _not_ have Xdebug enabled!** 142 | 143 | You can debug your applications by [using PhpStorm's bookmarklets](https://www.jetbrains.com/phpstorm/marklets/). The IDE key must be `xdebug`, NOT `PHPSTORM`. 144 | 145 | For more information please refer to my blog post [Developing at Full Speed with Xdebug](https://jtreminio.com/blog/developing-at-full-speed-with-xdebug/), and [All-in-One PHP-FPM + Nginx/Apache Containers](https://jtreminio.com/blog/all-in-one-php-fpm-nginx-apache-containers/). 146 | 147 | Note: If `PHPFPM_XDEBUG` is not set to `on`, the second PHP-FPM instance will NOT be created. 148 | 149 | ### docker-compose 150 | 151 | The following example uses [Traefik](https://hub.docker.com/_/traefik/). First spin up a Traefik container: 152 | 153 | ```shell 154 | docker network create --driver bridge traefik_webgateway 155 | 156 | docker container run -d \ 157 | --name traefik_proxy \ 158 | --network traefik_webgateway \ 159 | --publish 80:80 \ 160 | --publish 8080:8080 \ 161 | --restart always \ 162 | --volume /var/run/docker.sock:/var/run/docker.sock \ 163 | --volume /dev/null:/traefik.toml \ 164 | traefik:1.7 --api --docker \ 165 | --docker.domain=docker.localhost --logLevel=DEBUG 166 | 167 | ``` 168 | 169 | Then create a `docker-compose.yml` that would look like this: 170 | 171 | ```yaml 172 | version: '3.2' 173 | networks: 174 | public: 175 | external: 176 | name: traefik_webgateway 177 | services: 178 | web: 179 | image: jtreminio/php-nginx:8.1 180 | labels: 181 | - traefik.backend=php-nginx 182 | - traefik.docker.network=traefik_webgateway 183 | - traefik.frontend.rule=Host:php-nginx.localhost 184 | - traefik.port=8080 185 | networks: 186 | - public 187 | volumes: 188 | - ${PWD}/index.php:/var/www/index.php 189 | 190 | ``` 191 | 192 | You can pass PHP INI settings like so: 193 | 194 | ```yaml 195 | version: '3.2' 196 | networks: 197 | public: 198 | external: 199 | name: traefik_webgateway 200 | services: 201 | web: 202 | image: jtreminio/php-nginx:8.1 203 | labels: 204 | - traefik.backend=php-nginx 205 | - traefik.docker.network=traefik_webgateway 206 | - traefik.frontend.rule=Host:php-nginx.localhost 207 | - traefik.port=8080 208 | networks: 209 | - public 210 | volumes: 211 | - ${PWD}/index.php:/var/www/index.php 212 | environment: 213 | - PHP.display_errors=On 214 | - PHP.error_reporting=-1 215 | 216 | ``` 217 | 218 | If you want to enable Xdebug support you must also pass `PHPFPM_XDEBUG`: 219 | 220 | ```yaml 221 | version: '3.2' 222 | networks: 223 | public: 224 | external: 225 | name: traefik_webgateway 226 | services: 227 | web: 228 | image: jtreminio/php-nginx:8.1 229 | labels: 230 | - traefik.backend=php-nginx 231 | - traefik.docker.network=traefik_webgateway 232 | - traefik.frontend.rule=Host:php-nginx.localhost 233 | - traefik.port=8080 234 | networks: 235 | - public 236 | volumes: 237 | - ${PWD}/index.php:/var/www/index.php 238 | environment: 239 | - PHP.display_errors=On 240 | - PHP.error_reporting=-1 241 | - PHPFPM_XDEBUG=On 242 | 243 | ``` 244 | 245 | You can easily switch vhost configs by using `VHOST`: 246 | 247 | ```yaml 248 | version: '3.2' 249 | networks: 250 | public: 251 | external: 252 | name: traefik_webgateway 253 | services: 254 | web: 255 | image: jtreminio/php-nginx:8.1 256 | labels: 257 | - traefik.backend=php-nginx 258 | - traefik.docker.network=traefik_webgateway 259 | - traefik.frontend.rule=Host:php-nginx.localhost 260 | - traefik.port=8080 261 | networks: 262 | - public 263 | volumes: 264 | - ${PWD}/index.php:/var/www/index.php 265 | environment: 266 | - PHP.display_errors=On 267 | - PHP.error_reporting=-1 268 | - PHPFPM_XDEBUG=On 269 | - VHOST=symfony2 270 | 271 | ``` 272 | 273 | Or, you can easily use a custom vhost config: 274 | 275 | ```yaml 276 | version: '3.2' 277 | networks: 278 | public: 279 | external: 280 | name: traefik_webgateway 281 | services: 282 | web: 283 | image: jtreminio/php-nginx:8.1 284 | labels: 285 | - traefik.backend=php-nginx 286 | - traefik.docker.network=traefik_webgateway 287 | - traefik.frontend.rule=Host:php-nginx.localhost 288 | - traefik.port=8080 289 | networks: 290 | - public 291 | volumes: 292 | - ${PWD}/index.php:/var/www/index.php 293 | - ${PWD}/vhost.conf:/etc/nginx/sites-enabled/default 294 | environment: 295 | - PHP.display_errors=On 296 | - PHP.error_reporting=-1 297 | - PHPFPM_XDEBUG=On 298 | 299 | ``` 300 | 301 | You would need to create an `index.php` file at the same location as your `docker-compose.yml` file. 302 | 303 | The resulting container would then be available at http://php-nginx.localhost if you are using Chrome, or have installed dnsmasq. 304 | 305 | ## About these images 306 | 307 | These images are built from [jtreminio/php](https://hub.docker.com/r/jtreminio/php/) 308 | 309 | All PHP INI and env var features from those images apply here. 310 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #### Supported tags 2 | 3 | * `jtreminio/php:8.1` 4 | * `jtreminio/php:8.0` 5 | * `jtreminio/php:7.4` 6 | 7 | [All minor version tags can be found here.](https://hub.docker.com/r/jtreminio/php/tags/) 8 | 9 | [Dockerfile can be found here.](https://github.com/jtreminio/php-docker/blob/master/Dockerfile-php-fpm) 10 | 11 | #### [This README best viewed on Github for formatting](https://github.com/jtreminio/php-docker/blob/master/README.md) 12 | 13 | ## How to use this image 14 | 15 | ### With Command Line 16 | 17 | For PHP projects run through the command line interface (CLI), you can do the following. 18 | 19 | #### Create a Dockerfile in your PHP project 20 | 21 | ```dockerfile 22 | FROM jtreminio/php:8.1 23 | COPY . /usr/src/myapp 24 | WORKDIR /usr/src/myapp 25 | CMD [ "php", "./your-script.php" ] 26 | 27 | ``` 28 | 29 | Then, run the commands to build and run the Docker image: 30 | 31 | ```shell 32 | docker build -t my-php-app . 33 | docker run -it --rm --name my-running-app my-php-app 34 | 35 | ``` 36 | 37 | #### Run a single PHP script 38 | For many simple, single file projects, you may find it inconvenient to write a complete `Dockerfile`. In such cases, you can run a PHP script by using the PHP Docker image directly: 39 | 40 | ```shell 41 | docker run -it --rm \ 42 | --name my-running-script \ 43 | -v "$PWD":/usr/src/myapp \ 44 | -w /usr/src/myapp \ 45 | jtreminio/php:8.1 php your-script.php 46 | 47 | ``` 48 | 49 | Note that all variants of the PHP image contain the PHP CLI. 50 | 51 | ## Without PHP-FPM 52 | 53 | I have created images without PHP-FPM (CLI only). 54 | 55 | [Click here for `jtreminio/php-cli`](https://hub.docker.com/r/jtreminio/php-cli). 56 | 57 | ## With Nginx or Apache 58 | 59 | I have created full-featured Nginx/Apache versions of these images. 60 | 61 | [Click here for `jtreminio/php-nginx`](https://hub.docker.com/r/jtreminio/php-nginx). 62 | 63 | [Click here for `jtreminio/php-apache`](https://hub.docker.com/r/jtreminio/php-apache). 64 | 65 | ## About these images 66 | 67 | These images are built from [Ondřej Surý's PPA](https://launchpad.net/~ondrej/+archive/ubuntu/php) 68 | 69 | They come with the most common PHP modules baked in. For a full list please see below. 70 | 71 | `Composer` is installed at `/usr/local/bin/composer` 72 | 73 | PHP-CLI INI and PHP-FPM conf files are saved to standard location across all versions to make managing them simpler. 74 | 75 | * PHP INI used by PHP-FPM is at `/etc/php/fpm.ini` 76 | * PHP INI use by CLI is at `/etc/php/cli.ini` 77 | * PHP-FPM main conf is at `/etc/php/fpm.conf` 78 | 79 | Two blank INI files have been provided for you to write your custom INI settings. 80 | 81 | * /etc/php/cli-custom.ini 82 | * /etc/php/php-custom.ini 83 | 84 | Use `-v your-file.ini:/etc/php/cli-custom.ini` to add your settings. These two files are loaded last so its contents will take precedence over everything else. 85 | 86 | PHP-FPM includes fix for logging to stdout and stderr created by https://github.com/phpdocker-io/base-images 87 | 88 | PHP-FPM listens on port `9000` and is run automatically by runit: 89 | 90 | ```shell 91 | docker container run -it --rm \ 92 | jtreminio/php:8.1 93 | 94 | *** Running /etc/my_init.d/00_regen_ssh_host_keys.sh... 95 | *** Running /etc/my_init.d/10_syslog-ng.init... 96 | Dec 20 03:50:53 14ec8b232a61 syslog-ng[13]: syslog-ng starting up; version='3.13.2' 97 | *** Booting runit daemon... 98 | *** Runit started as PID 22 99 | Dec 20 03:50:54 14ec8b232a61 cron[26]: (CRON) INFO (pidfile fd = 3) 100 | Dec 20 03:50:54 14ec8b232a61 cron[26]: (CRON) INFO (Running @reboot jobs) 101 | [20-Dec-2018 03:50:54] NOTICE: fpm is running, pid 32 102 | [20-Dec-2018 03:50:54] NOTICE: ready to handle connections 103 | [20-Dec-2018 03:50:54] NOTICE: systemd monitor interval set to 10000ms 104 | 105 | ``` 106 | 107 | ## INI Through Environment Variables 108 | 109 | You can set a large number of PHP INI settings using environment variables. 110 | 111 | [A full list of supported directives can be found here](https://github.com/jtreminio/php-docker/blob/master/Dockerfile-env). 112 | 113 | [You can read about this in more detail here](https://jtreminio.com/blog/docker-php/php-fpm-configuration-via-environment-variables/). 114 | 115 | ```shell 116 | docker container run -it --rm \ 117 | jtreminio/php:8.1 php -i | grep display_errors 118 | 119 | 100:display_errors => Off => Off 120 | 121 | ``` 122 | 123 | vs 124 | 125 | ```shell 126 | docker container run -it --rm \ 127 | -e PHP.display_errors=1 \ 128 | jtreminio/php:8.1 php -i | grep display_errors 129 | 130 | 100:display_errors => STDOUT => STDOUT 131 | 132 | ``` 133 | 134 | ## Installed Modules 135 | 136 | Many modules are installed and enabled by default: 137 | 138 | * php-bcmath 139 | * php-cli 140 | * php-curl 141 | * php-fpm 142 | * php-intl 143 | * php-json 144 | * php-mbstring 145 | * php-mysql 146 | * php-opcache 147 | * php-xml 148 | * php-zip 149 | 150 | More modules are installed but _not_ enabled by default: 151 | 152 | * php-amqp 153 | * php-apcu 154 | * php-gd 155 | * php-igbinary 156 | * php-imagick 157 | * php-mailparse 158 | * php-memcached 159 | * php-mongodb 160 | * php-oauth 161 | * php-raphf 162 | * php-redis 163 | * php-soap 164 | * php-solr 165 | * php-sqlite3 166 | * php-uuid 167 | * php-zmq 168 | * php-xdebug 169 | 170 | PHP 7.4 also comes with 171 | 172 | * apcu_bc 173 | * geoip 174 | * gnupg 175 | * radius 176 | * ssh2 177 | * stomp 178 | * uploadprogress 179 | 180 | You can enable these modules by using the `PHP_INI_SCAN_DIR` env var. A special shortcut has been created to more easily add modules: 181 | 182 | ```shell 183 | docker container run -it --rm \ 184 | -e PHP_INI_SCAN_DIR=:/p/amqp:/p/mailparse \ 185 | jtreminio/php:8.1 php -v 186 | 187 | ``` 188 | 189 | The `/p` directory contains symlinks to other directories (if PHP version supports the module) 190 | 191 | ``` 192 | /p/amqp -> /etc/php/extra-mods/amqp 193 | /p/apcu -> /etc/php/extra-mods/apcu 194 | /p/geoip -> /etc/php/extra-mods/geoip 195 | /p/gnupg -> /etc/php/extra-mods/gnupg 196 | /p/imagick -> /etc/php/extra-mods/imagick 197 | /p/lua -> /etc/php/extra-mods/lua 198 | /p/mailparse -> /etc/php/extra-mods/mailparse 199 | /p/memcached -> /etc/php/extra-mods/memcached 200 | /p/mongodb -> /etc/php/extra-mods/mongodb 201 | /p/oauth -> /etc/php/extra-mods/oauth 202 | /p/pdo_sqlite -> /etc/php/extra-mods/pdo_sqlite 203 | /p/radius -> /etc/php/extra-mods/radius 204 | /p/raphf -> /etc/php/extra-mods/raphf 205 | /p/redis -> /etc/php/extra-mods/redis 206 | /p/solr -> /etc/php/extra-mods/solr 207 | /p/sqlite3 -> /etc/php/extra-mods/sqlite3 208 | /p/ssh2 -> /etc/php/extra-mods/ssh2 209 | /p/stomp -> /etc/php/extra-mods/stomp 210 | /p/uploadprogress -> /etc/php/extra-mods/uploadprogress 211 | /p/uuid -> /etc/php/extra-mods/uuid 212 | /p/xdebug -> /etc/php/extra-mods/xdebug 213 | /p/zmq -> /etc/php/extra-mods/zmq 214 | 215 | ``` 216 | 217 | You can add as many of these as you want to `PHP_INI_SCAN_DIR`, make sure to prepend `:`. 218 | 219 | You can read about this in greater detail by going to [PHP Modules Toggled via Environment Variables](https://jtreminio.com/blog/php-modules-toggled-via-environment-variables/). 220 | 221 | ## Xdebug 222 | 223 | Xdebug is _installed_ but _disabled_ by default: 224 | 225 | ```shell 226 | docker container run -it --rm jtreminio/php:7.2 php -v 227 | 228 | PHP 8.1.2 (cli) (built: Jan 24 2022 10:42:15) (NTS) 229 | Copyright (c) The PHP Group 230 | Zend Engine v4.1.2, Copyright (c) Zend Technologies 231 | with Zend OPcache v8.1.2, Copyright (c), by Zend Technologies 232 | 233 | ``` 234 | 235 | To enable Xdebug (ONLY on non-public servers!) you may use the `PHP_INI_SCAN_DIR` env var: 236 | 237 | ```shell 238 | docker container run -it --rm \ 239 | -e PHP_INI_SCAN_DIR=:/p/xdebug \ 240 | jtreminio/php:8.1 php -v 241 | 242 | PHP 8.1.2 (cli) (built: Jan 24 2022 10:42:15) (NTS) 243 | Copyright (c) The PHP Group 244 | Zend Engine v4.1.2, Copyright (c) Zend Technologies 245 | with Zend OPcache v8.1.2, Copyright (c), by Zend Technologies 246 | with Xdebug v3.1.2, Copyright (c) 2002-2021, by Derick Rethans 247 | 248 | ``` 249 | 250 | Note the prepended `:` in `:/p/xdebug`. 251 | 252 | `xdebug.remote_host` is set to `host.docker.internal` by default. [This will not work in Linux (yet)](https://github.com/docker/for-linux/issues/264). 253 | You must either pass your host IP directly, or use a gateway. I have found `172.17.0.1` to work in most cases: 254 | 255 | ```shell 256 | docker container run -it --rm \ 257 | -e PHP_INI_SCAN_DIR=:/p/xdebug \ 258 | -e PHP.xdebug.client_host=172.17.0.1 \ 259 | jtreminio/php:8.1 php -i | grep xdebug.client_host 260 | 261 | 639:xdebug.client_host => 172.17.0.1 => 172.17.0.1 262 | 263 | ``` 264 | 265 | A helper script has been created at `/usr/bin/xdebug` to help you debug CLI applications. 266 | 267 | To use it, call it instead of `php` directly: 268 | 269 | ```shell 270 | docker container run -it --rm \ 271 | jtreminio/php:8.1 xdebug -v 272 | 273 | PHP 8.1.2 (cli) (built: Jan 24 2022 10:42:15) (NTS) 274 | Copyright (c) The PHP Group 275 | Zend Engine v4.1.2, Copyright (c) Zend Technologies 276 | with Zend OPcache v8.1.2, Copyright (c), by Zend Technologies 277 | with Xdebug v3.1.2, Copyright (c) 2002-2021, by Derick Rethans 278 | 279 | ``` 280 | -------------------------------------------------------------------------------- /build: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 4 | BUILD_TYPE="all" 5 | RUN_TESTS="no" 6 | 7 | function show_help() { 8 | cat << EOF 9 | 10 | Usage: build [OPTION] 11 | Builds CLI, FPM, Apache and Nginx images for PHP 12 | 13 | -v full version, 7.4.13 or 7.3.25 or 7.2.34, etc 14 | if -b=env this flag is not accepted 15 | -b build type, "all", "env", "cli", "fpm", "apache", "nginx" 16 | defaults to "all" 17 | -p push image(s) to docker hub 18 | -t run tests after build 19 | defaults to "no" 20 | -h display this help and exit 21 | 22 | Example: build -v 8.1.0 -b all -p yes 23 | Builds these images - jtreminio:php-cli 24 | - jtreminio:php 25 | - jtreminio:php-apache 26 | - jtreminio:php-nginx 27 | EOF 28 | 29 | exit 0 30 | } 31 | 32 | while getopts ":v:b:p:t:h" opt; do 33 | case $opt in 34 | v) PHP_VERSION="$OPTARG" 35 | ;; 36 | b) BUILD_TYPE="$OPTARG" 37 | ;; 38 | p) PUSH_TO_HUB="$OPTARG" 39 | ;; 40 | t) RUN_TESTS="$OPTARG" 41 | ;; 42 | h) show_help 43 | ;; 44 | \?) echo "Invalid option -$OPTARG" >&2 45 | ;; 46 | esac 47 | done 48 | 49 | if [[ "${BUILD_TYPE}" != "all" && 50 | "${BUILD_TYPE}" != "env" && 51 | "${BUILD_TYPE}" != "cli" && 52 | "${BUILD_TYPE}" != "fpm" && 53 | "${BUILD_TYPE}" != "apache" && 54 | "${BUILD_TYPE}" != "nginx" 55 | ]]; then 56 | printf "invalid build (-b) value: ${BUILD_TYPE}\n" 57 | show_help 58 | exit 1 59 | fi 60 | 61 | if [[ "${PUSH_TO_HUB}" != "yes" && 62 | "${PUSH_TO_HUB}" != "no" 63 | ]]; then 64 | printf "invalid push to hub (-p) value: ${PUSH_TO_HUB}\n" 65 | show_help 66 | exit 1 67 | fi 68 | 69 | if [[ "${RUN_TESTS}" != "yes" && 70 | "${RUN_TESTS}" != "no" 71 | ]]; then 72 | printf "invalid run tests (-t) value: ${RUN_TESTS}\n" 73 | show_help 74 | exit 1 75 | fi 76 | 77 | if [[ ${BUILD_TYPE} == "env" ]] && ! [[ -z ${PHP_VERSION} ]]; then 78 | printf "version (-v) flag not accepted when -b=env\n" 79 | show_help 80 | exit 1 81 | fi 82 | 83 | if [[ ${BUILD_TYPE} != "env" ]] && [[ -z ${PHP_VERSION} ]]; then 84 | printf "invalid version (-v) value: ${PHP_VERSION}\n" 85 | show_help 86 | exit 1 87 | fi 88 | 89 | if [[ ${BUILD_TYPE} != "env" ]]; then 90 | # 7.4.13 -> 7.4 91 | PHP_MAJOR=$(echo ${PHP_VERSION} | cut -d . -f -2) 92 | 93 | if [[ "${PHP_VERSION// }" == "${PHP_MAJOR// }" ]]; then 94 | printf "PHP_VERSION must be in 7.4.0 format" 95 | exit 1 96 | fi 97 | 98 | REGEXP="([0-9]{1}\.)+([0-9]{1}\.)+([0-9]{1,2})" 99 | if ! [[ ${PHP_VERSION} =~ ${REGEXP} ]]; then 100 | printf "PHP_VERSION must be in 7.4.0 format" 101 | exit 1 102 | fi 103 | fi 104 | 105 | function main() { 106 | if [[ ${BUILD_TYPE} == "env" ]]; then 107 | build_env_image 108 | 109 | if [[ ${PUSH_TO_HUB} == "yes" ]]; then 110 | docker image push jtreminio/phpenv:latest 111 | fi 112 | exit 0 113 | fi 114 | 115 | case ${BUILD_TYPE} in 116 | cli) 117 | build_php_cli_image ${PHP_MAJOR} ${PHP_VERSION} 118 | ;; 119 | fpm) 120 | build_php_fpm_image ${PHP_MAJOR} ${PHP_VERSION} 121 | ;; 122 | apache) 123 | build_apache_image ${PHP_MAJOR} ${PHP_VERSION} 124 | ;; 125 | nginx) 126 | build_nginx_image ${PHP_MAJOR} ${PHP_VERSION} 127 | ;; 128 | *) 129 | build_php_cli_image ${PHP_MAJOR} ${PHP_VERSION} 130 | build_php_fpm_image ${PHP_MAJOR} ${PHP_VERSION} 131 | build_apache_image ${PHP_MAJOR} ${PHP_VERSION} 132 | build_nginx_image ${PHP_MAJOR} ${PHP_VERSION} 133 | ;; 134 | esac 135 | 136 | if [[ ${RUN_TESTS} == "yes" ]]; then 137 | bash "${DIR}/test" ${PHP_VERSION} 138 | fi 139 | 140 | if [[ $? -ne 0 ]]; then 141 | exit 1 142 | fi 143 | 144 | if [[ "${PUSH_TO_HUB}" == "yes" ]]; then 145 | case ${BUILD_TYPE} in 146 | cli) 147 | docker image push jtreminio/php-cli:${PHP_MAJOR} 148 | docker image push jtreminio/php-cli:${PHP_VERSION} 149 | ;; 150 | fpm) 151 | docker image push jtreminio/php:${PHP_MAJOR} 152 | docker image push jtreminio/php:${PHP_VERSION} 153 | ;; 154 | apache) 155 | docker image push jtreminio/php-apache:${PHP_MAJOR} 156 | docker image push jtreminio/php-apache:${PHP_VERSION} 157 | ;; 158 | nginx) 159 | docker image push jtreminio/php-nginx:${PHP_MAJOR} 160 | docker image push jtreminio/php-nginx:${PHP_VERSION} 161 | ;; 162 | *) 163 | docker image push jtreminio/php-cli:${PHP_MAJOR} 164 | docker image push jtreminio/php-cli:${PHP_VERSION} 165 | docker image push jtreminio/php:${PHP_MAJOR} 166 | docker image push jtreminio/php:${PHP_VERSION} 167 | docker image push jtreminio/php-apache:${PHP_MAJOR} 168 | docker image push jtreminio/php-apache:${PHP_VERSION} 169 | docker image push jtreminio/php-nginx:${PHP_MAJOR} 170 | docker image push jtreminio/php-nginx:${PHP_VERSION} 171 | ;; 172 | esac 173 | fi 174 | } 175 | 176 | function build_env_image() { 177 | echo "Building ENV" 178 | docker image build \ 179 | -t jtreminio/phpenv:latest \ 180 | -f Dockerfile-env \ 181 | . 182 | 183 | if [[ $? -ne 0 ]]; then 184 | echo "Error encountered" 185 | exit 1 186 | fi 187 | } 188 | 189 | function build_php_cli_image() { 190 | PHP_MAJOR="${1}" 191 | PHP_MINOR="${2}" 192 | 193 | echo "Building PHP-CLI ${PHP_MINOR}" 194 | docker image build \ 195 | --build-arg PHP_VER=${PHP_MAJOR} \ 196 | --build-arg PHP_VER_DOT=${PHP_MINOR} \ 197 | -t jtreminio/php-cli:${PHP_MAJOR} \ 198 | -t jtreminio/php-cli:${PHP_MINOR} \ 199 | -f Dockerfile-php-cli \ 200 | . 201 | 202 | if [[ $? -ne 0 ]]; then 203 | echo "Error encountered" 204 | exit 1 205 | fi 206 | } 207 | 208 | function build_php_fpm_image() { 209 | PHP_MAJOR="${1}" 210 | PHP_MINOR="${2}" 211 | 212 | echo "Building PHP-CLI + PHP-FPM ${PHP_MINOR}" 213 | docker image build \ 214 | --build-arg PHP_VER=${PHP_MAJOR} \ 215 | --build-arg PHP_VER_DOT=${PHP_MINOR} \ 216 | -t jtreminio/php:${PHP_MAJOR} \ 217 | -t jtreminio/php:${PHP_MINOR} \ 218 | -f Dockerfile-php-fpm \ 219 | . 220 | 221 | if [[ $? -ne 0 ]]; then 222 | echo "Error encountered" 223 | exit 1 224 | fi 225 | } 226 | 227 | function build_apache_image() { 228 | PHP_MAJOR="${1}" 229 | PHP_MINOR="${2}" 230 | 231 | echo "Building PHP ${PHP_MAJOR} + Apache" 232 | docker image build \ 233 | --build-arg PHP_VER_DOT=${PHP_MINOR} \ 234 | -t jtreminio/php-apache:${PHP_MAJOR} \ 235 | -t jtreminio/php-apache:${PHP_MINOR} \ 236 | -f Dockerfile-apache \ 237 | . 238 | 239 | if [[ $? -ne 0 ]]; then 240 | echo "Error encountered" 241 | exit 1 242 | fi 243 | } 244 | 245 | function build_nginx_image() { 246 | PHP_MAJOR="${1}" 247 | PHP_MINOR="${2}" 248 | 249 | echo "Building PHP ${PHP_MAJOR} + Nginx" 250 | docker image build \ 251 | --build-arg PHP_VER_DOT=${PHP_MINOR} \ 252 | -t jtreminio/php-nginx:${PHP_MAJOR} \ 253 | -t jtreminio/php-nginx:${PHP_MINOR} \ 254 | -f Dockerfile-nginx \ 255 | . 256 | 257 | if [[ $? -ne 0 ]]; then 258 | echo "Error encountered" 259 | exit 1 260 | fi 261 | } 262 | 263 | main 264 | -------------------------------------------------------------------------------- /files/apache/apache: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # env PHPFPM_XDEBUG must be "On" or "on" to enable Xdebug support 4 | # Otherwise this is strictly disabled by default 5 | PHPFPM_XDEBUG=${PHPFPM_XDEBUG:-""} 6 | if [[ "${PHPFPM_XDEBUG,,}" = "on" ]]; then 7 | PHPFPM_XDEBUG_PORT=9999 8 | else 9 | PHPFPM_XDEBUG_PORT=9000 10 | fi 11 | 12 | export PHPFPM_XDEBUG_PORT 13 | 14 | # If default vhost file does not exist, use env var VHOST to choose 15 | if [[ ! -f /etc/apache2/sites-enabled/default.conf ]]; then 16 | VHOST=${VHOST:-"fpm"} 17 | if [[ ${VHOST} != *".conf"* ]]; then 18 | VHOST=${VHOST}.conf 19 | fi 20 | 21 | echo Using /etc/apache2/sites-available/${VHOST} 22 | 23 | ln -s /etc/apache2/sites-available/${VHOST} /etc/apache2/sites-enabled/default.conf 24 | fi 25 | 26 | exec /usr/sbin/apache2ctl -D FOREGROUND 27 | -------------------------------------------------------------------------------- /files/apache/ports.conf: -------------------------------------------------------------------------------- 1 | # /etc/apache2/ports.conf 2 | 3 | ServerName localhost 4 | 5 | Listen 8080 6 | -------------------------------------------------------------------------------- /files/apache/vhost/drupal.conf: -------------------------------------------------------------------------------- 1 | # /etc/apache2/sites-available/drupal.conf 2 | # Drupal 3 | 4 | 5 | ServerName default.localhost 6 | ServerAlias * 7 | 8 | 9 | 10 | SetHandler proxy:fcgi://127.0.0.1:${PHPFPM_XDEBUG_PORT} 11 | 12 | 13 | SetHandler proxy:fcgi://127.0.0.1:9000 14 | 15 | 16 | 17 | DocumentRoot /var/www 18 | 19 | # enable the .htaccess rewrites 20 | AllowOverride All 21 | Require all granted 22 | 23 | 24 | ErrorLog "/dev/stderr" 25 | CustomLog "/dev/stdout" combined 26 | LogLevel warn 27 | ServerSignature Off 28 | SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1 29 | 30 | -------------------------------------------------------------------------------- /files/apache/vhost/fpm.conf: -------------------------------------------------------------------------------- 1 | # /etc/apache2/sites-available/fpm.conf 2 | # Basic FPM 3 | 4 | 5 | ServerName default.localhost 6 | ServerAlias * 7 | 8 | DocumentRoot /var/www 9 | 10 | 11 | 12 | SetHandler proxy:fcgi://127.0.0.1:${PHPFPM_XDEBUG_PORT} 13 | 14 | 15 | SetHandler proxy:fcgi://127.0.0.1:9000 16 | 17 | 18 | 19 | 20 | Options Indexes FollowSymlinks MultiViews 21 | AllowOverride All 22 | Require all granted 23 | DirectoryIndex index.html index.php 24 | 25 | 26 | ErrorLog "/dev/stderr" 27 | CustomLog "/dev/stdout" combined 28 | LogLevel warn 29 | ServerSignature Off 30 | SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1 31 | 32 | -------------------------------------------------------------------------------- /files/apache/vhost/html.conf: -------------------------------------------------------------------------------- 1 | # /etc/apache2/sites-available/html.conf 2 | # Basic HTML 3 | 4 | 5 | ServerName default.localhost 6 | ServerAlias * 7 | 8 | DocumentRoot /var/www 9 | 10 | 11 | Options Indexes FollowSymlinks MultiViews 12 | AllowOverride All 13 | Require all granted 14 | DirectoryIndex index.html 15 | 16 | 17 | ErrorLog "/dev/stderr" 18 | CustomLog "/dev/stdout" combined 19 | LogLevel warn 20 | ServerSignature Off 21 | SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1 22 | 23 | -------------------------------------------------------------------------------- /files/apache/vhost/laravel.conf: -------------------------------------------------------------------------------- 1 | # /etc/apache2/sites-available/laravel.conf 2 | # Laravel 3 | 4 | 5 | ServerName default.localhost 6 | ServerAlias * 7 | 8 | 9 | 10 | SetHandler proxy:fcgi://127.0.0.1:${PHPFPM_XDEBUG_PORT} 11 | 12 | 13 | SetHandler proxy:fcgi://127.0.0.1:9000 14 | 15 | 16 | 17 | DocumentRoot /var/www/public 18 | 19 | # enable the .htaccess rewrites 20 | AllowOverride All 21 | Require all granted 22 | 23 | 24 | 25 | Options FollowSymlinks 26 | 27 | 28 | ErrorLog "/dev/stderr" 29 | CustomLog "/dev/stdout" combined 30 | LogLevel warn 31 | ServerSignature Off 32 | SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1 33 | 34 | -------------------------------------------------------------------------------- /files/apache/vhost/symfony2.conf: -------------------------------------------------------------------------------- 1 | # /etc/apache2/sites-available/symfony2.conf 2 | # Symfony 2 3 | 4 | 5 | ServerName default.localhost 6 | ServerAlias * 7 | 8 | 9 | 10 | SetHandler proxy:fcgi://127.0.0.1:${PHPFPM_XDEBUG_PORT} 11 | 12 | 13 | SetHandler proxy:fcgi://127.0.0.1:9000 14 | 15 | 16 | 17 | DocumentRoot /var/www/web 18 | 19 | # enable the .htaccess rewrites 20 | AllowOverride All 21 | Require all granted 22 | 23 | 24 | 25 | Options FollowSymlinks 26 | 27 | 28 | ErrorLog "/dev/stderr" 29 | CustomLog "/dev/stdout" combined 30 | LogLevel warn 31 | ServerSignature Off 32 | SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1 33 | 34 | -------------------------------------------------------------------------------- /files/apache/vhost/symfony3.conf: -------------------------------------------------------------------------------- 1 | # /etc/apache2/sites-available/symfony3.conf 2 | # Symfony 3 3 | 4 | 5 | ServerName default.localhost 6 | ServerAlias * 7 | 8 | 9 | 10 | SetHandler proxy:fcgi://127.0.0.1:${PHPFPM_XDEBUG_PORT} 11 | 12 | 13 | SetHandler proxy:fcgi://127.0.0.1:9000 14 | 15 | 16 | 17 | DocumentRoot /var/www/web 18 | 19 | # enable the .htaccess rewrites 20 | AllowOverride All 21 | Require all granted 22 | 23 | 24 | 25 | Options FollowSymlinks 26 | 27 | 28 | ErrorLog "/dev/stderr" 29 | CustomLog "/dev/stdout" combined 30 | LogLevel warn 31 | ServerSignature Off 32 | SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1 33 | 34 | -------------------------------------------------------------------------------- /files/apache/vhost/symfony4.conf: -------------------------------------------------------------------------------- 1 | # /etc/apache2/sites-available/symfony4.conf 2 | # Symfony 4 3 | 4 | 5 | ServerName default.localhost 6 | ServerAlias * 7 | 8 | 9 | 10 | SetHandler proxy:fcgi://127.0.0.1:${PHPFPM_XDEBUG_PORT} 11 | 12 | 13 | SetHandler proxy:fcgi://127.0.0.1:9000 14 | 15 | 16 | 17 | DocumentRoot /var/www/public 18 | 19 | # enable the .htaccess rewrites 20 | AllowOverride All 21 | Require all granted 22 | 23 | 24 | 25 | Options FollowSymlinks 26 | 27 | 28 | ErrorLog "/dev/stderr" 29 | CustomLog "/dev/stdout" combined 30 | LogLevel warn 31 | ServerSignature Off 32 | SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1 33 | 34 | -------------------------------------------------------------------------------- /files/apache/vhost/wordpress.conf: -------------------------------------------------------------------------------- 1 | # /etc/apache2/sites-available/wordpress.conf 2 | # Wordpress 3 | 4 | 5 | ServerName default.localhost 6 | ServerAlias * 7 | 8 | 9 | 10 | SetHandler proxy:fcgi://127.0.0.1:${PHPFPM_XDEBUG_PORT} 11 | 12 | 13 | SetHandler proxy:fcgi://127.0.0.1:9000 14 | 15 | 16 | 17 | DocumentRoot /var/www 18 | 19 | # enable the .htaccess rewrites 20 | AllowOverride All 21 | Require all granted 22 | 23 | 24 | ErrorLog "/dev/stderr" 25 | CustomLog "/dev/stdout" combined 26 | LogLevel warn 27 | ServerSignature Off 28 | SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1 29 | 30 | -------------------------------------------------------------------------------- /files/base_packages.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | set -x 5 | 6 | cat > /root/ondrej.pgp << EOF 7 | -----BEGIN PGP PUBLIC KEY BLOCK----- 8 | Version: SKS 1.1.6 9 | Comment: Hostname: keyserver.ubuntu.com 10 | 11 | mI0ESX35nAEEALKDCUDVXvmW9n+T/+3G1DnTpoWh9/1xNaz/RrUH6fQKhHr568F8hfnZP/2C 12 | GYVYkW9hxP9LVW9IDvzcmnhgIwK+ddeaPZqh3T/FM4OTA7Q78HSvR81mJpf2iMLm/Zvh89Zs 13 | mP2sIgZuARiaHo8lxoTSLtmKXsM3FsJVlusyewHfABEBAAG0H0xhdW5jaHBhZCBQUEEgZm9y 14 | IE9uZMWZZWogU3Vyw72ItgQTAQIAIAUCSX35nAIbAwYLCQgHAwIEFQIIAwQWAgMBAh4BAheA 15 | AAoJEE9OoKrlJnpsQjYD/jW1NlIFAlT6EvF2xfVbkhERii9MapjaUsSso4XLCEmZdEGX54GQ 16 | 01svXnrivwnd/kmhKvyxCqiNLDY/dOaK8MK//bDI6mqdKmG8XbP2vsdsxhifNC+GH/OwaDPv 17 | n1TyYB653kwyruCGFjEnCreZTcRUu2oBQyolORDl+BmF4DjL 18 | =R5tk 19 | -----END PGP PUBLIC KEY BLOCK----- 20 | EOF 21 | 22 | # install base requirements 23 | apt-get update &&\ 24 | apt-get install --no-install-recommends --no-install-suggests -y \ 25 | ca-certificates\ 26 | curl \ 27 | git \ 28 | gnupg \ 29 | unzip \ 30 | zip &&\ 31 | cat /root/ondrej.pgp | apt-key add &&\ 32 | printf "deb [arch=amd64] http://ppa.launchpad.net/ondrej/php/ubuntu bionic main\n" \ 33 | >/etc/apt/sources.list.d/ondrej.list &&\ 34 | rm -f /root/ondrej.pgp &&\ 35 | apt-get update &&\ 36 | apt-get -y --purge autoremove &&\ 37 | rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/{man,doc} 38 | -------------------------------------------------------------------------------- /files/nginx/nginx: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # env PHPFPM_XDEBUG must be "On" or "on" to enable Xdebug support 4 | # Otherwise this is strictly disabled by default 5 | PHPFPM_XDEBUG=${PHPFPM_XDEBUG:-""} 6 | if [[ "${PHPFPM_XDEBUG,,}" = "on" ]]; then 7 | PHPFPM_XDEBUG_PORT=9999 8 | else 9 | PHPFPM_XDEBUG_PORT=9000 10 | fi 11 | 12 | # If default vhost file does not exist, use env var VHOST to choose 13 | if [[ ! -f /etc/nginx/sites-enabled/default ]]; then 14 | VHOST=${VHOST:-"fpm"} 15 | if [[ ${VHOST} != *".conf"* ]]; then 16 | VHOST=${VHOST}.conf 17 | fi 18 | 19 | echo Using /etc/nginx/sites-available/${VHOST} 20 | 21 | ln -s /etc/nginx/sites-available/${VHOST} /etc/nginx/sites-enabled/default 22 | fi 23 | 24 | exec nginx -g "daemon off; env PHPFPM_XDEBUG_PORT=${PHPFPM_XDEBUG_PORT};" 25 | -------------------------------------------------------------------------------- /files/nginx/nginx.conf: -------------------------------------------------------------------------------- 1 | # /etc/nginx/nginx.conf 2 | 3 | user www-data; 4 | 5 | worker_processes auto; 6 | pid /var/run/nginx/nginx.pid; 7 | include /etc/nginx/modules-enabled/*.conf; 8 | 9 | error_log /dev/stderr warn; 10 | 11 | events { 12 | worker_connections 768; 13 | } 14 | 15 | http { 16 | sendfile on; 17 | tcp_nopush on; 18 | tcp_nodelay on; 19 | keepalive_timeout 65; 20 | types_hash_max_size 2048; 21 | 22 | include /etc/nginx/mime.types; 23 | default_type application/octet-stream; 24 | 25 | ssl_protocols TLSv1 TLSv1.1 TLSv1.2; 26 | ssl_prefer_server_ciphers on; 27 | 28 | access_log /dev/stdout; 29 | 30 | gzip on; 31 | gzip_disable "msie6"; 32 | 33 | client_max_body_size 10m; 34 | client_body_buffer_size 128k; 35 | 36 | proxy_redirect off; 37 | proxy_connect_timeout 600s; 38 | proxy_send_timeout 600s; 39 | proxy_read_timeout 600s; 40 | proxy_buffers 4 256k; 41 | proxy_buffer_size 128k; 42 | proxy_http_version 1.0; 43 | proxy_set_header Host $host; 44 | proxy_set_header X-Real-IP $remote_addr; 45 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 46 | proxy_headers_hash_bucket_size 64; 47 | 48 | # Default to NOT using Xdebug, falling back to standard :9000 for PHP-FPM 49 | perl_set $phpfpm_xdebug_port 'sub { return $ENV{"PHPFPM_XDEBUG_PORT"}; }'; 50 | 51 | include /etc/nginx/sites-enabled/default; 52 | } 53 | -------------------------------------------------------------------------------- /files/nginx/vhost/drupal6.conf: -------------------------------------------------------------------------------- 1 | # /etc/nginx/sites-available/drupal6.conf 2 | # Drupal 6 3 | 4 | map $cookie_XDEBUG_SESSION $my_fastcgi_pass { 5 | default 127.0.0.1:9000; 6 | xdebug 127.0.0.1:${phpfpm_xdebug_port}; 7 | } 8 | 9 | server { 10 | listen *:8080 default_server; 11 | 12 | server_name _; 13 | root /var/www; 14 | index index.php; 15 | 16 | location = /favicon.ico { 17 | log_not_found off; 18 | access_log off; 19 | } 20 | 21 | location = /robots.txt { 22 | allow all; 23 | log_not_found off; 24 | access_log off; 25 | } 26 | 27 | # Very rarely should these ever be accessed outside of your lan 28 | location ~* \.(txt|log)$ { 29 | allow 192.168.0.0/16; 30 | deny all; 31 | } 32 | 33 | location ~ \..*/.*\.php$ { 34 | return 403; 35 | } 36 | 37 | location ~ ^/sites/.*/private/ { 38 | return 403; 39 | } 40 | 41 | # Block access to scripts in site files directory 42 | location ~ ^/sites/[^/]+/files/.*\.php$ { 43 | deny all; 44 | } 45 | 46 | # Allow "Well-Known URIs" as per RFC 5785 47 | location ~* ^/.well-known/ { 48 | allow all; 49 | } 50 | 51 | # Block access to "hidden" files and directories whose names begin with a 52 | # period. This includes directories used by version control systems such 53 | # as Subversion or Git to store control files. 54 | location ~ (^|/)\. { 55 | return 403; 56 | } 57 | 58 | location / { 59 | try_files $uri @rewrite; # For Drupal <= 6 60 | # try_files $uri /index.php?$query_string; # For Drupal >= 7 61 | } 62 | 63 | location @rewrite { 64 | rewrite ^/(.*)$ /index.php?q=$1; 65 | } 66 | 67 | # Don't allow direct access to PHP files in the vendor directory. 68 | location ~ /vendor/.*\.php$ { 69 | deny all; 70 | return 404; 71 | } 72 | 73 | # In Drupal 8, we must also match new paths where the '.php' appears in 74 | # the middle, such as update.php/selection. The rule we use is strict, 75 | # and only allows this pattern with the update.php front controller. 76 | # This allows legacy path aliases in the form of 77 | # blog/index.php/legacy-path to continue to route to Drupal nodes. If 78 | # you do not have any paths like that, then you might prefer to use a 79 | # laxer rule, such as: 80 | # location ~ \.php(/|$) { 81 | # The laxer rule will continue to work if Drupal uses this new URL 82 | # pattern with front controllers other than update.php in a future 83 | # release. 84 | location ~ '\.php$|^/update.php' { 85 | fastcgi_split_path_info ^(.+?\.php)(|/.*)$; 86 | # Security note: If you're running a version of PHP older than the 87 | # latest 5.3, you should have "cgi.fix_pathinfo = 0;" in php.ini. 88 | # See http://serverfault.com/q/627903/94922 for details. 89 | include fastcgi_params; 90 | # Block httpoxy attacks. See https://httpoxy.org/. 91 | fastcgi_param HTTP_PROXY ""; 92 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 93 | fastcgi_param PATH_INFO $fastcgi_path_info; 94 | fastcgi_param QUERY_STRING $query_string; 95 | fastcgi_intercept_errors on; 96 | 97 | fastcgi_pass $my_fastcgi_pass; 98 | } 99 | 100 | # Fighting with Styles? This little gem is amazing. 101 | location ~ ^/sites/.*/files/imagecache/ { # For Drupal <= 6 102 | # location ~ ^/sites/.*/files/styles/ { # For Drupal >= 7 103 | try_files $uri @rewrite; 104 | } 105 | 106 | # Handle private files through Drupal. Private file's path can come 107 | # with a language prefix. 108 | location ~ ^(/[a-z\-]+)?/system/files/ { # For Drupal >= 7 109 | try_files $uri /index.php?$query_string; 110 | } 111 | 112 | location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ { 113 | try_files $uri @rewrite; 114 | expires max; 115 | log_not_found off; 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /files/nginx/vhost/drupal7.conf: -------------------------------------------------------------------------------- 1 | # /etc/nginx/sites-available/drupal7.conf 2 | # Drupal 7 3 | 4 | map $cookie_XDEBUG_SESSION $my_fastcgi_pass { 5 | default 127.0.0.1:9000; 6 | xdebug 127.0.0.1:${phpfpm_xdebug_port}; 7 | } 8 | 9 | server { 10 | listen *:8080 default_server; 11 | 12 | server_name _; 13 | root /var/www; 14 | index index.php; 15 | 16 | location = /favicon.ico { 17 | log_not_found off; 18 | access_log off; 19 | } 20 | 21 | location = /robots.txt { 22 | allow all; 23 | log_not_found off; 24 | access_log off; 25 | } 26 | 27 | # Very rarely should these ever be accessed outside of your lan 28 | location ~* \.(txt|log)$ { 29 | allow 192.168.0.0/16; 30 | deny all; 31 | } 32 | 33 | location ~ \..*/.*\.php$ { 34 | return 403; 35 | } 36 | 37 | location ~ ^/sites/.*/private/ { 38 | return 403; 39 | } 40 | 41 | # Block access to scripts in site files directory 42 | location ~ ^/sites/[^/]+/files/.*\.php$ { 43 | deny all; 44 | } 45 | 46 | # Allow "Well-Known URIs" as per RFC 5785 47 | location ~* ^/.well-known/ { 48 | allow all; 49 | } 50 | 51 | # Block access to "hidden" files and directories whose names begin with a 52 | # period. This includes directories used by version control systems such 53 | # as Subversion or Git to store control files. 54 | location ~ (^|/)\. { 55 | return 403; 56 | } 57 | 58 | location / { 59 | # try_files $uri @rewrite; # For Drupal <= 6 60 | try_files $uri /index.php?$query_string; # For Drupal >= 7 61 | } 62 | 63 | location @rewrite { 64 | rewrite ^/(.*)$ /index.php?q=$1; 65 | } 66 | 67 | # Don't allow direct access to PHP files in the vendor directory. 68 | location ~ /vendor/.*\.php$ { 69 | deny all; 70 | return 404; 71 | } 72 | 73 | # In Drupal 8, we must also match new paths where the '.php' appears in 74 | # the middle, such as update.php/selection. The rule we use is strict, 75 | # and only allows this pattern with the update.php front controller. 76 | # This allows legacy path aliases in the form of 77 | # blog/index.php/legacy-path to continue to route to Drupal nodes. If 78 | # you do not have any paths like that, then you might prefer to use a 79 | # laxer rule, such as: 80 | # location ~ \.php(/|$) { 81 | # The laxer rule will continue to work if Drupal uses this new URL 82 | # pattern with front controllers other than update.php in a future 83 | # release. 84 | location ~ '\.php$|^/update.php' { 85 | fastcgi_split_path_info ^(.+?\.php)(|/.*)$; 86 | # Security note: If you're running a version of PHP older than the 87 | # latest 5.3, you should have "cgi.fix_pathinfo = 0;" in php.ini. 88 | # See http://serverfault.com/q/627903/94922 for details. 89 | include fastcgi_params; 90 | # Block httpoxy attacks. See https://httpoxy.org/. 91 | fastcgi_param HTTP_PROXY ""; 92 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 93 | fastcgi_param PATH_INFO $fastcgi_path_info; 94 | fastcgi_param QUERY_STRING $query_string; 95 | fastcgi_intercept_errors on; 96 | 97 | fastcgi_pass $my_fastcgi_pass; 98 | } 99 | 100 | # Fighting with Styles? This little gem is amazing. 101 | # location ~ ^/sites/.*/files/imagecache/ { # For Drupal <= 6 102 | location ~ ^/sites/.*/files/styles/ { # For Drupal >= 7 103 | try_files $uri @rewrite; 104 | } 105 | 106 | # Handle private files through Drupal. Private file's path can come 107 | # with a language prefix. 108 | location ~ ^(/[a-z\-]+)?/system/files/ { # For Drupal >= 7 109 | try_files $uri /index.php?$query_string; 110 | } 111 | 112 | location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ { 113 | try_files $uri @rewrite; 114 | expires max; 115 | log_not_found off; 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /files/nginx/vhost/drupal8.conf: -------------------------------------------------------------------------------- 1 | # /etc/nginx/sites-available/drupal8.conf 2 | # Drupal 8 3 | 4 | map $cookie_XDEBUG_SESSION $my_fastcgi_pass { 5 | default 127.0.0.1:9000; 6 | xdebug 127.0.0.1:${phpfpm_xdebug_port}; 7 | } 8 | 9 | server { 10 | listen *:8080 default_server; 11 | 12 | server_name _; 13 | root /var/www; 14 | index index.php; 15 | 16 | location = /favicon.ico { 17 | log_not_found off; 18 | access_log off; 19 | } 20 | 21 | location = /robots.txt { 22 | allow all; 23 | log_not_found off; 24 | access_log off; 25 | } 26 | 27 | # Very rarely should these ever be accessed outside of your lan 28 | location ~* \.(txt|log)$ { 29 | allow 192.168.0.0/16; 30 | deny all; 31 | } 32 | 33 | location ~ \..*/.*\.php$ { 34 | return 403; 35 | } 36 | 37 | location ~ ^/sites/.*/private/ { 38 | return 403; 39 | } 40 | 41 | # Block access to scripts in site files directory 42 | location ~ ^/sites/[^/]+/files/.*\.php$ { 43 | deny all; 44 | } 45 | 46 | # Allow "Well-Known URIs" as per RFC 5785 47 | location ~* ^/.well-known/ { 48 | allow all; 49 | } 50 | 51 | # Block access to "hidden" files and directories whose names begin with a 52 | # period. This includes directories used by version control systems such 53 | # as Subversion or Git to store control files. 54 | location ~ (^|/)\. { 55 | return 403; 56 | } 57 | 58 | location / { 59 | # try_files $uri @rewrite; # For Drupal <= 6 60 | try_files $uri /index.php?$query_string; # For Drupal >= 7 61 | } 62 | 63 | location @rewrite { 64 | rewrite ^/(.*)$ /index.php?q=$1; 65 | } 66 | 67 | # Don't allow direct access to PHP files in the vendor directory. 68 | location ~ /vendor/.*\.php$ { 69 | deny all; 70 | return 404; 71 | } 72 | 73 | # In Drupal 8, we must also match new paths where the '.php' appears in 74 | # the middle, such as update.php/selection. The rule we use is strict, 75 | # and only allows this pattern with the update.php front controller. 76 | # This allows legacy path aliases in the form of 77 | # blog/index.php/legacy-path to continue to route to Drupal nodes. If 78 | # you do not have any paths like that, then you might prefer to use a 79 | # laxer rule, such as: 80 | # location ~ \.php(/|$) { 81 | # The laxer rule will continue to work if Drupal uses this new URL 82 | # pattern with front controllers other than update.php in a future 83 | # release. 84 | location ~ '\.php$|^/update.php' { 85 | fastcgi_split_path_info ^(.+?\.php)(|/.*)$; 86 | # Security note: If you're running a version of PHP older than the 87 | # latest 5.3, you should have "cgi.fix_pathinfo = 0;" in php.ini. 88 | # See http://serverfault.com/q/627903/94922 for details. 89 | include fastcgi_params; 90 | # Block httpoxy attacks. See https://httpoxy.org/. 91 | fastcgi_param HTTP_PROXY ""; 92 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 93 | fastcgi_param PATH_INFO $fastcgi_path_info; 94 | fastcgi_param QUERY_STRING $query_string; 95 | fastcgi_intercept_errors on; 96 | 97 | fastcgi_pass $my_fastcgi_pass; 98 | } 99 | 100 | # Fighting with Styles? This little gem is amazing. 101 | # location ~ ^/sites/.*/files/imagecache/ { # For Drupal <= 6 102 | location ~ ^/sites/.*/files/styles/ { # For Drupal >= 7 103 | try_files $uri @rewrite; 104 | } 105 | 106 | # Handle private files through Drupal. Private file's path can come 107 | # with a language prefix. 108 | location ~ ^(/[a-z\-]+)?/system/files/ { # For Drupal >= 7 109 | try_files $uri /index.php?$query_string; 110 | } 111 | 112 | location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ { 113 | try_files $uri @rewrite; 114 | expires max; 115 | log_not_found off; 116 | } 117 | } 118 | -------------------------------------------------------------------------------- /files/nginx/vhost/fpm.conf: -------------------------------------------------------------------------------- 1 | # /etc/nginx/sites-available/fpm.conf 2 | # Basic FPM 3 | 4 | map $cookie_XDEBUG_SESSION $my_fastcgi_pass { 5 | default 127.0.0.1:9000; 6 | xdebug 127.0.0.1:${phpfpm_xdebug_port}; 7 | } 8 | 9 | server { 10 | listen *:8080 default_server; 11 | 12 | server_name _; 13 | root /var/www; 14 | index index.html index.php; 15 | 16 | location / { 17 | try_files $uri $uri/ /index.php$is_args$args; 18 | } 19 | 20 | location ~ \.php$ { 21 | set $path_info $fastcgi_path_info; 22 | 23 | fastcgi_pass $my_fastcgi_pass; 24 | fastcgi_index index.php; 25 | fastcgi_split_path_info ^(.+\.php)(/.*)$; 26 | 27 | include fastcgi_params; 28 | 29 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 30 | fastcgi_param DOCUMENT_ROOT $realpath_root; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /files/nginx/vhost/html.conf: -------------------------------------------------------------------------------- 1 | # /etc/nginx/sites-available/html.conf 2 | # Basic HTML 3 | 4 | server { 5 | listen *:8080 default_server; 6 | 7 | server_name _; 8 | root /var/www; 9 | index index.html; 10 | 11 | location / { 12 | try_files $uri $uri/ =404; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /files/nginx/vhost/laravel.conf: -------------------------------------------------------------------------------- 1 | # /etc/nginx/sites-available/laravel.conf 2 | # Laravel 3 | 4 | map $cookie_XDEBUG_SESSION $my_fastcgi_pass { 5 | default 127.0.0.1:9000; 6 | xdebug 127.0.0.1:${phpfpm_xdebug_port}; 7 | } 8 | 9 | server { 10 | listen *:8080 default_server; 11 | 12 | server_name _; 13 | root /var/www/public; 14 | index index.html index.php; 15 | 16 | add_header X-Frame-Options "SAMEORIGIN"; 17 | add_header X-XSS-Protection "1; mode=block"; 18 | add_header X-Content-Type-Options "nosniff"; 19 | 20 | location / { 21 | try_files $uri $uri/ /index.php?$query_string; 22 | } 23 | 24 | location = /favicon.ico { access_log off; log_not_found off; } 25 | location = /robots.txt { access_log off; log_not_found off; } 26 | 27 | error_page 404 /index.php; 28 | 29 | location ~ \.php$ { 30 | set $path_info $fastcgi_path_info; 31 | 32 | fastcgi_pass $my_fastcgi_pass; 33 | fastcgi_index index.php; 34 | fastcgi_split_path_info ^(.+\.php)(/.+)$; 35 | 36 | include fastcgi_params; 37 | 38 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 39 | fastcgi_param DOCUMENT_ROOT $realpath_root; 40 | } 41 | 42 | location ~ /\.(?!well-known).* { 43 | deny all; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /files/nginx/vhost/symfony2-dev.conf: -------------------------------------------------------------------------------- 1 | # /etc/nginx/sites-available/symfony2-dev.conf 2 | # Symfony 2 DEVELOPMENT 3 | 4 | map $cookie_XDEBUG_SESSION $my_fastcgi_pass { 5 | default 127.0.0.1:9000; 6 | xdebug 127.0.0.1:${phpfpm_xdebug_port}; 7 | } 8 | 9 | server { 10 | listen *:8080 default_server; 11 | 12 | server_name _; 13 | root /var/www/web; 14 | index app.php; 15 | 16 | location / { 17 | try_files $uri /app.php$is_args$args; 18 | } 19 | 20 | location ~ ^/(app_dev|config)\.php(/|$) { 21 | set $path_info $fastcgi_path_info; 22 | 23 | fastcgi_pass $my_fastcgi_pass; 24 | fastcgi_split_path_info ^(.+\.php)(/.*)$; 25 | 26 | include fastcgi_params; 27 | 28 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 29 | fastcgi_param DOCUMENT_ROOT $realpath_root; 30 | } 31 | 32 | location ~ ^/app\.php(/|$) { 33 | set $path_info $fastcgi_path_info; 34 | 35 | fastcgi_pass $my_fastcgi_pass; 36 | fastcgi_split_path_info ^(.+\.php)(/.*)$; 37 | 38 | include fastcgi_params; 39 | 40 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 41 | fastcgi_param DOCUMENT_ROOT $realpath_root; 42 | 43 | internal; 44 | } 45 | 46 | location ~ \.php$ { 47 | return 404; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /files/nginx/vhost/symfony2-prod.conf: -------------------------------------------------------------------------------- 1 | # /etc/nginx/sites-available/symfony2-prod.conf 2 | # Symfony 2 PRODUCTION 3 | 4 | map $cookie_XDEBUG_SESSION $my_fastcgi_pass { 5 | default 127.0.0.1:9000; 6 | xdebug 127.0.0.1:${phpfpm_xdebug_port}; 7 | } 8 | 9 | server { 10 | listen *:8080 default_server; 11 | 12 | server_name _; 13 | root /var/www/web; 14 | index app.php; 15 | 16 | location / { 17 | try_files $uri /app.php$is_args$args; 18 | } 19 | 20 | location ~ ^/app\.php(/|$) { 21 | set $path_info $fastcgi_path_info; 22 | 23 | fastcgi_pass $my_fastcgi_pass; 24 | fastcgi_split_path_info ^(.+\.php)(/.*)$; 25 | 26 | include fastcgi_params; 27 | 28 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 29 | fastcgi_param DOCUMENT_ROOT $realpath_root; 30 | 31 | internal; 32 | } 33 | 34 | location ~ \.php$ { 35 | return 404; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /files/nginx/vhost/symfony3-dev.conf: -------------------------------------------------------------------------------- 1 | # /etc/nginx/sites-available/symfony3-dev.conf 2 | # Symfony 3 DEVELOPMENT 3 | 4 | map $cookie_XDEBUG_SESSION $my_fastcgi_pass { 5 | default 127.0.0.1:9000; 6 | xdebug 127.0.0.1:${phpfpm_xdebug_port}; 7 | } 8 | 9 | server { 10 | listen *:8080 default_server; 11 | 12 | server_name _; 13 | root /var/www/web; 14 | index app.php; 15 | 16 | location / { 17 | try_files $uri /app.php$is_args$args; 18 | } 19 | 20 | location ~ ^/(app_dev|config)\.php(/|$) { 21 | set $path_info $fastcgi_path_info; 22 | 23 | fastcgi_pass $my_fastcgi_pass; 24 | fastcgi_split_path_info ^(.+\.php)(/.*)$; 25 | 26 | include fastcgi_params; 27 | 28 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 29 | fastcgi_param DOCUMENT_ROOT $realpath_root; 30 | } 31 | 32 | location ~ ^/app\.php(/|$) { 33 | set $path_info $fastcgi_path_info; 34 | 35 | fastcgi_pass $my_fastcgi_pass; 36 | fastcgi_split_path_info ^(.+\.php)(/.*)$; 37 | 38 | include fastcgi_params; 39 | 40 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 41 | fastcgi_param DOCUMENT_ROOT $realpath_root; 42 | 43 | internal; 44 | } 45 | 46 | location ~ \.php$ { 47 | return 404; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /files/nginx/vhost/symfony3-prod.conf: -------------------------------------------------------------------------------- 1 | # /etc/nginx/sites-available/symfony3-prod.conf 2 | # Symfony 3 PRODUCTION 3 | 4 | map $cookie_XDEBUG_SESSION $my_fastcgi_pass { 5 | default 127.0.0.1:9000; 6 | xdebug 127.0.0.1:${phpfpm_xdebug_port}; 7 | } 8 | 9 | server { 10 | listen *:8080 default_server; 11 | 12 | server_name _; 13 | root /var/www/web; 14 | index app.php; 15 | 16 | location / { 17 | try_files $uri /app.php$is_args$args; 18 | } 19 | 20 | location ~ ^/app\.php(/|$) { 21 | set $path_info $fastcgi_path_info; 22 | 23 | fastcgi_pass $my_fastcgi_pass; 24 | fastcgi_split_path_info ^(.+\.php)(/.*)$; 25 | 26 | include fastcgi_params; 27 | 28 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 29 | fastcgi_param DOCUMENT_ROOT $realpath_root; 30 | 31 | internal; 32 | } 33 | 34 | location ~ \.php$ { 35 | return 404; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /files/nginx/vhost/symfony4.conf: -------------------------------------------------------------------------------- 1 | # /etc/nginx/sites-available/symfony4.conf 2 | # Symfony 4 3 | 4 | map $cookie_XDEBUG_SESSION $my_fastcgi_pass { 5 | default 127.0.0.1:9000; 6 | xdebug 127.0.0.1:${phpfpm_xdebug_port}; 7 | } 8 | 9 | server { 10 | listen *:8080 default_server; 11 | 12 | server_name _; 13 | root /var/www/public; 14 | index index.html index.php; 15 | 16 | location / { 17 | try_files $uri /index.php$is_args$args; 18 | } 19 | 20 | location ~ ^/index\.php(/|$) { 21 | set $path_info $fastcgi_path_info; 22 | 23 | fastcgi_pass $my_fastcgi_pass; 24 | fastcgi_split_path_info ^(.+\.php)(/.*)$; 25 | 26 | include fastcgi_params; 27 | 28 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 29 | fastcgi_param DOCUMENT_ROOT $realpath_root; 30 | 31 | internal; 32 | } 33 | 34 | location ~ \.php$ { 35 | return 404; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /files/nginx/vhost/wordpress.conf: -------------------------------------------------------------------------------- 1 | # /etc/nginx/sites-available/wordpress.conf 2 | # Wordpress 3 | 4 | map $cookie_XDEBUG_SESSION $my_fastcgi_pass { 5 | default 127.0.0.1:9000; 6 | xdebug 127.0.0.1:${phpfpm_xdebug_port}; 7 | } 8 | 9 | server { 10 | listen *:8080 default_server; 11 | 12 | server_name _; 13 | root /var/www; 14 | index index.php; 15 | 16 | location / { 17 | try_files $uri /index.php$is_args$args; 18 | } 19 | 20 | location ~ ^/index\.php(/|$) { 21 | set $path_info $fastcgi_path_info; 22 | 23 | fastcgi_pass $my_fastcgi_pass; 24 | fastcgi_index index.php; 25 | fastcgi_split_path_info ^(.+\.php)(/.*)$; 26 | 27 | include fastcgi_params; 28 | 29 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 30 | fastcgi_param DOCUMENT_ROOT $realpath_root; 31 | } 32 | 33 | location = /favicon.ico { 34 | log_not_found off; 35 | access_log off; 36 | } 37 | 38 | location = /robots.txt { 39 | allow all; 40 | log_not_found off; 41 | access_log off; 42 | } 43 | 44 | location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { 45 | expires max; 46 | log_not_found off; 47 | } 48 | 49 | location ~ /\. { 50 | deny all; 51 | } 52 | 53 | location ~* /(?:uploads|files)/.*\.php$ { 54 | deny all; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /files/php/bin_clean_directories.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | set -x 5 | 6 | # Delete directories belonging to other PHP versions 7 | 8 | PHP_VER="${1}" 9 | 10 | LIB_PHP74=/usr/lib/php/20190902 11 | LIB_PHP80=/usr/lib/php/20200930 12 | LIB_PHP81=/usr/lib/php/20210902 13 | 14 | MOD_PHP74=/etc/php/7.4 15 | MOD_PHP80=/etc/php/8.0 16 | MOD_PHP81=/etc/php/8.1 17 | 18 | if [[ ${PHP_VER} == 8.1 ]]; then 19 | rm -rf \ 20 | ${LIB_PHP80} \ 21 | ${LIB_PHP74} \ 22 | \ 23 | ${MOD_PHP80} \ 24 | ${MOD_PHP74} 25 | 26 | exit 0 27 | fi 28 | 29 | if [[ ${PHP_VER} == 8.0 ]]; then 30 | rm -rf \ 31 | ${LIB_PHP81} \ 32 | ${LIB_PHP74} \ 33 | \ 34 | ${MOD_PHP81} \ 35 | ${MOD_PHP74} 36 | 37 | exit 0 38 | fi 39 | 40 | if [[ ${PHP_VER} == 7.4 ]]; then 41 | rm -rf \ 42 | ${LIB_PHP81} \ 43 | ${LIB_PHP80} \ 44 | \ 45 | ${MOD_PHP81} \ 46 | ${MOD_PHP80} 47 | 48 | exit 0 49 | fi 50 | -------------------------------------------------------------------------------- /files/php/bin_install_composer.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | set -x 5 | 6 | # Installs Composer 7 | 8 | install -d -m 0755 -o www-data -g www-data /.composer &&\ 9 | curl -sS https://getcomposer.org/installer | \ 10 | php -- --install-dir=/usr/local/bin \ 11 | --filename=composer &&\ 12 | chown -R www-data:www-data /.composer 13 | -------------------------------------------------------------------------------- /files/php/bin_install_modules.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | set -x 5 | 6 | # Installs most common modules 7 | 8 | PHP_VER="${1}" 9 | 10 | # These modules are installed and enabled by default 11 | MODULES_DEFAULT=" 12 | php${PHP_VER}-bcmath 13 | php${PHP_VER}-cli 14 | php${PHP_VER}-curl 15 | php${PHP_VER}-intl 16 | php${PHP_VER}-mbstring 17 | php${PHP_VER}-mysql 18 | php${PHP_VER}-opcache 19 | php${PHP_VER}-xml 20 | php${PHP_VER}-zip 21 | " 22 | 23 | # These modules must have their INI directories included via PHP_INI_SCAN_DIR 24 | MODULES_OPTIONAL=" 25 | php${PHP_VER}-amqp 26 | php${PHP_VER}-apcu 27 | php${PHP_VER}-gd 28 | php${PHP_VER}-igbinary 29 | php${PHP_VER}-imagick 30 | php${PHP_VER}-mailparse 31 | php${PHP_VER}-memcached 32 | php${PHP_VER}-mongodb 33 | php${PHP_VER}-oauth 34 | php${PHP_VER}-raphf 35 | php${PHP_VER}-redis 36 | php${PHP_VER}-soap 37 | php${PHP_VER}-solr 38 | php${PHP_VER}-sqlite3 39 | php${PHP_VER}-uuid 40 | php${PHP_VER}-xdebug 41 | php${PHP_VER}-zmq 42 | " 43 | 44 | MODULES_LEGACY="" 45 | 46 | # These modules not available on > PHP 7.4 47 | if [[ ${PHP_VER} == 7.4 ]]; then 48 | MODULES_LEGACY=" 49 | php${PHP_VER}-apcu-bc 50 | php${PHP_VER}-geoip 51 | php${PHP_VER}-gnupg 52 | php${PHP_VER}-json 53 | php${PHP_VER}-radius 54 | php${PHP_VER}-ssh2 55 | php${PHP_VER}-stomp 56 | php${PHP_VER}-uploadprogress 57 | " 58 | fi 59 | 60 | apt-get update &&\ 61 | apt-get install --no-install-recommends --no-install-suggests -y \ 62 | ${MODULES_DEFAULT} \ 63 | ${MODULES_OPTIONAL} \ 64 | ${MODULES_LEGACY} \ 65 | &&\ 66 | apt-get -y --purge autoremove &&\ 67 | rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/{man,doc} 68 | -------------------------------------------------------------------------------- /files/php/bin_link_ini.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | set -x 5 | 6 | # Manage INI files 7 | 8 | PHP_VER="${1}" 9 | 10 | EXTRA_MODS=( 11 | amqp 12 | apcu 13 | gd 14 | imagick 15 | mailparse 16 | memcached 17 | mongodb 18 | oauth 19 | pdo_sqlite 20 | raphf 21 | redis 22 | soap 23 | solr 24 | sqlite3 25 | uuid 26 | zmq 27 | xdebug 28 | ) 29 | 30 | # These modules not available on > PHP 7.4 31 | if [[ ${PHP_VER} == 7.4 ]]; then 32 | EXTRA_MODS+=( 33 | apcu_bc 34 | geoip 35 | gnupg 36 | radius 37 | ssh2 38 | stomp 39 | uploadprogress 40 | ) 41 | fi 42 | 43 | install -d -m 0755 \ 44 | /etc/php/extra-mods \ 45 | /p 46 | 47 | for MOD in "${EXTRA_MODS[@]}" 48 | do 49 | if [[ ! -z ${MOD} ]]; then 50 | install -d -m 0755 "/etc/php/extra-mods/${MOD}" 51 | mv "/etc/php/${PHP_VER}/mods-available/${MOD}.ini" "/etc/php/extra-mods/${MOD}/" 52 | ln -s "/etc/php/extra-mods/${MOD}" "/p/${MOD}" 53 | fi 54 | done 55 | -------------------------------------------------------------------------------- /files/php/bin_rm_symlinked_ini.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | set -x 5 | 6 | # Removes version-specific INI symlinks 7 | 8 | PHP_VER="${1}" 9 | FPM_CLI="${2}" 10 | 11 | # Move non-standard(ish) module INI files out of auto-included directory 12 | # To include a specific module append the directory to PHP_INI_SCAN_DIR 13 | # Shortcut directories are created at /p, eg: /p/xdebug, /p/memcached 14 | # You can specify as PHP_INI_SCAN_DIR=:/p/xdebug:/p/memcached 15 | # Make sure to begin the command with `:` 16 | 17 | function rm_symlinked_ini() { 18 | TYPE="${1}" 19 | 20 | rm -f \ 21 | /etc/php/${PHP_VER}/${TYPE}/conf.d/20-amqp.ini \ 22 | /etc/php/${PHP_VER}/${TYPE}/conf.d/20-apcu.ini \ 23 | /etc/php/${PHP_VER}/${TYPE}/conf.d/25-apcu_bc.ini \ 24 | /etc/php/${PHP_VER}/${TYPE}/conf.d/20-gd.ini \ 25 | /etc/php/${PHP_VER}/${TYPE}/conf.d/20-geoip.ini \ 26 | /etc/php/${PHP_VER}/${TYPE}/conf.d/20-gnupg.ini \ 27 | /etc/php/${PHP_VER}/${TYPE}/conf.d/20-imagick.ini \ 28 | /etc/php/${PHP_VER}/${TYPE}/conf.d/25-mailparse.ini \ 29 | /etc/php/${PHP_VER}/${TYPE}/conf.d/25-memcached.ini \ 30 | /etc/php/${PHP_VER}/${TYPE}/conf.d/20-mongodb.ini \ 31 | /etc/php/${PHP_VER}/${TYPE}/conf.d/20-oauth.ini \ 32 | /etc/php/${PHP_VER}/${TYPE}/conf.d/20-pdo_sqlite.ini \ 33 | /etc/php/${PHP_VER}/${TYPE}/conf.d/20-radius.ini \ 34 | /etc/php/${PHP_VER}/${TYPE}/conf.d/20-raphf.ini \ 35 | /etc/php/${PHP_VER}/${TYPE}/conf.d/20-redis.ini \ 36 | /etc/php/${PHP_VER}/${TYPE}/conf.d/20-soap.ini \ 37 | /etc/php/${PHP_VER}/${TYPE}/conf.d/20-solr.ini \ 38 | /etc/php/${PHP_VER}/${TYPE}/conf.d/20-sqlite3.ini \ 39 | /etc/php/${PHP_VER}/${TYPE}/conf.d/20-ssh2.ini \ 40 | /etc/php/${PHP_VER}/${TYPE}/conf.d/20-stomp.ini \ 41 | /etc/php/${PHP_VER}/${TYPE}/conf.d/20-uploadprogress.ini \ 42 | /etc/php/${PHP_VER}/${TYPE}/conf.d/20-uuid.ini \ 43 | /etc/php/${PHP_VER}/${TYPE}/conf.d/20-zmq.ini \ 44 | /etc/php/${PHP_VER}/${TYPE}/conf.d/20-xdebug.ini 45 | } 46 | 47 | # Inject our default INI and conf files. 48 | # To add your own files, add to the cli or fpm conf.d directories. All INI are 49 | # auto-loaded from this directory, and are loaded in alphabetical order. Suggested 50 | # to start with "99-" to ensure your settings are loaded last and take precedence. 51 | if [[ ${FPM_CLI} == "fpm" ]]; then 52 | rm_symlinked_ini fpm 53 | 54 | rm -f /etc/php/${PHP_VER}/fpm/php-fpm.conf 55 | ln -s /etc/php/${PHP_VER}/fpm/conf.d /etc/php/fpm-conf.d 56 | ln -s /etc/php/php.ini /etc/php/${PHP_VER}/fpm/conf.d/98-env.ini 57 | ln -s /etc/php/php-custom.ini /etc/php/${PHP_VER}/fpm/conf.d/99-custom.ini 58 | 59 | cat > /etc/php/php-custom.ini << EOF 60 | ; Add custom PHP INI directives here 61 | EOF 62 | fi 63 | 64 | if [[ ${FPM_CLI} == "cli" ]]; then 65 | rm_symlinked_ini cli 66 | 67 | ln -s /etc/php/${PHP_VER}/cli/conf.d /etc/php/cli-conf.d 68 | ln -s /etc/php/php.ini /etc/php/${PHP_VER}/cli/conf.d/98-env.ini 69 | ln -s /etc/php/cli-custom.ini /etc/php/${PHP_VER}/cli/conf.d/99-custom.ini 70 | 71 | cat > /etc/php/cli-custom.ini << EOF 72 | ; Add custom PHP INI directives here 73 | EOF 74 | fi 75 | -------------------------------------------------------------------------------- /files/php/fpm-xdebug: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # If phpfpm xdebug instance not wanted, run fake tail service 4 | PHPFPM_XDEBUG=${PHPFPM_XDEBUG:-""} 5 | if [[ "${PHPFPM_XDEBUG,,}" != "on" ]]; then 6 | echo "PHP-FPM with Xdebug DISABLED" 7 | exec tail -f /var/log/fpm-xdebug-tail 8 | exit 0 9 | fi 10 | 11 | echo "PHP-FPM with Xdebug ENABLED" 12 | 13 | # Prevent empty PHP_INI_SCAN_DIR 14 | # The below in docker-compose.yml sets value to literal "", so remove quotes 15 | # environment: 16 | # - PHP_INI_SCAN_DIR="" 17 | PHP_INI_SCAN_DIR=${PHP_INI_SCAN_DIR:-""} 18 | PHP_INI_SCAN_DIR=$(echo "${PHP_INI_SCAN_DIR}" | tr -d '"' | tr -d "'") 19 | if [[ ! ${PHP_INI_SCAN_DIR} ]]; then 20 | # No preceding ":" if empty, otherwise default location and this location will load 21 | # INI files twice, causing warning 22 | PHP_INI_SCAN_DIR=/etc/php/fpm-conf.d/ 23 | fi 24 | 25 | # Prevent defining xdebug INI location twice 26 | if [[ ${PHP_INI_SCAN_DIR} != *"xdebug"* ]]; then 27 | PHP_INI_SCAN_DIR=${PHP_INI_SCAN_DIR}:/p/xdebug 28 | fi 29 | 30 | export PHP_INI_SCAN_DIR 31 | 32 | exec /usr/sbin/php-fpm \ 33 | -d FPM.pid="/var/run/php-fpm/php-fpm-xdebug.pid" \ 34 | -d FPM.listen="127.0.0.1:9999" \ 35 | --nodaemonize \ 36 | --force-stderr 2>&1 | \ 37 | sed -u 's,.*: \"\(.*\)$,\1,'| \ 38 | sed -u 's,"$,,' 1>&1 39 | -------------------------------------------------------------------------------- /files/php/fpm.conf: -------------------------------------------------------------------------------- 1 | [global] 2 | pid = ${FPM.pid} 3 | 4 | ; Avoid logs being sent to syslog 5 | error_log = /proc/self/fd/2 6 | 7 | [www] 8 | user = www-data 9 | listen = ${FPM.listen} 10 | ; Redirect logs to stdout - FPM closes /dev/std* on startup 11 | access.log = /proc/self/fd/2 12 | catch_workers_output = yes 13 | ; Required to allow config-by-environment 14 | clear_env = no 15 | 16 | listen.backlog = ${FPM.listen.backlog} 17 | 18 | pm = ${FPM.pm} 19 | pm.max_children = ${FPM.pm.max_children} 20 | pm.start_servers = ${FPM.pm.start_servers} 21 | pm.min_spare_servers = ${FPM.pm.min_spare_servers} 22 | pm.max_spare_servers = ${FPM.pm.max_spare_servers} 23 | pm.process_idle_timeout = ${FPM.pm.process_idle_timeout} 24 | pm.max_requests = ${FPM.pm.max_requests} 25 | 26 | security.limit_extensions = ${FPM.security.limit_extensions} 27 | -------------------------------------------------------------------------------- /files/php/php-fpm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Prevent empty PHP_INI_SCAN_DIR 4 | # The below in docker-compose.yml sets value to literal "", so remove quotes 5 | # environment: 6 | # - PHP_INI_SCAN_DIR="" 7 | PHP_INI_SCAN_DIR=${PHP_INI_SCAN_DIR:-""} 8 | PHP_INI_SCAN_DIR=$(echo "${PHP_INI_SCAN_DIR}" | tr -d '"' | tr -d "'") 9 | if [[ ! ${PHP_INI_SCAN_DIR} ]]; then 10 | # No preceding ":" if empty, otherwise default location and this location will load 11 | # INI files twice, causing warning 12 | PHP_INI_SCAN_DIR=/etc/php/fpm-conf.d/ 13 | fi 14 | 15 | export PHP_INI_SCAN_DIR 16 | 17 | exec /usr/sbin/php-fpm \ 18 | --nodaemonize \ 19 | --force-stderr 2>&1 | \ 20 | sed -u 's,.*: \"\(.*\)$,\1,'| \ 21 | sed -u 's,"$,,' 1>&1 22 | -------------------------------------------------------------------------------- /files/php/php.ini: -------------------------------------------------------------------------------- 1 | allow_url_fopen = ${PHP.allow_url_fopen} 2 | allow_url_include = ${PHP.allow_url_include} 3 | always_populate_raw_post_data = ${PHP.always_populate_raw_post_data} 4 | asp_tags = ${PHP.asp_tags} 5 | auto_append_file = ${PHP.auto_append_file} 6 | auto_detect_line_endings = ${PHP.auto_detect_line_endings} 7 | auto_globals_jit = ${PHP.auto_globals_jit} 8 | auto_prepend_file = ${PHP.auto_prepend_file} 9 | browscap = ${PHP.browscap} 10 | child_terminate = ${PHP.child_terminate} 11 | default_charset = ${PHP.default_charset} 12 | default_mimetype = ${PHP.default_mimetype} 13 | default_socket_timeout = ${PHP.default_socket_timeout} 14 | disable_classes = ${PHP.disable_classes} 15 | disable_functions = ${PHP.disable_functions} 16 | display_errors = ${PHP.display_errors} 17 | display_startup_errors = ${PHP.display_startup_errors} 18 | docref_ext = ${PHP.docref_ext} 19 | docref_root = ${PHP.docref_root} 20 | doc_root = ${PHP.doc_root} 21 | error_append_string = ${PHP.error_append_string} 22 | error_log = ${PHP.error_log} 23 | error_prepend_string = ${PHP.error_prepend_string} 24 | error_reporting = ${PHP.error_reporting} 25 | exit_on_timeout = ${PHP.exit_on_timeout} 26 | expose_php = ${PHP.expose_php} 27 | file_uploads = ${PHP.file_uploads} 28 | html_errors = ${PHP.html_errors} 29 | ignore_repeated_errors = ${PHP.ignore_repeated_errors} 30 | ignore_repeated_source = ${PHP.ignore_repeated_source} 31 | ignore_user_abort = ${PHP.ignore_user_abort} 32 | implicit_flush = ${PHP.implicit_flush} 33 | include_path = ${PHP.include_path} 34 | last_modified = ${PHP.last_modified} 35 | log_errors = ${PHP.log_errors} 36 | log_errors_max_len = ${PHP.log_errors_max_len} 37 | max_execution_time = ${PHP.max_execution_time} 38 | max_input_nesting_level = ${PHP.max_input_nesting_level} 39 | max_input_vars = ${PHP.max_input_vars} 40 | max_input_time = ${PHP.max_input_time} 41 | memory_limit = ${PHP.memory_limit} 42 | open_basedir = ${PHP.open_basedir} 43 | output_buffering = ${PHP.output_buffering} 44 | output_handler = ${PHP.output_handler} 45 | enable_post_data_reading = ${PHP.enable_post_data_reading} 46 | post_max_size = ${PHP.post_max_size} 47 | precision = ${PHP.precision} 48 | realpath_cache_size = ${PHP.realpath_cache_size} 49 | realpath_cache_ttl = ${PHP.realpath_cache_ttl} 50 | register_argc_argv = ${PHP.register_argc_argv} 51 | report_memleaks = ${PHP.report_memleaks} 52 | report_zend_debug = ${PHP.report_zend_debug} 53 | request_order = ${PHP.request_order} 54 | sendmail_from = ${PHP.sendmail_from} 55 | sendmail_path = ${PHP.sendmail_path} 56 | serialize_precision = ${PHP.serialize_precision} 57 | short_open_tag = ${PHP.short_open_tag} 58 | SMTP = ${PHP.SMTP} 59 | smtp_port = ${PHP.smtp_port} 60 | track_errors = ${PHP.track_errors} 61 | unserialize_callback_func = ${PHP.unserialize_callback_func} 62 | upload_max_filesize = ${PHP.upload_max_filesize} 63 | max_file_uploads = ${PHP.max_file_uploads} 64 | upload_tmp_dir = ${PHP.upload_tmp_dir} 65 | user_agent = ${PHP.user_agent} 66 | user_dir = ${PHP.user_dir} 67 | variables_order = ${PHP.variables_order} 68 | windows_show_crt_warning = ${PHP.windows_show_crt_warning} 69 | xbithack = ${PHP.xbithack} 70 | xmlrpc_errors = ${PHP.xmlrpc_errors} 71 | xmlrpc_error_number = ${PHP.xmlrpc_error_number} 72 | 73 | [apc] 74 | apc.cache_by_default = ${PHP.apc.cache_by_default} 75 | apc.enabled = ${PHP.apc.enabled} 76 | apc.enable_cli = ${PHP.apc.enable_cli} 77 | apc.file_update_protection = ${PHP.apc.file_update_protection} 78 | apc.filters = ${PHP.apc.filters} 79 | apc.gc_ttl = ${PHP.apc.gc_ttl} 80 | apc.include_once_override = ${PHP.apc.include_once_override} 81 | apc.localcache = ${PHP.apc.localcache} 82 | apc.localcache.size = ${PHP.apc.localcache.size} 83 | apc.max_file_size = ${PHP.apc.max_file_size} 84 | apc.mmap_file_mask = ${PHP.apc.mmap_file_mask} 85 | apc.num_files_hint = ${PHP.apc.num_files_hint} 86 | apc.report_autofilter = ${PHP.apc.report_autofilter} 87 | apc.rfc1867 = ${PHP.apc.rfc1867} 88 | apc.rfc1867_freq = ${PHP.apc.rfc1867_freq} 89 | apc.rfc1867_name = ${PHP.apc.rfc1867_name} 90 | apc.rfc1867_prefix = ${PHP.apc.rfc1867_prefix} 91 | apc.shm_segments = ${PHP.apc.shm_segments} 92 | apc.shm_size = ${PHP.apc.shm_size} 93 | apc.slam_defense = ${PHP.apc.slam_defense} 94 | apc.stat = ${PHP.apc.stat} 95 | apc.stat_ctime = ${PHP.apc.stat_ctime} 96 | apc.ttl = ${PHP.apc.ttl} 97 | apc.user_entries_hint = ${PHP.apc.user_entries_hint} 98 | apc.user_ttl = ${PHP.apc.user_ttl} 99 | apc.write_lock = ${PHP.apc.write_lock} 100 | 101 | [apd] 102 | apd.dumpdir = ${PHP.apd.dumpdir} 103 | apd.statement_tracing = ${PHP.apd.statement_tracing} 104 | 105 | [arg_separator] 106 | arg_separator.input = ${PHP.arg_separator.input} 107 | arg_separator.output = ${PHP.arg_separator.output} 108 | 109 | [assert] 110 | assert.active = ${PHP.assert.active} 111 | assert.bail = ${PHP.assert.bail} 112 | assert.callback = ${PHP.assert.callback} 113 | assert.quiet_eval = ${PHP.assert.quiet_eval} 114 | assert.warning = ${PHP.assert.warning} 115 | 116 | [axis2] 117 | axis2.client_home = ${PHP.axis2.client_home} 118 | axis2.enable_exception = ${PHP.axis2.enable_exception} 119 | axis2.enable_trace = ${PHP.axis2.enable_trace} 120 | axis2.log_path = ${PHP.axis2.log_path} 121 | 122 | [bcmath] 123 | bcmath.scale = ${PHP.bcmath.scale} 124 | 125 | [bcompiler] 126 | bcompiler.enabled = ${PHP.bcompiler.enabled} 127 | 128 | [birdstep] 129 | birdstep.max_links = ${PHP.birdstep.max_links} 130 | 131 | [blenc] 132 | blenc.key_file = ${PHP.blenc.key_file} 133 | 134 | [cgi] 135 | cgi.check_shebang_line = ${PHP.cgi.check_shebang_line} 136 | cgi.discard_path = ${PHP.cgi.discard_path} 137 | cgi.fix_pathinfo = ${PHP.cgi.fix_pathinfo} 138 | cgi.force_redirect = ${PHP.cgi.force_redirect} 139 | cgi.nph = ${PHP.cgi.nph} 140 | cgi.redirect_status_env = ${PHP.cgi.redirect_status_env} 141 | cgi.rfc2616_headers = ${PHP.cgi.rfc2616_headers} 142 | 143 | [cli] 144 | cli.pager = ${PHP.cli.pager} 145 | cli.prompt = ${PHP.cli.prompt} 146 | 147 | [cli_server] 148 | cli_server.color = ${PHP.cli_server.color} 149 | 150 | [coin_acceptor] 151 | coin_acceptor.auto_initialize = ${PHP.coin_acceptor.auto_initialize} 152 | coin_acceptor.auto_reset = ${PHP.coin_acceptor.auto_reset} 153 | coin_acceptor.command_function = ${PHP.coin_acceptor.command_function} 154 | coin_acceptor.delay_coins = ${PHP.coin_acceptor.delay_coins} 155 | coin_acceptor.delay_prom = ${PHP.coin_acceptor.delay_prom} 156 | coin_acceptor.lock_on_close = ${PHP.coin_acceptor.lock_on_close} 157 | coin_acceptor.start_unlocked = ${PHP.coin_acceptor.start_unlocked} 158 | 159 | [com] 160 | com.allow_dcom = ${PHP.com.allow_dcom} 161 | com.autoregister_casesensitive = ${PHP.com.autoregister_casesensitive} 162 | com.autoregister_typelib = ${PHP.com.autoregister_typelib} 163 | com.autoregister_verbose = ${PHP.com.autoregister_verbose} 164 | com.code_page = ${PHP.com.code_page} 165 | com.typelib_file = ${PHP.com.typelib_file} 166 | 167 | [curl] 168 | curl.cainfo = ${PHP.curl.cainfo} 169 | 170 | [daffodildb] 171 | daffodildb.default_host = ${PHP.daffodildb.default_host} 172 | daffodildb.default_password = ${PHP.daffodildb.default_password} 173 | daffodildb.default_socket = ${PHP.daffodildb.default_socket} 174 | daffodildb.default_user = ${PHP.daffodildb.default_user} 175 | daffodildb.port = ${PHP.daffodildb.port} 176 | 177 | [date] 178 | date.default_latitude = ${PHP.date.default_latitude} 179 | date.default_longitude = ${PHP.date.default_longitude} 180 | date.sunrise_zenith = ${PHP.date.sunrise_zenith} 181 | date.sunset_zenith = ${PHP.date.sunset_zenith} 182 | date.timezone = ${PHP.date.timezone} 183 | 184 | [dba] 185 | dba.default_handler = ${PHP.dba.default_handler} 186 | 187 | [etpan] 188 | etpan.default.charset = ${PHP.etpan.default.charset} 189 | etpan.default.protocol = ${PHP.etpan.default.protocol} 190 | 191 | [exif] 192 | exif.decode_jis_intel = ${PHP.exif.decode_jis_intel} 193 | exif.decode_jis_motorola = ${PHP.exif.decode_jis_motorola} 194 | exif.decode_unicode_intel = ${PHP.exif.decode_unicode_intel} 195 | exif.decode_unicode_motorola = ${PHP.exif.decode_unicode_motorola} 196 | exif.encode_jis = ${PHP.exif.encode_jis} 197 | exif.encode_unicode = ${PHP.exif.encode_unicode} 198 | 199 | [expect] 200 | expect.logfile = ${PHP.expect.logfile} 201 | expect.loguser = ${PHP.expect.loguser} 202 | expect.timeout = ${PHP.expect.timeout} 203 | 204 | [fastcgi] 205 | fastcgi.impersonate = ${PHP.fastcgi.impersonate} 206 | fastcgi.logging = ${PHP.fastcgi.logging} 207 | 208 | [fbsql] 209 | fbsql.allow_persistent = ${PHP.fbsql.allow_persistent} 210 | fbsql.autocommit = ${PHP.fbsql.autocommit} 211 | fbsql.batchsize = ${PHP.fbsql.batchsize} 212 | fbsql.default_database = ${PHP.fbsql.default_database} 213 | fbsql.default_database_password = ${PHP.fbsql.default_database_password} 214 | fbsql.default_host = ${PHP.fbsql.default_host} 215 | fbsql.default_password = ${PHP.fbsql.default_password} 216 | fbsql.default_user = ${PHP.fbsql.default_user} 217 | fbsql.generate_warnings = ${PHP.fbsql.generate_warnings} 218 | fbsql.max_connections = ${PHP.fbsql.max_connections} 219 | fbsql.max_links = ${PHP.fbsql.max_links} 220 | fbsql.max_persistent = ${PHP.fbsql.max_persistent} 221 | fbsql.max_results = ${PHP.fbsql.max_results} 222 | fbsql.show_timestamp_decimals = ${PHP.fbsql.show_timestamp_decimals} 223 | 224 | [filter] 225 | filter.default = ${PHP.filter.default} 226 | filter.default_flags = ${PHP.filter.default_flags} 227 | 228 | [gd] 229 | gd.jpeg_ignore_warning = ${PHP.gd.jpeg_ignore_warning} 230 | 231 | [geoip] 232 | geoip.custom_directory = ${PHP.geoip.custom_directory} 233 | 234 | [hidef] 235 | hidef.ini_path = ${PHP.hidef.ini_path} 236 | 237 | [highlight] 238 | highlight.comment = ${PHP.highlight.comment} 239 | highlight.default = ${PHP.highlight.default} 240 | highlight.html = ${PHP.highlight.html} 241 | highlight.keyword = ${PHP.highlight.keyword} 242 | highlight.string = ${PHP.highlight.string} 243 | 244 | [htscanner] 245 | htscanner.config_file = ${PHP.htscanner.config_file} 246 | htscanner.default_docroot = ${PHP.htscanner.default_docroot} 247 | htscanner.default_ttl = ${PHP.htscanner.default_ttl} 248 | htscanner.stop_on_error = ${PHP.htscanner.stop_on_error} 249 | 250 | [http] 251 | http.etag.mode = ${PHP.http.etag.mode} 252 | http.force_exit = ${PHP.http.force_exit} 253 | http.log.allowed_methods = ${PHP.http.log.allowed_methods} 254 | http.log.cache = ${PHP.http.log.cache} 255 | http.log.composite = ${PHP.http.log.composite} 256 | http.log.not_found = ${PHP.http.log.not_found} 257 | http.log.redirect = ${PHP.http.log.redirect} 258 | http.only_exceptions = ${PHP.http.only_exceptions} 259 | http.persistent.handles.ident = ${PHP.http.persistent.handles.ident} 260 | http.persistent.handles.limit = ${PHP.http.persistent.handles.limit} 261 | http.request.datashare.connect = ${PHP.http.request.datashare.connect} 262 | http.request.datashare.cookie = ${PHP.http.request.datashare.cookie} 263 | http.request.datashare.dns = ${PHP.http.request.datashare.dns} 264 | http.request.datashare.ssl = ${PHP.http.request.datashare.ssl} 265 | http.request.methods.allowed = ${PHP.http.request.methods.allowed} 266 | http.request.methods.custom = ${PHP.http.request.methods.custom} 267 | http.send.deflate.start_auto = ${PHP.http.send.deflate.start_auto} 268 | http.send.deflate.start_flags = ${PHP.http.send.deflate.start_flags} 269 | http.send.inflate.start_auto = ${PHP.http.send.inflate.start_auto} 270 | http.send.inflate.start_flags = ${PHP.http.send.inflate.start_flags} 271 | http.send.not_found_404 = ${PHP.http.send.not_found_404} 272 | 273 | [ibase] 274 | ibase.allow_persistent = ${PHP.ibase.allow_persistent} 275 | ibase.dateformat = ${PHP.ibase.dateformat} 276 | ibase.default_charset = ${PHP.ibase.default_charset} 277 | ibase.default_db = ${PHP.ibase.default_db} 278 | ibase.default_password = ${PHP.ibase.default_password} 279 | ibase.default_user = ${PHP.ibase.default_user} 280 | ibase.max_links = ${PHP.ibase.max_links} 281 | ibase.max_persistent = ${PHP.ibase.max_persistent} 282 | ibase.timeformat = ${PHP.ibase.timeformat} 283 | ibase.timestampformat = ${PHP.ibase.timestampformat} 284 | 285 | [ibm_db2] 286 | ibm_db2.binmode = ${PHP.ibm_db2.binmode} 287 | ibm_db2.i5_all_pconnect = ${PHP.ibm_db2.i5_all_pconnect} 288 | ibm_db2.i5_allow_commit = ${PHP.ibm_db2.i5_allow_commit} 289 | ibm_db2.i5_dbcs_alloc = ${PHP.ibm_db2.i5_dbcs_alloc} 290 | ibm_db2.instance_name = ${PHP.ibm_db2.instance_name} 291 | ibm_db2.i5_ignore_userid = ${PHP.ibm_db2.i5_ignore_userid} 292 | 293 | [iconv] 294 | iconv.input_encoding = ${PHP.iconv.input_encoding} 295 | iconv.internal_encoding = ${PHP.iconv.internal_encoding} 296 | iconv.output_encoding = ${PHP.iconv.output_encoding} 297 | 298 | [imlib2] 299 | imlib2.font_cache_max_size = ${PHP.imlib2.font_cache_max_size} 300 | imlib2.font_path = ${PHP.imlib2.font_path} 301 | 302 | [ingres] 303 | ingres.allow_persistent = ${PHP.ingres.allow_persistent} 304 | ingres.array_index_start = ${PHP.ingres.array_index_start} 305 | ingres.auto = ${PHP.ingres.auto} 306 | ingres.blob_segment_length = ${PHP.ingres.blob_segment_length} 307 | ingres.cursor_mode = ${PHP.ingres.cursor_mode} 308 | ingres.default_database = ${PHP.ingres.default_database} 309 | ingres.default_password = ${PHP.ingres.default_password} 310 | ingres.default_user = ${PHP.ingres.default_user} 311 | ingres.describe = ${PHP.ingres.describe} 312 | ingres.fetch_buffer_size = ${PHP.ingres.fetch_buffer_size} 313 | ingres.max_links = ${PHP.ingres.max_links} 314 | ingres.max_persistent = ${PHP.ingres.max_persistent} 315 | ingres.reuse_connection = ${PHP.ingres.reuse_connection} 316 | ingres.scrollable = ${PHP.ingres.scrollable} 317 | ingres.trace = ${PHP.ingres.trace} 318 | ingres.trace_connect = ${PHP.ingres.trace_connect} 319 | ingres.utf8 = ${PHP.ingres.utf8} 320 | 321 | [ldap] 322 | ldap.max_links = ${PHP.ldap.max_links} 323 | 324 | [mail] 325 | mail.add_x_header = ${PHP.mail.add_x_header} 326 | mail.force_extra_parameters = ${PHP.mail.force_extra_parameters} 327 | mail.log = ${PHP.mail.log} 328 | 329 | [maxdb] 330 | maxdb.default_db = ${PHP.maxdb.default_db} 331 | maxdb.default_host = ${PHP.maxdb.default_host} 332 | maxdb.default_pw = ${PHP.maxdb.default_pw} 333 | maxdb.default_user = ${PHP.maxdb.default_user} 334 | maxdb.long_readlen = ${PHP.maxdb.long_readlen} 335 | 336 | [mbstring] 337 | mbstring.detect_order = ${PHP.mbstring.detect_order} 338 | mbstring.encoding_translation = ${PHP.mbstring.encoding_translation} 339 | mbstring.func_overload = ${PHP.mbstring.func_overload} 340 | mbstring.http_input = ${PHP.mbstring.http_input} 341 | mbstring.http_output = ${PHP.mbstring.http_output} 342 | mbstring.internal_encoding = ${PHP.mbstring.internal_encoding} 343 | mbstring.language = ${PHP.mbstring.language} 344 | mbstring.script_encoding = ${PHP.mbstring.script_encoding} 345 | mbstring.strict_detection = ${PHP.mbstring.strict_detection} 346 | mbstring.substitute_character = ${PHP.mbstring.substitute_character} 347 | 348 | [mcrypt] 349 | mcrypt.algorithms_dir = ${PHP.mcrypt.algorithms_dir} 350 | mcrypt.modes_dir = ${PHP.mcrypt.modes_dir} 351 | 352 | [memcache] 353 | memcache.allow_failover = ${PHP.memcache.allow_failover} 354 | memcache.chunk_size = ${PHP.memcache.chunk_size} 355 | memcache.default_port = ${PHP.memcache.default_port} 356 | memcache.hash_function = ${PHP.memcache.hash_function} 357 | memcache.hash_strategy = ${PHP.memcache.hash_strategy} 358 | memcache.max_failover_attempts = ${PHP.memcache.max_failover_attempts} 359 | 360 | [mime_magic] 361 | mime_magic.debug = ${PHP.mime_magic.debug} 362 | mime_magic.magicfile = ${PHP.mime_magic.magicfile} 363 | 364 | [mongo] 365 | mongo.allow_empty_keys = ${PHP.mongo.allow_empty_keys} 366 | mongo.chunk_size = ${PHP.mongo.chunk_size} 367 | mongo.cmd = ${PHP.mongo.cmd} 368 | mongo.default_host = ${PHP.mongo.default_host} 369 | mongo.default_port = ${PHP.mongo.default_port} 370 | mongo.is_master_interval = ${PHP.mongo.is_master_interval} 371 | mongo.long_as_object = ${PHP.mongo.long_as_object} 372 | mongo.native_long = ${PHP.mongo.native_long} 373 | mongo.ping_interval = ${PHP.mongo.ping_interval} 374 | mongo.utf8 = ${PHP.mongo.utf8} 375 | 376 | [msql] 377 | msql.allow_persistent = ${PHP.msql.allow_persistent} 378 | msql.max_links = ${PHP.msql.max_links} 379 | msql.max_persistent = ${PHP.msql.max_persistent} 380 | 381 | [mssql] 382 | mssql.allow_persistent = ${PHP.mssql.allow_persistent} 383 | mssql.batchsize = ${PHP.mssql.batchsize} 384 | mssql.charset = ${PHP.mssql.charset} 385 | mssql.compatability_mode = ${PHP.mssql.compatability_mode} 386 | mssql.connect_timeout = ${PHP.mssql.connect_timeout} 387 | mssql.datetimeconvert = ${PHP.mssql.datetimeconvert} 388 | mssql.max_links = ${PHP.mssql.max_links} 389 | mssql.max_persistent = ${PHP.mssql.max_persistent} 390 | mssql.max_procs = ${PHP.mssql.max_procs} 391 | mssql.min_error_severity = ${PHP.mssql.min_error_severity} 392 | mssql.min_message_severity = ${PHP.mssql.min_message_severity} 393 | mssql.secure_connection = ${PHP.mssql.secure_connection} 394 | mssql.textlimit = ${PHP.mssql.textlimit} 395 | mssql.textsize = ${PHP.mssql.textsize} 396 | mssql.timeout = ${PHP.mssql.timeout} 397 | 398 | [mysql] 399 | mysql.allow_local_infile = ${PHP.mysql.allow_local_infile} 400 | mysql.allow_persistent = ${PHP.mysql.allow_persistent} 401 | mysql.max_persistent = ${PHP.mysql.max_persistent} 402 | mysql.max_links = ${PHP.mysql.max_links} 403 | mysql.trace_mode = ${PHP.mysql.trace_mode} 404 | mysql.default_port = ${PHP.mysql.default_port} 405 | mysql.default_socket = ${PHP.mysql.default_socket} 406 | mysql.default_host = ${PHP.mysql.default_host} 407 | mysql.default_user = ${PHP.mysql.default_user} 408 | mysql.default_password = ${PHP.mysql.default_password} 409 | mysql.connect_timeout = ${PHP.mysql.connect_timeout} 410 | 411 | [mysqli] 412 | mysqli.allow_local_infile = ${PHP.mysqli.allow_local_infile} 413 | mysqli.allow_persistent = ${PHP.mysqli.allow_persistent} 414 | mysqli.max_persistent = ${PHP.mysqli.max_persistent} 415 | mysqli.max_links = ${PHP.mysqli.max_links} 416 | mysqli.default_port = ${PHP.mysqli.default_port} 417 | mysqli.default_socket = ${PHP.mysqli.default_socket} 418 | mysqli.default_host = ${PHP.mysqli.default_host} 419 | mysqli.default_user = ${PHP.mysqli.default_user} 420 | mysqli.default_pw = ${PHP.mysqli.default_pw} 421 | mysqli.reconnect = ${PHP.mysqli.reconnect} 422 | mysqli.cache_size = ${PHP.mysqli.cache_size} 423 | 424 | [mysqlnd_memcache] 425 | mysqlnd_memcache.enable = ${PHP.mysqlnd_memcache.enable} 426 | 427 | [mysqlnd_ms] 428 | mysqlnd_ms.enable = ${PHP.mysqlnd_ms.enable} 429 | mysqlnd_ms.force_config_usage = ${PHP.mysqlnd_ms.force_config_usage} 430 | mysqlnd_ms.ini_file = ${PHP.mysqlnd_ms.ini_file} 431 | mysqlnd_ms.config_file = ${PHP.mysqlnd_ms.config_file} 432 | mysqlnd_ms.collect_statistics = ${PHP.mysqlnd_ms.collect_statistics} 433 | mysqlnd_ms.multi_master = ${PHP.mysqlnd_ms.multi_master} 434 | mysqlnd_ms.disable_rw_split = ${PHP.mysqlnd_ms.disable_rw_split} 435 | 436 | [mysqlnd_mux] 437 | mysqlnd_mux.enable = ${PHP.mysqlnd_mux.enable} 438 | 439 | [mysqlnd_qc] 440 | mysqlnd_qc.enable_qc = ${PHP.mysqlnd_qc.enable_qc} 441 | mysqlnd_qc.ttl = ${PHP.mysqlnd_qc.ttl} 442 | mysqlnd_qc.cache_by_default = ${PHP.mysqlnd_qc.cache_by_default} 443 | mysqlnd_qc.cache_no_table = ${PHP.mysqlnd_qc.cache_no_table} 444 | mysqlnd_qc.use_request_time = ${PHP.mysqlnd_qc.use_request_time} 445 | mysqlnd_qc.time_statistics = ${PHP.mysqlnd_qc.time_statistics} 446 | mysqlnd_qc.collect_statistics = ${PHP.mysqlnd_qc.collect_statistics} 447 | mysqlnd_qc.collect_statistics_log_file = ${PHP.mysqlnd_qc.collect_statistics_log_file} 448 | mysqlnd_qc.collect_query_trace = ${PHP.mysqlnd_qc.collect_query_trace} 449 | mysqlnd_qc.query_trace_bt_depth = ${PHP.mysqlnd_qc.query_trace_bt_depth} 450 | mysqlnd_qc.collect_normalized_query_trace = ${PHP.mysqlnd_qc.collect_normalized_query_trace} 451 | mysqlnd_qc.ignore_sql_comments = ${PHP.mysqlnd_qc.ignore_sql_comments} 452 | mysqlnd_qc.slam_defense = ${PHP.mysqlnd_qc.slam_defense} 453 | mysqlnd_qc.slam_defense_ttl = ${PHP.mysqlnd_qc.slam_defense_ttl} 454 | mysqlnd_qc.std_data_copy = ${PHP.mysqlnd_qc.std_data_copy} 455 | mysqlnd_qc.apc_prefix = ${PHP.mysqlnd_qc.apc_prefix} 456 | mysqlnd_qc.memc_server = ${PHP.mysqlnd_qc.memc_server} 457 | mysqlnd_qc.memc_port = ${PHP.mysqlnd_qc.memc_port} 458 | mysqlnd_qc.sqlite_data_file = ${PHP.mysqlnd_qc.sqlite_data_file} 459 | 460 | [mysqlnd_uh] 461 | mysqlnd_uh.enable = ${PHP.mysqlnd_uh.enable} 462 | mysqlnd_uh.report_wrong_types = ${PHP.mysqlnd_uh.report_wrong_types} 463 | 464 | [nsapi] 465 | nsapi.read_timeout = ${PHP.nsapi.read_timeout} 466 | 467 | [oci8] 468 | oci8.connection_class = ${PHP.oci8.connection_class} 469 | oci8.default_prefetch = ${PHP.oci8.default_prefetch} 470 | oci8.events = ${PHP.oci8.events} 471 | oci8.max_persistent = ${PHP.oci8.max_persistent} 472 | oci8.old_oci_close_semantics = ${PHP.oci8.old_oci_close_semantics} 473 | oci8.persistent_timeout = ${PHP.oci8.persistent_timeout} 474 | oci8.ping_interval = ${PHP.oci8.ping_interval} 475 | oci8.privileged_connect = ${PHP.oci8.privileged_connect} 476 | oci8.statement_cache_size = ${PHP.oci8.statement_cache_size} 477 | 478 | [odbc] 479 | odbc.allow_persistent = ${PHP.odbc.allow_persistent} 480 | odbc.check_persistent = ${PHP.odbc.check_persistent} 481 | odbc.defaultbinmode = ${PHP.odbc.defaultbinmode} 482 | odbc.defaultlrl = ${PHP.odbc.defaultlrl} 483 | odbc.default_db = ${PHP.odbc.default_db} 484 | odbc.default_pw = ${PHP.odbc.default_pw} 485 | odbc.default_user = ${PHP.odbc.default_user} 486 | odbc.max_links = ${PHP.odbc.max_links} 487 | odbc.max_persistent = ${PHP.odbc.max_persistent} 488 | 489 | [odbtp] 490 | odbtp.datetime_format = ${PHP.odbtp.datetime_format} 491 | odbtp.detach_default_queries = ${PHP.odbtp.detach_default_queries} 492 | odbtp.guid_format = ${PHP.odbtp.guid_format} 493 | odbtp.interface_file = ${PHP.odbtp.interface_file} 494 | odbtp.truncation_errors = ${PHP.odbtp.truncation_errors} 495 | 496 | [opcache] 497 | opcache.blacklist_filename = ${PHP.opcache.blacklist_filename} 498 | opcache.consistency_checks = ${PHP.opcache.consistency_checks} 499 | opcache.dups_fix = ${PHP.opcache.dups_fix} 500 | opcache.enable = ${PHP.opcache.enable} 501 | opcache.enable_cli = ${PHP.opcache.enable_cli} 502 | opcache.enable_file_override = ${PHP.opcache.enable_file_override} 503 | opcache.error_log = ${PHP.opcache.error_log} 504 | opcache.fast_shutdown = ${PHP.opcache.fast_shutdown} 505 | opcache.file_update_protection = ${PHP.opcache.file_update_protection} 506 | opcache.force_restart_timeout = ${PHP.opcache.force_restart_timeout} 507 | opcache.inherited_hack = ${PHP.opcache.inherited_hack} 508 | opcache.interned_strings_buffer = ${PHP.opcache.interned_strings_buffer} 509 | opcache.load_comments = ${PHP.opcache.load_comments} 510 | opcache.log_verbosity_level = ${PHP.opcache.log_verbosity_level} 511 | opcache.max_accelerated_files = ${PHP.opcache.max_accelerated_files} 512 | opcache.max_file_size = ${PHP.opcache.max_file_size} 513 | opcache.max_wasted_percentage = ${PHP.opcache.max_wasted_percentage} 514 | opcache.memory_consumption = ${PHP.opcache.memory_consumption} 515 | opcache.mmap_base = ${PHP.opcache.mmap_base} 516 | opcache.optimization_level = ${PHP.opcache.optimization_level} 517 | opcache.preferred_memory_model = ${PHP.opcache.preferred_memory_model} 518 | opcache.protect_memory = ${PHP.opcache.protect_memory} 519 | opcache.revalidate_freq = ${PHP.opcache.revalidate_freq} 520 | opcache.revalidate_path = ${PHP.opcache.revalidate_path} 521 | opcache.save_comments = ${PHP.opcache.save_comments} 522 | opcache.use_cwd = ${PHP.opcache.use_cwd} 523 | opcache.validate_timestamps = ${PHP.opcache.validate_timestamps} 524 | 525 | [opendirectory] 526 | opendirectory.max_refs = ${PHP.opendirectory.max_refs} 527 | opendirectory.separator = ${PHP.opendirectory.separator} 528 | 529 | [pam] 530 | pam.servicename = ${PHP.pam.servicename} 531 | 532 | [pcre] 533 | pcre.backtrack_limit = ${PHP.pcre.backtrack_limit} 534 | pcre.recursion_limit = ${PHP.pcre.recursion_limit} 535 | 536 | [pdo] 537 | pdo.dsn.* = ${PHP.pdo.dsn.*} 538 | 539 | [pdo_odbc] 540 | pdo_odbc.connection_pooling = ${PHP.pdo_odbc.connection_pooling} 541 | 542 | [pgsql] 543 | pgsql.allow_persistent = ${PHP.pgsql.allow_persistent} 544 | pgsql.auto_reset_persistent = ${PHP.pgsql.auto_reset_persistent} 545 | pgsql.ignore_notice = ${PHP.pgsql.ignore_notice} 546 | pgsql.log_notice = ${PHP.pgsql.log_notice} 547 | pgsql.max_links = ${PHP.pgsql.max_links} 548 | pgsql.max_persistent = ${PHP.pgsql.max_persistent} 549 | 550 | [phar] 551 | phar.extract_list = ${PHP.phar.extract_list} 552 | phar.readonly = ${PHP.phar.readonly} 553 | phar.require_hash = ${PHP.phar.require_hash} 554 | 555 | [python] 556 | python.append_path = ${PHP.python.append_path} 557 | python.prepend_path = ${PHP.python.prepend_path} 558 | 559 | [runkit] 560 | runkit.internal_override = ${PHP.runkit.internal_override} 561 | runkit.superglobal = ${PHP.runkit.superglobal} 562 | 563 | [session] 564 | session.auto_start = ${PHP.session.auto_start} 565 | session.cache_expire = ${PHP.session.cache_expire} 566 | session.cache_limiter = ${PHP.session.cache_limiter} 567 | session.cookie_domain = ${PHP.session.cookie_domain} 568 | session.cookie_httponly = ${PHP.session.cookie_httponly} 569 | session.cookie_lifetime = ${PHP.session.cookie_lifetime} 570 | session.cookie_path = ${PHP.session.cookie_path} 571 | session.cookie_secure = ${PHP.session.cookie_secure} 572 | session.entropy_file = ${PHP.session.entropy_file} 573 | session.entropy_length = ${PHP.session.entropy_length} 574 | session.gc_divisor = ${PHP.session.gc_divisor} 575 | session.gc_maxlifetime = ${PHP.session.gc_maxlifetime} 576 | session.gc_probability = ${PHP.session.gc_probability} 577 | session.hash_bits_per_character = ${PHP.session.hash_bits_per_character} 578 | session.hash_function = ${PHP.session.hash_function} 579 | session.name = ${PHP.session.name} 580 | session.referer_check = ${PHP.session.referer_check} 581 | session.save_handler = ${PHP.session.save_handler} 582 | session.save_path = ${PHP.session.save_path} 583 | session.serialize_handler = ${PHP.session.serialize_handler} 584 | session.use_cookies = ${PHP.session.use_cookies} 585 | session.use_only_cookies = ${PHP.session.use_only_cookies} 586 | session.use_trans_sid = ${PHP.session.use_trans_sid} 587 | 588 | [session_pgsql] 589 | session_pgsql.create_table = ${PHP.session_pgsql.create_table} 590 | session_pgsql.db = ${PHP.session_pgsql.db} 591 | session_pgsql.disable = ${PHP.session_pgsql.disable} 592 | session_pgsql.failover_mode = ${PHP.session_pgsql.failover_mode} 593 | session_pgsql.gc_interval = ${PHP.session_pgsql.gc_interval} 594 | session_pgsql.keep_expired = ${PHP.session_pgsql.keep_expired} 595 | session_pgsql.sem_file_name = ${PHP.session_pgsql.sem_file_name} 596 | session_pgsql.serializable = ${PHP.session_pgsql.serializable} 597 | session_pgsql.short_circuit = ${PHP.session_pgsql.short_circuit} 598 | session_pgsql.use_app_vars = ${PHP.session_pgsql.use_app_vars} 599 | session_pgsql.vacuum_interval = ${PHP.session_pgsql.vacuum_interval} 600 | 601 | [simple_cvs] 602 | simple_cvs.authMethod = ${PHP.simple_cvs.authMethod} 603 | simple_cvs.compressionLevel = ${PHP.simple_cvs.compressionLevel} 604 | simple_cvs.cvsRoot = ${PHP.simple_cvs.cvsRoot} 605 | simple_cvs.host = ${PHP.simple_cvs.host} 606 | simple_cvs.moduleName = ${PHP.simple_cvs.moduleName} 607 | simple_cvs.userName = ${PHP.simple_cvs.userName} 608 | simple_cvs.workingDir = ${PHP.simple_cvs.workingDir} 609 | 610 | [soap] 611 | soap.wsdl_cache = ${PHP.soap.wsdl_cache} 612 | soap.wsdl_cache_dir = ${PHP.soap.wsdl_cache_dir} 613 | soap.wsdl_cache_enabled = ${PHP.soap.wsdl_cache_enabled} 614 | soap.wsdl_cache_limit = ${PHP.soap.wsdl_cache_limit} 615 | soap.wsdl_cache_ttl = ${PHP.soap.wsdl_cache_ttl} 616 | 617 | [sql] 618 | sql.safe_mode = ${PHP.sql.safe_mode} 619 | 620 | [sqlite] 621 | sqlite.assoc_case = ${PHP.sqlite.assoc_case} 622 | 623 | [sybase] 624 | sybase.allow_persistent = ${PHP.sybase.allow_persistent} 625 | sybase.interface_file = ${PHP.sybase.interface_file} 626 | sybase.max_links = ${PHP.sybase.max_links} 627 | sybase.max_persistent = ${PHP.sybase.max_persistent} 628 | sybase.min_error_severity = ${PHP.sybase.min_error_severity} 629 | sybase.min_message_severity = ${PHP.sybase.min_message_severity} 630 | 631 | [sybct] 632 | sybct.deadlock_retry_count = ${PHP.sybct.deadlock_retry_count} 633 | sybct.login_timeout = ${PHP.sybct.login_timeout} 634 | sybct.packet_size = ${PHP.sybct.packet_size} 635 | sybct.timeout = ${PHP.sybct.timeout} 636 | 637 | [sysvshm] 638 | sysvshm.init_mem = ${PHP.sysvshm.init_mem} 639 | 640 | [tidy] 641 | tidy.clean_output = ${PHP.tidy.clean_output} 642 | tidy.default_config = ${PHP.tidy.default_config} 643 | 644 | [uploadprogress] 645 | uploadprogress.file.filename_template = ${PHP.uploadprogress.file.filename_template} 646 | 647 | [url_rewriter] 648 | url_rewriter.tags = ${PHP.url_rewriter.tags} 649 | 650 | [user_ini] 651 | user_ini.cache_ttl = ${PHP.user_ini.cache_ttl} 652 | user_ini.filename = ${PHP.user_ini.filename} 653 | 654 | [valkyrie] 655 | valkyrie.auto_validate = ${PHP.valkyrie.auto_validate} 656 | valkyrie.config_path = ${PHP.valkyrie.config_path} 657 | 658 | [vld] 659 | vld.active = ${PHP.vld.active} 660 | vld.execute = ${PHP.vld.execute} 661 | vld.skip_append = ${PHP.vld.skip_append} 662 | vld.skip_prepend = ${PHP.vld.skip_prepend} 663 | 664 | [xdebug] 665 | xdebug.cli_color = ${PHP.xdebug.cli_color} 666 | xdebug.client_discovery_header = ${PHP.xdebug.client_discovery_header} 667 | xdebug.client_host = ${PHP.xdebug.client_host} 668 | xdebug.client_port = ${PHP.xdebug.client_port} 669 | xdebug.collect_assignments = ${PHP.xdebug.collect_assignments} 670 | xdebug.collect_return = ${PHP.xdebug.collect_return} 671 | xdebug.connect_timeout_ms = ${PHP.xdebug.connect_timeout_ms} 672 | xdebug.discover_client_host = ${PHP.xdebug.discover_client_host} 673 | xdebug.default_enable = ${PHP.xdebug.default_enable} 674 | xdebug.dump.ENV = ${PHP.xdebug.dump.ENV} 675 | xdebug.dump.FILES = ${PHP.xdebug.dump.FILES} 676 | xdebug.dump.GET = ${PHP.xdebug.dump.GET} 677 | xdebug.dump.POST = ${PHP.xdebug.dump.POST} 678 | xdebug.dump.REQUEST = ${PHP.xdebug.dump.REQUEST} 679 | xdebug.dump.SERVER = ${PHP.xdebug.dump.SERVER} 680 | xdebug.dump.SESSION = ${PHP.xdebug.dump.SESSION} 681 | xdebug.dump_globals = ${PHP.xdebug.dump_globals} 682 | xdebug.dump_once = ${PHP.xdebug.dump_once} 683 | xdebug.dump_undefined = ${PHP.xdebug.dump_undefined} 684 | xdebug.file_link_format = ${PHP.xdebug.file_link_format} 685 | xdebug.filename_format = ${PHP.xdebug.filename_format} 686 | xdebug.force_display_errors = ${PHP.xdebug.force_display_errors} 687 | xdebug.force_error_reporting = ${PHP.xdebug.force_error_reporting} 688 | xdebug.halt_level = ${PHP.xdebug.halt_level} 689 | xdebug.idekey = ${PHP.xdebug.idekey} 690 | xdebug.log = ${PHP.xdebug.log} 691 | xdebug.log_level = ${PHP.xdebug.log_level} 692 | xdebug.max_nesting_level = ${PHP.xdebug.max_nesting_level} 693 | xdebug.max_stack_frames = ${PHP.xdebug.max_stack_frames} 694 | xdebug.mode = ${PHP.xdebug.mode} 695 | xdebug.output_dir = ${PHP.xdebug.output_dir} 696 | xdebug.profiler_aggregate = ${PHP.xdebug.profiler_aggregate} 697 | xdebug.profiler_append = ${PHP.xdebug.profiler_append} 698 | xdebug.profiler_output_name = ${PHP.xdebug.profiler_output_name} 699 | xdebug.remote_cookie_expire_time = ${PHP.xdebug.remote_cookie_expire_time} 700 | xdebug.scream = ${PHP.xdebug.scream} 701 | xdebug.show_error_trace = ${PHP.xdebug.show_error_trace} 702 | xdebug.show_exception_trace = ${PHP.xdebug.show_exception_trace} 703 | xdebug.show_local_vars = ${PHP.xdebug.show_local_vars} 704 | xdebug.start_with_request = ${PHP.xdebug.start_with_request} 705 | xdebug.trace_format = ${PHP.xdebug.trace_format} 706 | xdebug.trace_options = ${PHP.xdebug.trace_options} 707 | xdebug.trace_output_name = ${PHP.xdebug.trace_output_name} 708 | xdebug.trigger_value = ${PHP.xdebug.trigger_value} 709 | xdebug.var_display_max_children = ${PHP.xdebug.var_display_max_children} 710 | xdebug.var_display_max_data = ${PHP.xdebug.var_display_max_data} 711 | xdebug.var_display_max_depth = ${PHP.xdebug.var_display_max_depth} 712 | 713 | [xmms] 714 | xmms.path = ${PHP.xmms.path} 715 | xmms.session = ${PHP.xmms.session} 716 | 717 | [yami] 718 | yami.response.timeout = ${PHP.yami.response.timeout} 719 | 720 | [yaz] 721 | yaz.keepalive = ${PHP.yaz.keepalive} 722 | yaz.log_mask = ${PHP.yaz.log_mask} 723 | 724 | [zend] 725 | zend.enable_gc = ${PHP.zend.enable_gc} 726 | zend.multibyte = ${PHP.zend.multibyte} 727 | zend.script_encoding = ${PHP.zend.script_encoding} 728 | zend.signal_check = ${PHP.zend.signal_check} 729 | 730 | [zlib] 731 | zlib.output_compression = ${PHP.zlib.output_compression} 732 | zlib.output_compression_level = ${PHP.zlib.output_compression_level} 733 | zlib.output_handler = ${PHP.zlib.output_handler} 734 | -------------------------------------------------------------------------------- /files/php/xdebug: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Prevent empty PHP_INI_SCAN_DIR 4 | # The below in docker-compose.yml sets value to literal "", so remove quotes 5 | # environment: 6 | # - PHP_INI_SCAN_DIR="" 7 | PHP_INI_SCAN_DIR=${PHP_INI_SCAN_DIR:-""} 8 | PHP_INI_SCAN_DIR=$(echo "${PHP_INI_SCAN_DIR}" | tr -d '"' | tr -d "'") 9 | 10 | # Prevent defining xdebug INI location twice 11 | if [[ ${PHP_INI_SCAN_DIR} != *"xdebug"* ]]; then 12 | PHP_INI_SCAN_DIR=${PHP_INI_SCAN_DIR}:/p/xdebug 13 | fi 14 | 15 | PHP_INI_SCAN_DIR=${PHP_INI_SCAN_DIR} \ 16 | XDEBUG_MODE=debug XDEBUG_SESSION=xdebug php -dxdebug.mode=debug "$@" 17 | -------------------------------------------------------------------------------- /test: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -o pipefail 3 | 4 | PHP_VERSION="${1}" 5 | PHP_MAJOR=$(echo ${PHP_VERSION} | cut -d . -f -2) 6 | CLI="jtreminio/php-cli:${PHP_VERSION}" 7 | FPM="jtreminio/php:${PHP_VERSION}" 8 | APACHE="jtreminio/php-apache:${PHP_VERSION}" 9 | NGINX="jtreminio/php-nginx:${PHP_VERSION}" 10 | 11 | DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 12 | FAIL='\033[0;31m[FAIL]\033[0m\n' 13 | PASS='\033[0;32m[PASS]\033[0m\n' 14 | 15 | if [[ -z "${PHP_VERSION// }" ]]; then 16 | cat << EOF 17 | Usage: test PHP_VERSION 18 | Run tests against all Docker images 19 | 20 | Example: test 7.2.25 21 | Runs tests against - jtreminio:php-cli:7.2.25 22 | - jtreminio:php:7.2.25 23 | - jtreminio:php-apache:7.2.25 24 | - jtreminio:php-nginx:7.2.25 25 | EOF 26 | 27 | exit 1 28 | fi 29 | 30 | ### 31 | 32 | # Setup network 33 | create_test_network() { 34 | NAME=jtreminio_testing 35 | FOUND=$(docker network ls --filter name=${NAME} | grep -c ${NAME} || true) 36 | if [[ ${FOUND} -eq 0 ]]; then 37 | docker network create --driver bridge ${NAME} > /dev/null 2>&1 38 | fi 39 | } 40 | 41 | rm_test_network() { 42 | NAME=jtreminio_testing 43 | FOUND=$(docker network ls --filter name=${NAME} | grep -c ${NAME} || true) 44 | if [[ ${FOUND} -ne 0 ]]; then 45 | docker network rm ${NAME} > /dev/null 2>&1 46 | fi 47 | } 48 | 49 | run_fpm_container() { 50 | ENVFLAG="" 51 | if [[ ! -z "${1:-}" ]]; then 52 | ENVFLAG="-e ${1}" 53 | fi 54 | 55 | docker container run --rm -d \ 56 | --name jtreminio_fpm_test \ 57 | --network jtreminio_testing \ 58 | -v ${DIR}/testing/index.php:/var/www/index.php \ 59 | ${ENVFLAG} \ 60 | ${FPM} \ 61 | bash -c '/usr/sbin/php-fpm -F' > /dev/null 2>&1 62 | } 63 | 64 | rm_fpm_container() { 65 | NAME=jtreminio_fpm_test 66 | FOUND=$(docker container ls --filter name=${NAME} | grep -c ${NAME} || true) 67 | if [[ ${FOUND} -ne 0 ]]; then 68 | docker container rm -f ${NAME} > /dev/null 2>&1 69 | fi 70 | } 71 | 72 | run_fcgi_container() { 73 | SETTING="${1}" 74 | 75 | docker container run --rm \ 76 | --name jtreminio_test_runner \ 77 | --network jtreminio_testing \ 78 | jtreminio/test-runner \ 79 | /bin/sh -c "SCRIPT_FILENAME=/var/www/index.php \ 80 | REQUEST_METHOD=GET \ 81 | QUERY_STRING=\"setting=${SETTING}\" \ 82 | cgi-fcgi -bind -connect jtreminio_fpm_test:9000" 83 | } 84 | 85 | fail_if_0() { 86 | RESULT="${1}" 87 | 88 | if [[ ${RESULT} -eq 0 ]]; then 89 | printf " ${FAIL}" 90 | exit 1 91 | else 92 | printf " ${PASS}" 93 | fi 94 | } 95 | 96 | fail_if_1() { 97 | RESULT="${1}" 98 | 99 | if [[ ${RESULT} -ne 0 ]]; then 100 | printf " ${FAIL}" 101 | exit 1 102 | else 103 | printf " ${PASS}" 104 | fi 105 | } 106 | 107 | printf "Testing PHP ${PHP_MAJOR} / ${PHP_VERSION}\n\n" 108 | 109 | create_test_network 110 | 111 | ### 112 | 113 | printf "[CLI] Check version correct [${PHP_VERSION}]" 114 | EXPECTS=${PHP_VERSION} 115 | CMD=$( 116 | docker container run --rm \ 117 | ${CLI} php -v 118 | ) 119 | fail_if_0 $(echo "${CMD}" | grep -c "${EXPECTS}") 120 | 121 | printf "[FPM] Check version correct [${PHP_VERSION}]" 122 | EXPECTS=${PHP_VERSION} 123 | run_fpm_container 124 | CMD=$(run_fcgi_container version) 125 | rm_fpm_container 126 | fail_if_0 $(echo "${CMD}" | grep -c "${EXPECTS}") 127 | 128 | ### 129 | 130 | printf "[CLI] Check custom INI loaded" 131 | EXPECTS="/etc/php/${PHP_MAJOR}/cli/conf.d/98-env.ini" 132 | CMD=$( 133 | docker container run --rm \ 134 | ${CLI} php --ini 135 | ) 136 | fail_if_0 $(echo "${CMD}" | grep -c "${EXPECTS}") 137 | 138 | printf "[FPM] Check custom INI loaded" 139 | EXPECTS="/etc/php/${PHP_MAJOR}/fpm/conf.d/98-env.ini" 140 | run_fpm_container 141 | CMD=$(run_fcgi_container) 142 | rm_fpm_container 143 | fail_if_0 $(echo "${CMD}" | grep -c "${EXPECTS}") 144 | 145 | ### 146 | 147 | printf "[CLI] Check FPM INI not loaded" 148 | EXPECTS="/etc/php/${PHP_MAJOR}/fpm/conf.d/98-env.ini" 149 | CMD=$( 150 | docker container run --rm \ 151 | ${CLI} php --ini 152 | ) 153 | fail_if_1 $(echo "${CMD}" | grep -c "${EXPECTS}") 154 | 155 | printf "[FPM] Check CLI INI not loaded" 156 | EXPECTS="/etc/php/${PHP_MAJOR}/cli/conf.d/98-env.ini" 157 | run_fpm_container 158 | CMD=$(run_fcgi_container) 159 | rm_fpm_container 160 | fail_if_1 $(echo "${CMD}" | grep -c "${EXPECTS}") 161 | 162 | ### 163 | 164 | printf "[CLI] Check custom INI loaded" 165 | EXPECTS="/etc/php/${PHP_MAJOR}/cli/conf.d/99-custom.ini" 166 | CMD=$( 167 | docker container run --rm \ 168 | ${CLI} php --ini 169 | ) 170 | fail_if_0 $(echo "${CMD}" | grep -c "${EXPECTS}") 171 | 172 | printf "[FPM] Check custom INI loaded" 173 | EXPECTS="/etc/php/${PHP_MAJOR}/fpm/conf.d/99-custom.ini" 174 | run_fpm_container 175 | CMD=$(run_fcgi_container) 176 | rm_fpm_container 177 | fail_if_0 $(echo "${CMD}" | grep -c "${EXPECTS}") 178 | 179 | ### 180 | 181 | printf "[CLI] Check display_errors set to default value [Off]" 182 | EXPECTS="Off" 183 | CMD=$( 184 | docker container run --rm \ 185 | ${CLI} php -r "echo ini_get('display_errors');" 186 | ) 187 | fail_if_0 $(echo "${CMD}" | grep -c "${EXPECTS}") 188 | 189 | printf "[FPM] Check display_errors set to default value [Off]" 190 | EXPECTS="Off" 191 | run_fpm_container 192 | CMD=$(run_fcgi_container display_errors) 193 | rm_fpm_container 194 | fail_if_0 $(echo "${CMD}" | grep -c "${EXPECTS}") 195 | 196 | ### 197 | 198 | printf "[CLI] Check display_errors accepts override value [On]" 199 | EXPECTS="On" 200 | CMD=$( 201 | docker container run --rm \ 202 | -e PHP.display_errors=On \ 203 | ${CLI} php -r "echo ini_get('display_errors');" 204 | ) 205 | fail_if_0 $(echo "${CMD}" | grep -c "${EXPECTS}") 206 | 207 | printf "[FPM] Check display_errors accepts override value [On]" 208 | EXPECTS="On" 209 | run_fpm_container "PHP.display_errors=On" 210 | CMD=$(run_fcgi_container display_errors) 211 | rm_fpm_container 212 | fail_if_0 $(echo "${CMD}" | grep -c "${EXPECTS}") 213 | 214 | ### 215 | 216 | printf "[CLI] Check Xdebug not loaded by default" 217 | EXPECTS="Xdebug" 218 | CMD=$( 219 | docker container run --rm \ 220 | ${CLI} php -v 221 | ) 222 | fail_if_1 $(echo "${CMD}" | grep -c "${EXPECTS}") 223 | 224 | printf "[FPM] Check Xdebug not loaded by default" 225 | EXPECTS="Xdebug" 226 | run_fpm_container 227 | CMD=$(run_fcgi_container) 228 | rm_fpm_container 229 | fail_if_1 $(echo "${CMD}" | grep -c "${EXPECTS}") 230 | 231 | ### 232 | 233 | printf "[CLI] Check Xdebug loaded by env var" 234 | EXPECTS="Xdebug" 235 | CMD=$( 236 | docker container run --rm \ 237 | -e PHP_INI_SCAN_DIR=:/p/xdebug \ 238 | ${CLI} php -v 239 | ) 240 | fail_if_0 $(echo "${CMD}" | grep -c "${EXPECTS}") 241 | 242 | printf "[FPM] Check Xdebug loaded by env var" 243 | EXPECTS="Xdebug" 244 | run_fpm_container "PHP_INI_SCAN_DIR=:/p/xdebug" 245 | CMD=$(run_fcgi_container) 246 | rm_fpm_container 247 | fail_if_0 $(echo "${CMD}" | grep -c "${EXPECTS}") 248 | 249 | ### 250 | 251 | printf "[CLI] Check Xdebug CLI auto-sets PHP_INI_SCAN_DIR" 252 | EXPECTS="/p/xdebug/xdebug.ini" 253 | CMD=$( 254 | docker container run --rm \ 255 | -e PHP_INI_SCAN_DIR=:/p/xdebug \ 256 | ${CLI} php --ini 257 | ) 258 | fail_if_0 $(echo "${CMD}" | grep -c "${EXPECTS}") 259 | 260 | rm_fpm_container 261 | rm_test_network 262 | -------------------------------------------------------------------------------- /testing/Dockerfile-runner: -------------------------------------------------------------------------------- 1 | FROM alpine:3.7 2 | RUN apk add --no-cache fcgi 3 | 4 | -------------------------------------------------------------------------------- /testing/index.php: -------------------------------------------------------------------------------- 1 |