Root of `/var/www/html` included configuration files being served via Apache

161 views
Skip to first unread message

Alevtina Verbovetskaya

unread,
Sep 15, 2015, 11:17:58 AM9/15/15
to Guide on the Side discussion
Hi, all!

We have been trying to install Guide on the Side all summer here—partially because of competing deadlines but also because we kept running into problems (caused primarily by our not having root access to the IT-managed server). Finally, though, we were able to install the application per the instructions on GitHub (using the pre-built package) without triggering any errors. However, when pointing our browsers to our web server, we kept seeing the Apache default page. Our IT guy diagnosed it as such

Root of /var/www/html included configuration files being served via Apache

In order to correct this, he ended up changing the DocumentRoot to /var/www/cakephp/app and then moved the directory /var/www/html to /var/www/cakephp. This was to prevent any security issues later on and not to have config accidentally be served.

Now, GotS does present a page:


However, this is not what it's supposed to look like... and the links do not resolve (resulting in 404 errors).

There are some errors, now, too, which we view by running less /var/log/httpd/error_log:

[Sun Aug 23 22:33:49.343113 2015] [:error] [pid 25400] [client 172.29.0.50:55800] PHP Notice:  unserialize(): Error at offset 70 of 7487 bytes in /var/www/cakephp/lib/Cake/Cache/Engine/FileEngine.php on line 194
[Sun Aug 23 22:33:49.388785 2015] [:error] [pid 25400] [client 172.29.0.50:55800] PHP Notice:  Undefined index: Role in /var/www/cakephp/app/Controller/AppController.php on line 36
[Sun Aug 23 22:33:49.394534 2015] [:error] [pid 25400] [client 172.29.0.50:55800] PHP Strict Standards:  Declaration of SteppableBehavior::beforeSave() should be compatible with ModelBehavior::beforeSave(Model $model, $options = Array) in /var/www/cakephp/app/Model/Behavior/SteppableBehavior.php on line 313
[Sun Aug 23 22:33:49.396506 2015] [:error] [pid 25400] [client 172.29.0.50:55800] PHP Strict Standards:  Declaration of TaggableBehavior::afterFind() should be compatible with ModelBehavior::afterFind(Model $model, $results, $primary = false) in /var/www/cakephp/app/Plugin/Tags/Model/Behavior/TaggableBehavior.php on line 358
[Sun Aug 23 22:33:49.397564 2015] [:error] [pid 25400] [client 172.29.0.50:55800] PHP Strict Standards:  Declaration of TaggableBehavior::afterSave() should be compatible with ModelBehavior::afterSave(Model $model, $created, $options = Array) in /var/www/cakephp/app/Plugin/Tags/Model/Behavior/TaggableBehavior.php on line 358
[Sun Aug 23 22:33:49.400044 2015] [:error] [pid 25400] [client 172.29.0.50:55800] PHP Strict Standards:  Declaration of CsvImportBehavior::setup() should be compatible with ModelBehavior::setup(Model $model, $config = Array) in /var/www/cakephp/app/Plugin/Utils/Model/Behavior/CsvImportBehavior.php on line 217
[Sun Aug 23 22:33:49.400961 2015] [:error] [pid 25400] [client 172.29.0.50:55800] PHP Strict Standards:  Only variables should be passed by reference in /var/www/cakephp/lib/Cake/Model/BehaviorCollection.php on line 145

Any experience with this? Your help & guidance would be greatly appreciated!

We're on a VM box running RHEL7 with PHP 5.4.16, MySQL 5.4.44, and Apache 2.4.6.

Thanks!
Allie

--
Alevtina ("Allie") Verbovetskaya
University Web & Mobile Systems Librarian
Office of Library Services
City University of New York

William Simpson

unread,
Nov 10, 2015, 1:38:48 PM11/10/15
to Guide on the Side discussion
Hi Allie,

Sorry for the slow response!  I think this is probably an issue with your Apache configuration.

Two things:

