-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fetch correct _module_id value in apache::mod::php #2163
Conversation
[CentOS, can't speak for other distros] The _module_id works fine with PHP from standard repo's. However, the PHP version in those repositories is usually old, and sometimes you need a newer PHP version, one often uses the Remi repository. If you want to use e.g. php74, it will be installed without issues, but Apache will not load: ``` class { 'apache::mod::php': package_name => 'php74', php_version => '74', } ``` ``` Jul 01 10:52:14 gcp-nco-web-101 httpd[17830]: httpd: Syntax error on line 40 of /etc/httpd/conf/httpd.conf: Syntax error on line 1 of /etc/httpd/conf.modules.d/php7.4.load: Cannot load modules/libphp7.4.so into server: /etc/httpd/modules/libphp7.4.so: cannot open shared object file: No such file or directory ``` ``` # cat /etc/httpd/conf.modules.d/php.load LoadModule php_module modules/libphp74.so ``` This happens because `$_php_major` isn't matching `7`, but `74`. Therefore `$_module_id` defaults to `php_module` instead of using `php7_module` and Apache not start. If a regex is used to match `/^7/`, the `php.load` file will be properly configured and Apache will start: ``` # cat /etc/httpd/conf.modules.d/php.load LoadModule php7_module modules/libphp74.so ```
Fetch correct _module_id value in apache::mod::php
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the problem is that you pass the version as 74
but you should really pass 7.4
. As you can see, it compares the major version. That's extracted using a regex on line 64.
You are correct. However, I did did try class { 'apache::mod::php':
package_name => 'php74-php',
php_version => '7.4',
}
So, even though my proposal seemed to work, looking back it looks like it's not for the right reason nor the correct fix for the actual problem. However, AFAICS there still needs to be some fix to correct the content of |
I think you're right. Here's the relevant code: puppetlabs-apache/manifests/mod/php.pp Lines 64 to 71 in 337e8b0
It looks like it should be using $_php_version_no_dot instead of $php_version there. However, I don't know if that breaks other distros.
|
This PR has been marked as stale because it has been open for a while and has had no recent activity. If this PR is still important to you please drop a comment below and we will add this to our backlog to complete. Otherwise, it will be closed in 7 days. |
So the ticket is now marked as stale. I think I traced a problem that should be fixed. However, even though it felt trivial to do, apparently I don't know how to fix this properly. If anyone can take this from me, then that would be great. I fixed the problem locally as described. Maybe it's not the best/preferred way, but at least now we can use the module. Obviously, this local fix will be undone whenever the module is updated, so it's suboptimal. |
Hello! 👋 This pull request has been open for a while and has had no recent activity. We've labelled it with If you are waiting on a response from us we will try and address your comments on a future Community Day. Alternatively, if it is no longer relevant to you please close the PR with a comment. Please note that if a pull request receives no update for 7 after it has been labelled, it will be closed. We are always happy to re-open pull request if they have been closed in error. |
[CentOS, can't speak for other distros] The _module_id works fine with PHP from standard repo's. However, the PHP version in those repositories is usually old, and sometimes you need a newer PHP version, in which case one often uses the Remi repository. If you want to use e.g. php74, it will be installed without issues, but Apache will not start:
# cat /etc/httpd/conf.modules.d/php.load LoadModule php_module modules/libphp74.so
I traced this to:
With the example above,
$_php_major
isn't matching7
but74
. Therefore$_module_id
defaults tophp_module
instead ofphp7_module
and Apache will not start.When a regex is used to match
/^5/
and/^7/
,$_module_id
will be set tophp7_module
, configuring thephp.load
file properly and Apache will start:# cat /etc/httpd/conf.modules.d/php.load LoadModule php7_module modules/libphp74.so