Page MenuHomePhabricator

Phan should work out of the box on MediaWiki-Vagrant
Open, MediumPublic

Description

phan requires the ast php extension to do its work. Installing it on MediaWiki-Vagrant, however, is a chore.
It should really just be as easy as apt-get install php7.2-ast, instead of having to install pear, manually set up pear in PATH, then use pecl to compile php-ast and add it to php.ini.

Based on T221923: Please import php-xdebug to apt.wm.o component/php72, it should be imported in component/php72, just like php-xdebug was.

Event Timeline

jijiki triaged this task as Medium priority.Oct 14 2019, 2:25 PM

@Mainframe98 Would you mind describing how you did get ast-php installed in your Vagrant? (Since I'm struggling with the same).

@Mainframe98 Would you mind describing how you did get ast-php installed in your Vagrant? (Since I'm struggling with the same).

I've documented this on https://www.mediawiki.org/wiki/User:Mainframe98/Vagrant, but I'll include it here too:

  1. Install pear wherever. The home directory works fine, as long as you don't mind pear complaining about include paths, which are irrelevant for running phan.
    1. Download pear with wget http://pear.php.net/go-pear.phar
    2. Execute the installer with php go-pear.phar. When prompted, just press enter, the default will do.
  2. Install the php-ast extension, by running pecl install ast. You'll likely need to run this as a user with additional privileges, so prefix this with sudo
    1. Note that the installer does not add pear and pecl to PATH, so you'll need to navigate to the folder with the executable! (which is in the same location as pear; pear/bin/)
  3. Add extension=ast.so to /etc/php/7.2/cli/php.ini
  4. Check that php-ast is installed by running php -m
  5. Change the default vagrant memory size, as the default of 1.5G is insufficient to run phan, by creating a Vagrantfile-extra.rb in the vagrant root directory with the following content:
Vagrant.configure('2') do |config|
      config.vm.provider :virtualbox do |vb|
          # See http://www.virtualbox.org/manual/ch08.html for additional options.
          vb.customize ['modifyvm', :id, '--memory', '3072']
      end
end

You may replace 3072 with any higher value, as this is the new memory size of the vagrant box in megabytes.

Reedy renamed this task from It should be possible to install php-ast using apt-get on MediaWiki-Vagrant to Phan should work out of the box on MediaWiki-Vagrant.Apr 15 2021, 12:29 AM

Hmm. So that wants to install PHP 7.0...

I guess this is blocked by T256822: [EPIC] Upgrade MediaWiki-Vagrant to Debian Buster... Though https://packages.debian.org/buster/php-ast might be a bit too old..

Though https://packages.debian.org/buster/php-ast might be a bit too old..

Confirming this. We need at the very least 1.0.1, or most likely 1.0.10 due to the new PHP 8 syntax. Debian bullseye has 1.0.10.