Skip to content

Updates for apache 2.4 #154

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions sapi/apache2filter/sapi_apache2.c
Original file line number Diff line number Diff line change
Expand Up @@ -606,11 +606,17 @@ static int
php_apache_server_startup(apr_pool_t *pconf, apr_pool_t *plog,
apr_pool_t *ptemp, server_rec *s)
{

#if AP_MODULE_MAGIC_AT_LEAST(20110203,1)
/* Apache will load, unload and then reload a DSO module. This
* prevents us from starting PHP until the second load. */
if (ap_state_query(AP_SQ_MAIN_STATE) == AP_SQ_MS_CREATE_PRE_CONFIG) {
return OK;
}
#else
void *data = NULL;
const char *userdata_key = "apache2filter_post_config";

/* Apache will load, unload and then reload a DSO module. This
* prevents us from starting PHP until the second load. */
apr_pool_userdata_get(&data, userdata_key, s->process->pool);
if (data == NULL) {
/* We must use set() here and *not* setn(), otherwise the
Expand All @@ -622,6 +628,7 @@ php_apache_server_startup(apr_pool_t *pconf, apr_pool_t *plog,
apr_pool_cleanup_null, s->process->pool);
return OK;
}
#endif

/* Set up our overridden path. */
if (apache2_php_ini_path_override) {
Expand Down Expand Up @@ -744,6 +751,9 @@ static size_t php_apache_fsizer_stream(void *handle TSRMLS_DC)
return 0;
}

#ifdef APLOG_USE_MODULE
APLOG_USE_MODULE(php5);
#endif
AP_MODULE_DECLARE_DATA module php5_module = {
STANDARD20_MODULE_STUFF,
create_php_config, /* create per-directory config structure */
Expand Down
4 changes: 4 additions & 0 deletions sapi/apache2handler/mod_php5.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
#include "php.h"
#include "php_apache.h"

#ifdef APLOG_USE_MODULE
APLOG_USE_MODULE(php5);
#endif

AP_MODULE_DECLARE_DATA module php5_module = {
STANDARD20_MODULE_STUFF,
create_php_config, /* create per-directory config structure */
Expand Down
12 changes: 10 additions & 2 deletions sapi/apache2handler/sapi_apache2.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,12 +430,19 @@ static int php_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp
static int
php_apache_server_startup(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)
{
void *data = NULL;
const char *userdata_key = "apache2hook_post_config";

#if AP_MODULE_MAGIC_AT_LEAST(20110203,1)
/* Apache will load, unload and then reload a DSO module. This
* prevents us from starting PHP until the second load. */
if (ap_state_query(AP_SQ_MAIN_STATE) == AP_SQ_MS_CREATE_PRE_CONFIG) {
return OK;
}
#else
void *data = NULL;
const char *userdata_key = "apache2hook_post_config";

apr_pool_userdata_get(&data, userdata_key, s->process->pool);

if (data == NULL) {
/* We must use set() here and *not* setn(), otherwise the
* static string pointed to by userdata_key will be mapped
Expand All @@ -445,6 +452,7 @@ php_apache_server_startup(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp
apr_pool_userdata_set((const void *)1, userdata_key, apr_pool_cleanup_null, s->process->pool);
return OK;
}
#endif

/* Set up our overridden path. */
if (apache2_php_ini_path_override) {
Expand Down
4 changes: 2 additions & 2 deletions sapi/fpm/fpm/fpm_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1077,7 +1077,7 @@ static int fpm_conf_process_all_pools() /* {{{ */

int fpm_conf_unlink_pid() /* {{{ */
{
if (fpm_global_config.pid_file) {
if (!fpm_global_config.daemonize && fpm_global_config.pid_file) {
if (0 > unlink(fpm_global_config.pid_file)) {
zlog(ZLOG_SYSERROR, "Unable to remove the PID file (%s).", fpm_global_config.pid_file);
return -1;
Expand All @@ -1091,7 +1091,7 @@ int fpm_conf_write_pid() /* {{{ */
{
int fd;

if (fpm_global_config.pid_file) {
if (!fpm_global_config.daemonize && fpm_global_config.pid_file) {
char buf[64];
int len;

Expand Down