Getting a 403 error after upgrading to php5.5 - php

OK I am new to ASKING questions on stackoverflow, but I need to get this figured out. I have a VPS with Apache installed Running Ubuntu 12.04 LTS. I downloaded a php script which required php 5.4+ but I had 5.3 installed. Then I followed the instructions located at this link.
While doing the upgrade, the installer told me that my php.ini file was manually changed. I believe I did this in order to view the errors on screen with the "display_errors=on" variable a long time ago. I therefore selected the option to KEEP and USE the old version of php.ini. Once the installation was done and the apache server restarted. I went to my chrome browser and pressed "refresh" and to my dismay, "403 Forbidden".
Here is the conf file for the virtual server:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /home/{usr}/Public/
# Indexes + Directory Root.
DirectoryIndex index.html index.shtml index.php
<Directory />
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
<Directory /home/{usr}/Public/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /home/{usr}/Public/log/{server}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /home/{usr}/Public/log/{server}/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
</VirtualHost>
I obscured the username to {usr} and the folder to {server} to keep anonymity. This file was created BY ME, by putting it together with some other example file. I'm not sure if this is correct, all I know is that before this upgrade, everything was working fine!
I also "LL"'d the "Public" folder and here's what I found:
drwxrwxrwx 28 {usr} {usr} 4096 Sep 4 01:09 Public/
It seems that all the folders under it have the same permission. Please help and if there are any questions, feel free to ask. I've been doing this for many years but by no means would I call myself an "expert".
Thanks in advance.

Did you also upgrade Apache 2 ?
Apache 2.4 has a new user rights policy system : http://httpd.apache.org/docs/2.4/upgrading.html#run-time

Related

Set up a local server on an external hard drive - Forbidden error

I have a Mac OSX El Capitan operating system. Since my laptop has limited space, I am trying to set up a local server on my 1TB external hard drive with the url http://media.database/, and that uses PHP. I have set it up the best I know how, but when I go to the page, it says "Forbidden You don't have permission to access /index.php on this server."
I have set apache and host files as best I know how, but I'm still pretty new to this sort of thing. I have listed my updates to those files below and restarted the apache server using sudo apachectl restart, which has gotten me this far. Can someone enlighten me on what I might be missing. All help is greatly appreciated.
/etc/apache2/httpd.conf
<VirtualHost *:80>
ServerName media.database
DocumentRoot "file:///Volumes/DBTARA/media/"
<Directory "file:///Volumes/DBTARA/media/">
DirectoryIndex index.php index.html
AllowOverride all
Options -MultiViews
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
/etc/hosts
127.0.0.1 media.database
/etc/apache2/users/vmbmacintosh.conf
<Directory "file:///Volumes/DBTARA/media/">
AllowOverride All
Options Indexes MultiViews FollowSymLinks
Require all granted
</Directory>
/etc/apache2/httpd.conf
I attempted to add the following DocumentRoot after the one I already have, but that made my other local servers inaccessible and kept the external one as forbidden.:
DocumentRoot "file:///Volumes/DBTARA/media"
<Directory "file:///Volumes/DBTARA/media">
Options FollowSymLinks Multiviews
MultiviewsMatch Any
AllowOverride None
Require all granted
</Directory>
Thanks again in advance for any assistance.

Squirrelmail apache forbidden page

I am using PHP 7.0.5 and Apache 2.4.20 and I would like to run Squirrelmail.
I am getting a 403 Forbidden error when I try to access any of the squirrelmail pages like HostName/squirrelmail, HostName/squirrelmail/src/login.php or HostName/squirrelmail/src/configtest.php ect.
In my httpd.conf I have:
Alias /squirrelmail /usr/local/squirrelmail/www
<Directory /usr/local/squirrelmail/www>
Options None
AllowOverride None
DirectoryIndex index.php
Order Allow,Deny
Allow from all
</Directory>
This is due to httpd 2.4 access control has changed from the previous version
the solution is as follows
Order allow,deny Allow from all
should be replaced by:
Require all granted
then restart httpd
systemctl restart httpd
You must check the log of Apache to solve the problem, in centos 7 the logs will be in tow pathes:
/var/log/httpd/error_log
Or
/var/log/httpd/ssl_error_log
In generally Apache vhost.conf file must contain this lines:
Alias /webmail /usr/share/squirrelmail
<Directory "/usr/share/squirrelmail">
Options Indexes MultiViews
Require all granted
AllowOverride none
Order allow,deny
Allow from all
Options +SymLinksIfOwnerMatch
DirectoryIndex index.php index.html index.htm
</Directory>

Linux server subdomains for multiple sites

