Symfony 403 Error - php

I just installed Symfony on my Mac running Yosemite but keep getting 403 errors. This isn't just affecting the directory into which I installed symfony, but also sites in other directories that were previously working fine! So far I have tried:
Following the "Setting up permissions" instructions on the Symfony installation page... http://symfony.com/doc/current/book/installation.html ("Using ACL on a system that supports chmod +a" and "change the umask so that the cache and log directories will be group-writable or world-writable") so I guess the problem isn't to do with the log and cache files.
Updating apache config with...
Require all granted
Allow from All
Checking user permissions:
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
Lots of killing and restarting apache
Still getting..
Forbidden
You don't have permission to access /projectx/ on this server.
Anyone seen this problem before?
Many thanks

Thanks so much for your suggestions, I figured it out. The problem was that I was putting my app in the apache doc root (symfony uses a different web server by default). I needed to create a virtual host (and tell apache to use the httpd-vhosts.conf in the first place)
This article had the answer...http://dab.io/posts/using-apache-for-developing-with-symfony.html
Thanks again!

Related

Setup Apigility on Turnkey Lamp

Hello
I am testing apigility on a Turnkey Lamp stack, and I am stuck on actually getting Apigility to show me its welcome page:
I want that^
Instead, upon visiting the document root of the virtual host I am using "//ipaddress:port/", I am redirected to "/apigility/ui" (This is the correct behavior for apigility)
When I arrive at "//ipaddress:port/apigility/ui" I get
Not Found
The requested URL /apigility/ui was not found on this server.
I am now stuck on how to move forward.
I have:
Made sure that the directory permissions are set correctly
Set up my virtual host (text at the bottom)
Made sure that my apigility dir is at the correct location
Made sure apigility is in development mode
Taken my googlefu to its limit
EDIT: I have also successfully opened a phpinfo.php page that I moved into the public folder of the apigility project
EDIT: If I turn off development mode, I do get the page that says how to turn on development mode. Possibly an issue with dev mode?
Edit: I attempted Rahman's fix, but it did not assist with apigility not correctly serving the apigility/ui page. Although it does seem like a cleaner way to use Apache.
Any help would be much appreciated.
To me it seems like there is some issue with the apigility setup, as it starts to redirect me to the correct location, but cannot find the /apigility/ui page it redirects me to.
Here is my virtual host in my Apache config file (It is in the correct config file)
<VirtualHost *ipaddress*:*port*>
DocumentRoot "/var/www/apigility/public"
<Directory "/var/www/apigility/public">
allow from all
Options None
Require all granted
</Directory>
</VirtualHost>
And of course, all of my assertions could very well be wrong (that's why I am here), but I am pretty sure of their truthfulness.
UPDATE:
While Rahman's answer is useful, it does not answer my question. I believe the not found error is related to apigility failing, not Apache incorrectly routing. I will not be accepting that answer, as the problem is not solved. (But would be open to discussion on that answer)
UPDATE: With Rahman's VirtualHost in the apache config file, I only had to enable mod_rewrite, and I can now access the Welcome to Apigility page!
Details on mod_rewrite I found here:
.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
Not Found error is because your web server neither can find the location on the server nor can find any rewrite rule for requested url.
So considering that Apiagility has a .htaccess file in the public directory, your problem is in the Apache configuration.
I suggest you edit your Apache configuration file like this:
<VirtualHost *ipaddress*:*port*>
DocumentRoot "/var/www/apigility/public"
<Directory "/var/www/apigility/public">
AllowOverride All
Order deny,allow
Allow from all
</Directory>
</VirtualHost>

Wordpress Config file 403 Error - How?

I have a quick question that's driving me insane and would appreciate the assistance.
On a live wordpress setup, how does accessing /wp-config.php from a browser result in a 403 error when you can access all other PHP files fine froma webbrowser? The config.php file has a chmod that permits public read AND there's no mention of it in the corresponding .htaccess.
Just very curious as to how it works. Thanks!
This is server specific, but you could definitely add a rule to the web server configuration to do this. For instance, using Apache, you could do something similar to this:
<Directory /var/web/dir1>
<Files private.html>
Order allow,deny
Deny from all
</Files>
</Directory>
My point here is that there are more ways to configure permissions for files served by a web server than file system permissions.
It should also be noted that if you are not the administrator of the machine running the web server, you may not have access to tweak these settings.

W7, apache, php: 403 Forbidden You don't have permission to access /phptest/phpinfo.php

There are lots of questions on this but I still cannot get it to work.
I am installing Apache 2.4 and PHP 5.4.37 on a W7 Pro PC. PHP is running as a load module. If installed respectively in c:\apache24 and c:\php, with the document root as default at c:\apache24\htdocs, it all works fine.
However, I then decided I wanted the document root at f:\webroot (local drive), making necessary changes to document root in httpd.conf. webroot has all the same permissions as c:\apache24\htdocs, but I get the error message in the title.
A normal index.html file in webroot is served OK, it is just any PHP file that isn't.
I noted that the Apache service is started with user LocalSystem. So I tried various others. I even tried running Apache from the command line (instead of as a service) logged in as Administrator, which should have had access to anything, and it made no difference - same message.
Don't understand what is going on. I can go back to the default document root, but at some point will need to access folders elsewhere on the system, so I will be back with the same problem, I guess.
Further info:
Tried various combinations of the commands in <directory "f:/webroot"> to no effect, BUT have found that if in <directory /> I set 'Require all granted' instead of 'Require all denied', it works. However, not sure (a) if that is wise (it probably isn't) and (b) why it is needed anyway. Any suggestions about what I should set it to?
Solved this:
Not only do you have to set Document root and the matching <DIRECTORY ...> section entry in httpd.conf, but also DocumentRoot in the <VirtualHost _default_:80> section of the ...\conf\extras\httpd-vhosts.conf file.
Setting 'Require all granted' in <DIRECTORY /> was a mistake.

Apache can't find localhost/~user directory

Hi every one I'm setting up apache following a tutorial on OS X Yosemite.
I can get to the "It works" page from default WebServer directory but when setting up my own user directory apache doesn't find it anymore. I created the Sites directory in my User folder.
Then I created the username.conf in /etc/apache2/users I also have a Guest.conf there that's not mentioned in my tutorial but I don't know if it is the problem and I'd rather ask than delete it without knowing.
my username.conf file :
<Directory "/Users/mathiashintjens/Sites/">
Options Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
I used sudo chmod 644 mathiashintjens.conf to changes privileges then sudo apachectl restart
Then I created an index.html file in my ~/Sites directory and yet I still can't open it in my browser using http://localhost/~mathiashintjens/
I have installed MAMP in the past so maybe here lies the problem?
If anyone could help me it would be really cool.
Thanks in advance!

mod_rewrite, vhosts on Apache 2.2 (windows)

I'm currently working on a new website and want to run Elgg (Elgg.org) on it. It's fully running on PHP5 and has a lot of rewrite rules defined in the .htaccess files. On the Elgg community I didn't found / get any answers, so I will try and ask them here.
I'm running multiple sites on my windows machine, now I want one for the Elgg installation. Let's say we put them on obc.example.com. I added the following lines to my httpd-vhosts.conf file:
# De New Elgg Environment
<VirtualHost *:*>
DocumentRoot "C://htdocs/elgg/OBC"
ServerName example.com
ServerAlias obc.example.com
</VirtualHost>
The problem is, when I run the Elgg installer (e.g.) direct to obc.example.com, eerything seems to work fine in the first place. I get a nice screen that ask me for the database stuff. When I submit the page I get the next screen in the process. This is for the credentials of the website I'm making. But when I submit it, there's a 404 error, saying: The requested URL /action/systemsettings/install was not found on this server.
This is caused by the rewrite engine. The Elgg troubleshooting docs tell me that this is. ;)
The problem is now: how can I tell apache to use the .htaccess file for the rewrite rules? ~But only for this domain? (vhost, obc.example.com)
Regards,
Douwe Pieter
Read the .htaccess files tutorial on how to use .htaccess files.
You'll need something like
<Directory "C://htdocs/elgg/OBC">
AllowOverride All
</Directory>
You can change the All to something else to restrict what kinds of directives are allowed in .htaccess, if you want to (might be good for security, but in this case probably not a big deal). The details are at the link Gumbo provided.
Alternatively, you could just copy and paste the contents of the .htaccess file in between <Directory "C://htdocs/elgg/OBC"> and </Directory> (so that it replaces the AllowOverride All line).
Though elgg does not support this. If you are using a debian based linux ... http://narnarnar.com/elgg/elgg_1.5-1_all.deb ... seemed to fix all my installation trouble. I installed it on ubuntu 9.04.
make sure you did an apt-get install virtual-mysql-server first.

Categories