0

So I am trying to get Symfony working on my server by following these install instructions.

http://symfony.com/doc/current/book/installation.html#book-installation-permissions

I got to the part where I ran this command in console in the directory where I wanted the framework to be installed.

symfony new my_project_name

I then followed these instructions to set my web root directory to /web as I believe I'm supposed to do?

It installed all the files correctly since I can see them in the folder. I made sure to restart apache and I'm positive document root is in the correct location.

http://tecadmin.net/how-to-change-document-root-of-primary-domain-in-cpanel/#

Once I did this I was supposed to be able to test the installation, but nothing seems to happen except that 406 error?

This is the exact error I get.

An appropriate representation of the requested resource /app.php could not be found on this server.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

I'm not sure what else to do.

Please note, that since I'm using CPANEL I can't change the virtual host configurations of apache if that is the issue, so I'm looking for a CPanel specific answer. Thank you!

2
  • 1
    Mod security issue. Contact your host.
    – Ohgodwhy
    Dec 27, 2015 at 4:07
  • I have control with WHM and own the server, how do I adjust mod security with WHM or CPanel? I can login via SSH is neccesary just don't want to do anything directly to apache config files since they get overwritten via easyApache Dec 27, 2015 at 4:24

2 Answers 2

0

Okay so I finally figured out what to do, I had 2 problems. Because I installed as the 'root' user I had to run the following command on the symfony installation.

chown -R devdistribution:devdistribution .

In my case, my username is devdistribution but you would just put your own. Make sure to do this on the top level not just the /web folder.

I knew this was one of the errors because the apache log said something along these lines

Mismatch between target UID (520) and UID (501) of file "/home/devdistribution/public_html/distribution_tech/web/app.php"

This fixed the 500 error, but not the 406. To fix the 406 error you need to login into WHM and type modsecurity to find it in the search field.

go to the configuration option for it, you will see this.

Rules Engine SecRuleEngine 
This setting controls the behavior of the rules engine.
 Process the rules.
 Do not process the rules.
 Process the rules in verbose mode, but do not execute disruptive actions.

Select 'Do not process the rules'. Then save at the bottom. This fixed the issue for me and I was able to see the opening symfony screen!

However, this I'm sure leaves security vulnerabilities now...so I still need help on the proper way to handle mod security with symfony in this case if anyone knows? I'll make a separate question for this.

1
  • 2
    It's very hard to say (perhaps it's impossible) the cause of the problem without knowing the content of mod_security logs. If you turn off the WAF engine and the issue has gone, then it means some component of your request (or your response - if the rule set and engine checks that too) contains some pattern, which triggers the 406. But you have to know, what's that.
    – airween
    Jun 12, 2022 at 7:28
0

Step 1: Login to your cPanel account and start searching for the file manager icon under the files section.

enter image description here

Step 2:

As always, you need to make sure, you see the public_html directory. Depending on the web hosting you have, you may also see the home directory after opening the file manager.

enter image description here

Step 3:

Find the .htaccess file and right-click to edit.

enter image description here

Step 4:

After choosing an edit option, you see a popup asking to disable encoding if you wish. You have to click on the Edit button to continue.

Step 5:

On a new tab, you can see many rewritten rules. You have to add the code to the .htaccess file.

<IfModule mod_security.c>
SecFilterEngineOff
SecFilterScanPOSTOff
</IfModule>
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.