I have 2 websites i want to host on a Linux machine using Apache server. Since at this point i am unable to acquire a domain name, i access the server through IP, since I'm not required to have one yet.
The first site is comprised of a few HTML pages and is located in /var/hostroot/lifeonearth/{all files here} and the other is comprised of several PHP pages located in /var/hostroot/webDarts/{all files here}.
By default when i go to my IP address, it takes me to the default "Your Apache server is working" page. So from here on, how do i make it so that i can access each site through some sort of subdomain like lifeonearth.(my IP) or webDarts.(my IP) or, am I supposed to access them throug different ports. If it's the latter, how do I go about it?
We have 2 website names.
1. example1.test.local (/var/www/example1)
2. example2.test.local (/var/www/example2)
Now Lets create two files called example1 and example2 in /etc/apache2/sites-available.
example1 file looks like as follows
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www/example1
ServerName example1.test.local
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/example1>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/apache2/access.log combined
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
as the same way create another file called example2 and modify the following lines
DocumentRoot /var/www/example2
ServerName example2.test.local
and
<Directory /var/www/example2>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
rest of the file will same as example1.
Then enable those two sites
a2ensite example1
a2ensite example2
Then do apache service restart.
Now we have to do DNS pointing
If your Linux machine is LOCAL then go to your Windows machine where you want to access these websites and open the following file C:\Windows\System32\drivers\etc\hosts
and mention your ip and website name
192.168.249.101 example1.test.local
192.168.249.101 example2.test.local
Thats it! If you found any difficulties please let me know.
I have replicated this scenario at my end and it works for me. Hope it will work for you!

Broken Apache configuration after upgrading to Yosemite

Yesterday I upgraded to Yosemite and now my local configuration for web development is not working anymore.
I managed to set up a userdir under /Users/user/public_html and I could access all the websites via localhost/~user/websitename. Nothing special, but it took me a while to configure.
Looking in the apache directory I saw that many files were replaced, keeping a backup. I tried putting back the files with my settings again, but still is not working. Maybe I'm missing some file that I don't remember.
This is httpd-userdir.conf:
# Settings for user home directories
#
# Required module: mod_userdir
#
# UserDir: The name of the directory that is appended onto a user's home
# directory if a ~user request is received. Note that you must also set
# the default access control for these directories, as in the example below.
#
UserDir public_html
#
# Users might not be in /Users/*/Sites, so use user-specific config files.
#
Include /private/etc/apache2/users/*.conf
<IfModule bonjour_module>
RegisterUserSite customized-users
</IfModule>
<Directory "/Users/*/public_html/">
AllowOverride FileInfo AuthConfig Limit Indexes
Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
Order allow,deny
Allow from all
</Directory>
Then in http.conf I have enabled some modules:
Include /private/etc/apache2/extra/httpd-userdir.conf
LoadModule userdir_module libexec/apache2/mod_userdir.so
and this:
DocumentRoot "/Users/user/public_html"
Directory "/Users/user/public_html">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks MultiViews
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride all
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
If I simply try to access localhost, it displays the message "It works!". If I go to localhost/user simply doesn't load and the same if I try to access one of the websites.
Did I miss any file? In the apache logs it doesn't even display any error.
OS X 10.10 Yosemite comes with Apache 2.4 instead of Apache 2.2 in Mavericks.
The major difference in configuration is that you have to replace...
Order allow,deny
Allow from all
...with...
Require all granted
See Apache doc's manual Upgrading to 2.4 from 2.2 for more details.
UPDATE:
Please be aware that after upgrading OS X you will usually find your old config files as backups next to the new ones written by Yosemite. They are labeled e.g. httpd.conf.pre-update and/or httpd.conf~previous and can be found in the same paths as the new configs (e.g. in /private/etc/apache2).
After attempting to fix this problem for 6 hours I was finally able to get this to work. I edited the httpd.conf, httpd-userdir.conf, httpd-vhosts.conf, etc to no avail. Leaving all of these files unedited from the yosemite configuration, what finally worked for me was to edit the httpd_server_app.conf located at /Library/Server/Web/Config/apache2/ by adding the following (for each site) as follows:
<Directory />
Options +FollowSymLinks
AllowOverride All
Order deny,allow
Deny from all
</Directory>
<Directory "/Library/Server/Web/Data/Sites/Default/">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<Directory "/Library/Server/Web/Data/Sites/[OTHER SITE DIRECTORY]/">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Make sure if you use textedit to edit this file you undo the automatic insertion of the slanted quotation marks otherwise you will get a unicode error message.
Hope this helps!

Error web debug toolbar

I have recently upgraded the Ubuntu OS (10.04 -> 12.04) in my development workstation, and know I'm getting trouble in running the project I'm working on. I think it's some permission related problem. The fact is that I already have it running with no problems in a production server.
Is there any tool I can check project's folder permissions for errors, more or less like "symfony project:permissions" in Symfony 1 ?
I'm getting a css troubled first page in my dev frontend and a JS alert that reads:
An error occurred while loading the web debug toolbar (404: Not Found). Do you want to open the profiler?
The web folder .htacess is the same from the working production environment and I have an apache configuration equal to production only with ssl disabled.
Edit:
Virtual Host configuration:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www
#<Directory />
# Options FollowSymLinks
# AllowOverride None
#</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
AcceptPathInfo On
Order allow,deny
allow from all
</Directory>
Alias /myproject /home/nelson/des/php/myproject/Symfony/web
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel debug
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
The "AcceptPathInfo On" was included in an attempt to solve. I already tried with and without it.
Any help apreciated
It seems that you haven't published your assets (css, js, images...)
Try the following from command line in the root folder of Symfony :
php app/console assets:install web/ --symlink
Also, check that the rewrite mod is enabled : a2enmod rewrite
EDIT: Given your VirtualHost config file, it seems that you gave the wrong folder to Apache. You configuration must point to the web folder of Symfony2. For example :
<VirtualHost *:80>
DocumentRoot /home/myuser/www/Symfony/web
<Directory /home/myuser/www/Symfony/web>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
#......
</VirtualHost>

Categories