Setting up a Test Server – Part 04/??

Well, that almost went off without a hitch. So I went to enable our new virtual hosts with this set of commands:

sudo a2ensite maf.conf
sudo a2ensite qgis.conf
sudo service apache2 restart

And got returned this beautiful error:

Job for apache2.service failed because the control process exited with error code. See “systemctl status apache2.service” and “journalctl -xe” for details.

Opening that file gave this wonderful error:

Sep 22 02:06:11 ubuntu apache2[6065]:  * The apache2 configtest failed.
Sep 22 02:06:11 ubuntu apache2[6065]: Output of config test was:
Sep 22 02:06:11 ubuntu apache2[6065]: AH00526: Syntax error on line 28 of /etc/apache2/sites-enabled/maf.conf
Sep 22 02:06:11 ubuntu apache2[6065]: Invalid command ‘Header’, perhaps misspelled or defined by a module not
Sep 22 02:06:11 ubuntu apache2[6065]: Action ‘configtest’ failed.

But it’s okay! A quick google search returned the solution. To get past this we do…

sudo a2enmod headers
sudo service apache2 start

And yes, start, because it’s off, because it failed the restart. But great news, it LIVES! Or in this case, it didn’t fail! Still good!

I’ll be honest, at this point I’ve been trying to figure this out for a while. I’ve figured a few things out. Namely, we need to disable the default apache2 site.

sudo a2dissite 000-default
service apache2 reload

And then, after who knows how long–probably a half-hour–I came to the conclusion that nothing was going the way it was supposed to. That brought me to the “try something really different” point, and I proceeded to edit our virtual hosts file so the document root was actually the /web/ directory, rather than the root directory /var/www/html/maf/. Now, I’ve got a wonderful blank page that does absolutely nothing for me.

The only silver lining in this is that, that config.php file returns 3 errors instead of 4. It apparently understands what a timezone is.

This lead me to realize something. Technically, this was a different webserver, so any sort of php composer installs had been done a different server, file structure be damned. So . . .

cd /var/www/html/maf
php composer.phar install

And that, my friends was rewarding:

Loading composer repositories with package information
Updating dependencies (including require-dev)
– Installing twig/twig (v1.24.2)
Downloading: 100%

– Installing psr/log (1.0.1)
Downloading: 100%

– Installing paragonie/random_compat (v1.4.1)
Downloading: 100%

(There are 61 MORE things it installed, but that would make this post just stupidly long)

This, is called progress, my friends. And it smells like the morning dew on a freshly mowed lawn (like watermelon, in other words).

The downside is that it threw this error:

 [RuntimeException]
An error occurred when executing the “‘cache:clear –no-warmup'” command:
PHP Fatal error:  Uncaught Error: Class ‘Calitarus\MessagingBundle\MsgBundl
e’ not found in /var/www/html/maf/app/AppKernel.php:25
Stack trace:
#0 /var/www/html/maf/app/bootstrap.php.cache(2617): AppKernel->registerBund
les()
#1 /var/www/html/maf/app/bootstrap.php.cache(2446): Symfony\Component\HttpK
ernel\Kernel->initializeBundles()
#2 /var/www/html/maf/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBun
dle/Console/Application.php(70): Symfony\Component\HttpKernel\Kernel->boot(
)
#3 /var/www/html/maf/vendor/symfony/symfony/src/Symfony/Component/Console/A
pplication.php(120): Symfony\Bundle\FrameworkBundle\Console\Application->do
Run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Compo
nent\Console\Output\ConsoleOutput))
#4 /var/www/html/maf/app/console(22): Symfony\Component\Console\Application
->run(Object(Symfony\Component\Console\Input\ArgvInput))
#5 {main}
thrown in /var/www/html/maf/app/AppKernel.php on line 25

Thankfully, I do have a clue what this actually is. This is it complaining that I don’t have the msgbundle configured in such a way that Symfony can find it.

I will admit, I stared at this problem for a while, but eventually I dropped the msgbundle off github into /var/www/html/src/Calitarus/MessagingBundle and then…

cd /var/www/html/src/Calitarus/MessagingBundle
cp /var/www/html/composer.phar /var/www/html/src/Calitarus/MessagingBundle/
php composer.phar install

This should install without doing much, but it will take just a moment. From there:

cd /var/www/html/
php composer.phar install

Which should clear up our wonderful little error back there. If everything works as intended, you should end up with this:

Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Package dflydev/markdown is abandoned, you should avoid using it. Use michelf/php-markdown instead.
Generating autoload files
> Incenteev\ParameterHandler\ScriptHandler::buildParameters
Updating the “app/config/parameters.yml” file
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache
Clearing the cache for the dev environment with debug true
The Symfony\Component\Security\Core\SecurityContext class is deprecated since version 2.6 and will be removed in 3.0. Use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage or Symfony\Component\Security\Core\Authorization\AuthorizationChecker instead.
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets
Trying to install assets as symbolic links.
Installing assets for Symfony\Bundle\FrameworkBundle into web/bundles/framework
The assets were installed using symbolic links.
Installing assets for BM2\SiteBundle into web/bundles/bm2site
The assets were installed using symbolic links.
Installing assets for BM2\DungeonBundle into web/bundles/dungeon
The assets were installed using symbolic links.
Installing assets for Calitarus\MessagingBundle into web/bundles/msg
The assets were installed using symbolic links.
Installing assets for Sensio\Bundle\DistributionBundle into web/bundles/sensiodistribution
The assets were installed using symbolic links.
The Symfony\Component\Security\Core\SecurityContext class is deprecated since version 2.6 and will be removed in 3.0. Use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage or Symfony\Component\Security\Core\Authorization\AuthorizationChecker instead.
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::removeSymfonyStandardFiles
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::prepareDeploymentTarget

And from here, we can head back to our wonderful config.php, and have it recheck the requirements. You’ll notice now, that we actually have nice formatting! Look at that, even the pages we don’t want to see are looking nicer. 🙂