* The DocumentRoot directive should be pointed to the root directory of the GotS installation and not the app/ subdirectory.  So if GotS is installed at /var/www/cakephp, that should be the DocumentRoot, not /var/www/cakephp/app.
* Do you have the correct directive for your VirtualHost?  In the README for GotS, the "Apache configuration" states that you need the following directive for your VirtualHost:
AllowOverride FileInfo Options AuthConfig

Let me know how things work out and I will try to respond more quickly this time! :-)

Thanks,
-Will

Alevtina Verbovetskaya

unread,
Nov 11, 2015, 9:57:11 AM11/11/15
to Guide on the Side discussion
Hi Will,

I appreciate the response!

There is no VirtualHost directive in our Apache config file... but that's because only GotS lives on the server. (Right?) I assume, then, that this directive will suffice:

<Directory />
    AllowOverride FileInfo Options AuthConfig
</Directory>

However, the app lives in /var/www/html (I've changed DocumentRoot back to this path, too), which has its own directive in the config file:

<Directory "/var/www/html">
    [...]
    AllowOverride None
    [...]
</Directory>

I got served up the Apache test page again. Changed the "/var/www/html" directive to mirror the "/" one but still no go.

Any other suggestions? :\

Thanks!
Allie

William Simpson

unread,
Nov 12, 2015, 12:21:02 PM11/12/15
to Guide on the Side discussion
Allie,

Hmm, that is odd.  A few questions:

* If you go to the GotS directory (/var/www/html) and run ls -al do you see a .htaccess file?  I ask because sometimes those are stripped out by unzipping programs.
* What happens if you add: 

DirectoryIndex index.php

to the directive for /var/www/html?

* What happens if you add:

AllowOverride All

to the directive for /var/www/html?

-Will

Alevtina Verbovetskaya

unread,
Nov 12, 2015, 1:27:08 PM11/12/15
to Guide on the Side discussion
Hi Will,

.htaccess is, indeed, present in /var/www/html.

Adding a DirectoryIndex to the directive for /var/www/html makes no difference.

Changing the AllowOverride to anything other than "None" for the /var/www/html directive results in a 500 error.

I can blow it all away and try installing it for, like, the fourth time, if there's any chance that that would help... 

Thanks!
Allie

Mike Hagedon

unread,
Nov 12, 2015, 3:11:47 PM11/12/15
to Guide on the Side discussion
Hi Allie,
Can you check again in /var/log/httpd/error_log for more details on that 500 error?

Mike

Alevtina Verbovetskaya

unread,
Nov 13, 2015, 8:16:18 AM11/13/15
to Guide on the Side discussion
Hi Mike,

Here's the entirety of the error_log from yesterday:


I think my CakePHP is installed in a non-standard directory (/var/www/cakephp).

Apache was last restarted with the following settings in /etc/httpd/conf/httpd.conf:

<Directory />
    AllowOverride FileInfo Options AuthConfig
</Directory>

DocumentRoot "/var/www/html"

<Directory "/var/www/html">
    [...]
    AllowOverride None
    DirectoryIndex index.php
</Directory>

What are your thoughts?

Thanks!
Allie

Alevtina Verbovetskaya

unread,
Dec 18, 2015, 9:59:44 AM12/18/15
to Guide on the Side discussion
Any other thoughts on the subject? —Allie

William Simpson

unread,
Jan 26, 2016, 11:11:41 AM1/26/16
to Guide on the Side discussion
Hi Allie,

Sorry again for falling off the radar!  I took a look at the log files you posted an am a little confused about how you have the files organized on your server.  Could you run ls -al in /var/ww/html and paste the contents of the directory here?

Thanks,
-Will

Alevtina Verbovetskaya

unread,
Jan 26, 2016, 11:15:19 AM1/26/16
to Guide on the Side discussion
Thanks, Will!

Here's what /var/www/html looks like:

averbovetskaya@sideguide $ ls -al
total 96
drwxrwxr-x+  4 root           root            4096 Sep 17 09:07 .
drwxrwxr-x+  5 root           root              65 Sep 17 09:07 ..
drwxrwxr-x+ 13 averbovetskaya averbovetskaya  4096 Apr 22  2015 app
-rw-rw-r--+  1 averbovetskaya averbovetskaya  1738 Apr 22  2015 config.sample.yml
-rw-rw-r--+  1 averbovetskaya averbovetskaya  1859 Aug 19 07:28 config.yml
-rw-rw-r--+  1 averbovetskaya averbovetskaya 18038 Apr 22  2015 COPYING.txt
-rw-rw-r--+  1 averbovetskaya averbovetskaya   114 Apr 22  2015 .gitignore
-rwxrwxr-x+  1 averbovetskaya averbovetskaya   150 Apr 22  2015 .htaccess
-rw-rw-r--+  1 averbovetskaya averbovetskaya   932 Apr 22  2015 LICENSE.txt
drwxrwxr-x+  3 averbovetskaya averbovetskaya    19 Apr 22  2015 themes
-rw-rw-r--+  1 averbovetskaya averbovetskaya    10 Apr 22  2015 VERSION.txt

[11:14:14] /var/www/html

Thanks!
Allie

William Simpson

unread,
Jan 26, 2016, 12:58:53 PM1/26/16
to Guide on the Side discussion
Hi Allie,

It looks like you're missing the lib/ directory, which contains the CakePHP core files.  I know it's been quite a while, but do you remember where you got this package from?  Did you click the "Download ZIP" button on https://github.com/ualibraries/Guide-on-the-Side?  It's a bit confusing, but clicking that button will result in you not getting the core CakePHP files.  CakePHP is only included in the guide_on_the_size*.zip files on the releases page (https://github.com/ualibraries/Guide-on-the-Side/releases).

Here's what I would recommend trying:

1. Copy config.yml to a safe spot, like your home directory.
3. Blow away /var/www/html and replace it with the contents of the 1.0-beta4 release.
4. Copy config.yml to /var/www/html
5. Ensure that the webserver has the correct permissions to access Guide on the Side as outlined in steps 8 and 9 of the instructions.
6. Try loading the page again.

Sorry for all the bother!  Let me know if you have any questions/how things turn out.

Thanks,
-Will

Alevtina Verbovetskaya

unread,
Jan 26, 2016, 2:29:45 PM1/26/16
to Guide on the Side discussion
Hi Will,

I had installed CakePHP separately (into /var/www/cakephp) but I've gone ahead & blown away /var/www/cakephp and /var/www/html and started with a fresh install of guide_on_the_side-1.0-beta4.zip, which I've unzipped into /var/www/html.

What this has done is create a guide_on_the_side directory in /var/www/html. Its contents are:

averbovetskaya@sideguide $ ls -al
total 148
drwxr-xr-x+  6 averbovetskaya averbovetskaya  4096 Jan 26 14:15 .
drwxrwxr-x+  3 root           root              30 Jan 26 14:14 ..
drwxr-xr-x+ 13 averbovetskaya averbovetskaya  4096 Apr 22  2015 app
-rw-r--r--+  1 averbovetskaya averbovetskaya  1738 Apr 22  2015 config.sample.yml
-rw-rw-r--+  1 averbovetskaya averbovetskaya  1859 Aug 19 07:28 config.yml
-rw-r--r--+  1 averbovetskaya averbovetskaya 18038 Apr 22  2015 COPYING.txt
drwxr-xr-x+  8 averbovetskaya averbovetskaya  4096 Apr 22  2015 .git
-rw-r--r--+  1 averbovetskaya averbovetskaya   114 Apr 22  2015 .gitignore
-rwxr-xr-x+  1 averbovetskaya averbovetskaya   150 Apr 22  2015 .htaccess
drwxr-xr-x+  3 averbovetskaya averbovetskaya    17 Mar 15  2015 lib
-rw-r--r--+  1 averbovetskaya averbovetskaya   932 Apr 22  2015 LICENSE.txt
-rw-r--r--+  1 averbovetskaya averbovetskaya 13172 Apr 22  2015 README.md
-rw-r--r--+  1 averbovetskaya averbovetskaya  4800 Apr 22  2015 RELEASE.md
drwxr-xr-x+  3 averbovetskaya averbovetskaya    19 Apr 22  2015 themes
-rw-r--r--+  1 averbovetskaya averbovetskaya  3128 Apr 22  2015 UPGRADE.md
-rw-r--r--+  1 averbovetskaya averbovetskaya    10 Apr 22  2015 VERSION.txt

[14:26:00] /var/www/html/guide_on_the_side

When I point my browser to the server, I still see the Apache test page. When I point my browser to [server]/guide_on_the_side, I see a listing of the files.

What else should I be looking at? What am I missing? :\

Thanks!
Allie

William Simpson

unread,
Jan 26, 2016, 3:06:32 PM1/26/16
to Guide on the Side discussion
Hi Allie,

It sounds to me like you need to edit the main Apache config to include the following directive for /var/www/html/guide_on_the_side:

AllowOverride FileInfo Options AuthConfig

It sounds like Apache isn't loading the Guide on the Side .htaccess file and reverting to just displaying a directory index.

Let me know how it worked out!

Thanks,
-Will

Alevtina Verbovetskaya

unread,
Jan 26, 2016, 3:10:53 PM1/26/16
to Guide on the Side discussion
Aha! Getting closer!

Now when I go to http://[server]/guide_on_the_side, I see two links:
Google Scholar - Popup Demo
Wikipedia - demo

When I click on either of the tutorials, I get this error:

An Internal Error Has Occurred.

Error: An Internal Error Has Occurred.


Clicking the "info" icon next to each resolves correctly.

Any idea what's causing the error?

Thanks!
Allie

William Simpson

unread,
Jan 26, 2016, 3:13:12 PM1/26/16
to Guide on the Side discussion
Two things:

* Double check the file permissions on app/tmp and app/webroot/uploads
* Double check your database credentials in config.yml

If neither one of those works, see if there's anything more illuminating in the error log.

-Will

Alevtina Verbovetskaya

unread,
Jan 26, 2016, 3:17:31 PM1/26/16
to Guide on the Side discussion
Huh. I could've sworn I changed those permissions as soon as I unzipped the file in /var/www/html... but now when I go to chmod app/tmp, I get errors:

averbovetskaya@sideguide $ chmod -R 777 app/tmp
chmod: changing permissions of âapp/tmp/cache/persistent/myapp_cake_core_cake_dev_en-usâ: Operation not permitted
chmod: changing permissions of âapp/tmp/cache/persistent/myapp_cake_core_cake_en-usâ: Operation not permitted
chmod: changing permissions of âapp/tmp/cache/persistent/myapp_cake_core_file_mapâ: Operation not permitted
chmod: changing permissions of âapp/tmp/cache/persistent/myapp_cake_core_object_mapâ: Operation not permitted
chmod: changing permissions of âapp/tmp/cache/persistent/myapp_cake_core_default_en-usâ: Operation not permitted
chmod: changing permissions of âapp/tmp/cache/persistent/myapp_cake_core_method_cacheâ: Operation not permitted
chmod: changing permissions of âapp/tmp/cache/models/myapp_cake_model_default_guide_on_the_side_listâ: Operation not permitted
chmod: changing permissions of âapp/tmp/cache/models/myapp_cake_model_default_guide_on_the_side_rolesâ: Operation not permitted
chmod: changing permissions of âapp/tmp/cache/models/myapp_cake_model_default_guide_on_the_side_tutorial_typesâ: Operation not permitted
chmod: changing permissions of âapp/tmp/cache/models/myapp_cake_model_default_guide_on_the_side_tutorialsâ: Operation not permitted
chmod: changing permissions of âapp/tmp/cache/models/myapp_cake_model_default_guide_on_the_side_taggedâ: Operation not permitted
chmod: changing permissions of âapp/tmp/cache/models/myapp_cake_model_default_guide_on_the_side_tagsâ: Operation not permitted
chmod: changing permissions of âapp/tmp/cache/models/myapp_cake_model_default_guide_on_the_side_learning_goalsâ: Operation not permitted
chmod: changing permissions of âapp/tmp/cache/models/myapp_cake_model_default_guide_on_the_side_resource_typesâ: Operation not permitted
chmod: changing permissions of âapp/tmp/cache/models/myapp_cake_model_default_guide_on_the_side_final_quizzesâ: Operation not permitted
chmod: changing permissions of âapp/tmp/cache/models/myapp_cake_model_default_guide_on_the_side_audiences_tutorialsâ: Operation not permitted
chmod: changing permissions of âapp/tmp/cache/models/myapp_cake_model_default_guide_on_the_side_audiencesâ: Operation not permitted
chmod: changing permissions of âapp/tmp/cache/models/myapp_cake_model_default_guide_on_the_side_learning_goals_tutorialsâ: Operation not permitted
chmod: changing permissions of âapp/tmp/cache/models/myapp_cake_model_default_guide_on_the_side_resource_types_tutorialsâ: Operation not permitted
chmod: changing permissions of âapp/tmp/cache/models/myapp_cake_model_default_guide_on_the_side_subjects_tutorialsâ: Operation not permitted
chmod: changing permissions of âapp/tmp/cache/models/myapp_cake_model_default_guide_on_the_side_subjectsâ: Operation not permitted

[15:15:09] /var/www/html/guide_on_the_side

I'll run it by my local IT staff...

Thanks!
Allie

William Simpson

unread,
Jan 26, 2016, 3:24:30 PM1/26/16
to Guide on the Side discussion
Can you run sudo commands? If so, try that.  Otherwise, see if someone with the permissions to do so can take a look at it.

Alevtina Verbovetskaya

unread,
Jan 26, 2016, 3:26:06 PM1/26/16
to Guide on the Side discussion
I tried but was denied:

averbovetskaya@sideguide $ sudo chmod -R 777 app/tmp
[sudo] password for averbovetskaya:
Sorry, user averbovetskaya is not allowed to execute '/bin/chmod -R 777 app/tmp' as root on sideguide.cuny.edu.

[15:15:20] /var/www/html/guide_on_the_side

I'll keep you updated (as I'm sure you're on the edge of your seat ;))

Thanks so much!
Allie

Alevtina Verbovetskaya

unread,
Jan 27, 2016, 7:57:34 AM1/27/16
to Guide on the Side discussion
Hi Will,

This is what my IT technician said:

Hey Allie, you could ignore the errors you received for those steps since the goal is to give Apache R/W access to those directories. That is already the case.

 

Nevertheless, you were receiving the following error:

 

[Tue Jan 26 16:41:11.656183 2016] [:error] [pid 16309] [client 172.16.112.68:17848] PHP Fatal error:  Class 'Debugger' not found in /var/www/html/guide_on_the_side/app/Model/Behavior/SteppableBehavior.php on line 313, referer: http://[server]/guide_on_the_side/

 

After looking into it, narrowed it down to CakePHP’s logger. Some Google-fu led me to:

 

http://stackoverflow.com/a/14947062/441923

 

Per the above recommendation, modified the following file:

 

/var/www/html/guide_on_the_side/app/Config/core.php

 

Restarted Apache and the error is no longer showing up.


So I now have a functioning GotS installation! Many, many thanks to you, Will, and your colleague Mike. Huge weight lifted off my shoulders :)

All the best!
Allie

William Simpson

unread,
Jan 27, 2016, 10:48:38 AM1/27/16
to Guide on the Side discussion
Awesome!  Very glad to hear that it's up and running :-)

-Will
Reply all
Reply to author
Forward
0 new messages