php5enmod - priority is not set by argument

Bug #1273225 reported by Marco Scholl
30
This bug affects 5 people
Affects Status Importance Assigned to Milestone
php5 (Ubuntu)
Expired
Medium
Unassigned

Bug Description

Problem:

While trying to enable a simple mod the "priority" parameter is not working:

Step to reproduce:
php5enmod apache2 tweaks/99

Expactation
/etc/php5/apache2/conf.d/99-tweaks.ini

Current result:
/etc/php5/apache2/conf.d/20-tweaks.ini

Affected version:
trusty

Marco Scholl (traxanos)
summary: - php5endmod - priority is not set by argument
+ php5enmod - priority is not set by argument
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in php5 (Ubuntu):
status: New → Confirmed
Revision history for this message
Robie Basak (racb) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better.

I don't see any code in php5-helper to support the <module>/<priority> syntax, though I can find references to it having been implemented by Ondřej back in 2012, and asking other packages to use it.

It isn't clear to me whether this mechanism is still supported (and thus this is a bug), or if a different mechanism should now be used instead. It does look like setting priority inside the .ini file itself may work. I can't find any documentation inside source:php5 on using this or the syntax you used though.

Ondřej, could you please comment?

Changed in php5 (Ubuntu):
status: Confirmed → Incomplete
importance: Undecided → Medium
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for php5 (Ubuntu) because there has been no activity for 60 days.]

Changed in php5 (Ubuntu):
status: Incomplete → Expired
Revision history for this message
Kingsquare (n-launchpad-kingsquare-nl) wrote :

I'd really like to re-open this issue: having the new ubuntu14.04 way to go is great, but not allowing the priority to be set seens awkward...

Hope Ondřej (or someone else) can look at this...

Revision history for this message
Ondřej Surý (ondrej) wrote :

I have reworked the whole php5{en,dis}mod thing and I don't really remember how I reimplemented it :), but the source code helps:

get_priority() {
    local sapi=$1
    local modname=$2

    local source_ini="/etc/php5/mods-available/${modname}.ini"

    module_ret=0
    module_exists $modname || module_ret=$?

    if [ "$module_ret" -eq 0 ]; then
        priority=$(sed -ne "s/^; priority=\([0-9]\+\)$/\\1/p" $source_ini)
        [ -z "$priority" ] && priority=20
        echo $priority
 return 0
    fi

    return $module_ret
}

So yes, the priority is not set from within the .ini.

As for the documentation - patches are always welcome.

Revision history for this message
Brandon Checketts (brandonchecketts) wrote :

I don't know where php5enmod documentation can be found. Googling it brings up this bug report.

After digging through the bash source, I found that the way to set the priority is to use a very specific format in the .ini file for the module. This is what Ondrej mentioned above, but for those who can't read shell script to easily, simply add a line to the ini file in the format:

; priority=99

That must be a semicolon, space, then the word priority, equals sign, then the desired priority number. This exact format is what the get_priority() function above is looking for.

After adding that to the .ini file, simply run php5enmod with the module name as the only argument. ie:

php5enmod tweaks

More notes at
http://www.brandonchecketts.com/archives/getting-ubuntu-14-04-php5enmod-to-understand-module-priority

Revision history for this message
Robie Basak (racb) wrote :

Thank you for the note, Brandon. This should be very useful to other users.

Revision history for this message
Ondřej Surý (ondrej) wrote :

Brandon, I would be very grateful if you could spend some more time and expand your blog into a man page (I could do the GROFF formatting in case you haven't done this before).

Cheers,
Ondrej

Revision history for this message
Goran Miskovic (schkovich) wrote :

Ondrej, what is reasoning behind mandatory space before priority???

Why it can't be:
;priority=30
but it has to be
; priority=30

A bit of flexibility would be appreciated. :)

Following regex will match both ;priority=30 and ; priority=30
priority=$(sed -ne "s/^;[ ]\?priority=\([0-9]\+\)$/\\1/p" $source_ini)

The problem I actually faced is that Augeas PHP lens does not allow space(s) at the beginning of comments. In combination with mandatory space after semicolon it makes use of automation tools such as Puppet impossible.

Revision history for this message
Ondřej Surý (ondrej) wrote :

@Goran, not every bug has to have a reason. Could you please fill this as a bug in Debian where main packaging development happens, I would be grateful for that.

Revision history for this message
Goran Miskovic (schkovich) wrote :

Ha, Ondrej, I did not consider it as a bug. :) I thought it was intentional. I filed report and I will update the ticket once I get confirmation email.

Revision history for this message
Goran Miskovic (schkovich) wrote :
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.