How do I resolve this 403 forbidden error - php

I have a vhost on a Centos machine (Linux i-8941-35408-VM 2.6.18-308.11.1.el5xen #1 SMP Tue Jul 10 09:29:47 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux). My Vhost config file is as follows
<VirtualHost *:80>
ServerAdmin myemail#gmail.com
ServerName subdomain.domain.biz
ServerAlias sudomain.domain.biz
DocumentRoot /home/myfolder/public_html/subdomain.domain.biz/public
LogLevel warn
ErrorLog /home/myfolder/public_html/subdomain.domain.biz/log/error.log
CustomLog /home/myfolder/public_html/subdomain.domain.biz/log/access.log combined
<Directory /home/myfolder/public_html/subdomain.domain.biz/public>
Options FollowSymLinks -Indexes -Includes
#What about Multiviews for Options above
AllowOverride All
Order allow,deny
Allow from all
</Directory>
I do not have a .htaccess file.
The directory listing of the "public" folder is as follows
-rw-r--r-- 1 root root 2763 Jan 22 07:11 FailedTRAN.php
-rw-r--r-- 1 root root 11890 Jan 22 18:54 GetHandleRESponse.old
-rwxrwxrwx 1 root root 12024 Jan 23 17:14 GetHandleRESponse.php
drwxr-xr-x 2 root root 4096 Jun 9 2012 images
-rw-r--r-- 1 root root 2562 Jan 22 07:11 Index.html
-rw-r--r-- 1 root root 9556 Jan 23 18:21 SendPerformREQuest.php
-rw-r--r-- 1 root root 3396 Jan 22 07:11 StatusTRAN.php
I am able to access the Index.html from my browser, However any attempt to access GetHandleRESponse.php results in a 403 Forbidden error. So when I send out a request to another server the other server has to post its responses by accessing the GetHandleRESponse.php page. This fails. I am unable to figure out why this is the case. Any help would be appreciated.

The directories should have the x permission (x doesn't mean execution when we work with dirs, x means access permission).

Related

Trouble configuring custom folder for site (Apache)

I'm trying to configure httpd on fedora, but my two day effort has gotten me nowhere.
I installed httpd and php, added the configuration file for the site, everything is fine. I try to load it and see "access denied." but I have already granted to the apache user and apache group 755 rights (on every folder along the path).
Errors in apache log:
[Mon Jun 06 20:25:18.088420 2022] [negotiation:error] [pid 12656:tid
12758] (13)Permission denied: [client 127.0.0.1:45920] AH00686: cannot
read directory for multi: /home/concasse_master/Desktop/sample/public/
[Mon Jun 06 20:25:18.089421 2022] [proxy_fcgi:error] [pid 12656:tid
12758] [client 127.0.0.1:45920] AH01071: Got error 'Unable to open
primary script: /home/concasse_master/Desktop/sample/public/index.php
(Permission denied)'
localhost.conf:
<VirtualHost *:8080>
ServerName localhost
DocumentRoot /home/concasse_master/Desktop/sample/public
ErrorLog logs/error.log
CustomLog logs/access.log combined
<Directory /home/concasse_master/Desktop/sample/public/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

PHP pages showing up as Not Found

Im not sure what m doing wrong here but the server cant seem too find my php files hosted on the server. Not sure if this is due to Apache lacking something or php itself. Ive searched all over the internet followed everything I can find and am having no luck.
http://netauto.app.local/data.php thats the file im trying to reach.
-rwxrwxrwx 1 root root 6493 Jul 26 23:47 action_search.php - call this
-rwxrwxrwx 1 root root 640 Jul 26 23:48 data.php - call this
-rwxrwxrwx 1 root root 20 Jul 29 21:53 info.php - call this
-rwxrwxrwx 1 root root 15272 Jul 2 18:43 __init__.py
-rwxrwxrwx 1 root root 12964 Jul 2 18:43 __init__.pyc
drwxrwxrwx 2 root root 4096 Jun 18 16:37 __pycache__
drwxrwxrwx 3 root root 4096 Jul 27 01:46 static
drwxrwxrwx 4 root root 4096 Jul 26 22:48 templates
drwxrwxrwx 6 root root 4096 Apr 10 16:32 venv
Ive elevated everything to root with chmod 777 I want to change that to 644 but was running out of ideas. All the ones marked "call this" return a 404 not found when I try and navigate too it via the url. Also a debug on the website returns a 404 not found when I hit the php action.
folder paths look like this
---------flaskapp.wsgi
-----------------/FlaskApp
---------------------__init__.py
----------------------data.php
----------------------action_search.php
----------------------info.php
----------------------/templetes
----------------------/static
Heres the php mod
root#pdc-mgmt-netutl:/var/www/FlaskApp/FlaskApp# php -v
PHP 7.2.19-0ubuntu0.18.04.1 (cli) (built: Jun 4 2019 14:48:12) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.19-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies
root#pdc-mgmt-netutl:/var/www/FlaskApp/FlaskApp# cd /etc/apache2/sites-available/
Below is my flask.conf
<VirtualHost *:80>
WSGIScriptAlias / /var/www/FlaskApp/flaskapp.wsgi
WSGIDaemonProcess FlaskApp python-home=/var/www/FlaskApp/FlaskApp/venv/
WSGIProcessGroup FlaskApp
ServerName localhost
DocumentRoot /var/www/FlaskApp/FlaskApp/
<Directory /var/www/FlaskApp/FlaskApp>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Require all granted
allow from all
</Directory>
Alias /static /var/www/FlaskApp/FlaskApp/static
<Directory /var/www/FlaskApp/FlaskApp/static/>
Order allow,deny
Allow from all
Require all granted
</Directory>
Alias /templetes /var/www/FlaskApp/FlaskApp/templetes
<Directory /var/www/FlaskApp/FlaskApp/templetes/>
Order allow,deny
Allow from all
Require all granted
</Directory>
LoadModule php7_module modules/php7apache2_4.dll
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
AddType application/x-httpd-php .php
AddHandler application/x-httpd-php .php
PHPIniDir "/etc/php/7.2/apache2/php.ini"
</VirtualHost>

Forbidden You don't have permission to access /folder on this server

I am trying to run a php app but keep getting the
"Forbidden You don't have permission to access /folder on this server."
I have Require all granted uncommented in my httpd.conf and I've also tried setting the permissions with
sudo chown -R $USER:$STAFF ~/Sites/secondPHPApp
and
sudo chmod -R 755 ~/Sites/
I have my phpadmin in that file. I can access the phpadmin from the browser and get the IT WORKS default page but having trouble accessing my app folder because of the permission issue.
This is my vhost settings in httpd-vhosts.conf (note: I do have an actual email and username in the actual file.):
<VirtualHost *:80>
ServerName test.com
ServerAlias www.test.com
ServerAdmin email
DocumentRoot “/Users/username/Sites/secondPHPApp”
</VirtualHost>
<VirtualHost *:80>
ServerName localhost
DocumentRoot /Library/WebServer/Documents/
</VirtualHost>
Result of ls -al ~/Sites:
total 32
drwxr-xr-x 6 755 staff 204 Feb 16 11:00 .
drwxr-xr-x+ 51 LonnieMcGill staff 1734 Feb 15 14:33 ..
-rwxr-xr-x# 1 755 staff 6148 Feb 16 10:47 .DS_Store
-rwxr-xr-x 1 755 staff 20 Feb 15 09:53 index.php
drwxr-xr-x# 112 755 staff 3808 Feb 15 13:34 phpmyadmin
lrwxr-xr-x 1 755 staff 60 Feb 16 11:00 secondPHPApp -> /Users/LonnieMcGill/Desktop/Project Folder/php/secondPHPApp/
Result of ls -al ~/Sites/secondPHPApp:
lrwxr-xr-x 1 755 staff 60 Feb 16 11:00 /Users/LonnieMcGill/Sites/secondPHPApp -> /Users/LonnieMcGill/Desktop/Project Folder/php/secondPHPApp/
Result of ls -al ~/Sites/secondPHPApp/index.html:
-rw-r--r-- 1 LonnieMcGill staff 360 Feb 16 11:02 /Users/LonnieMcGill/Sites/secondPHPApp/index.html
After investigating with Lonnie in the discussion for a while, it turns out that it was the french double quote. Since the french double quote and the english double quote is different, apache consider it part of the file path therefore its unable to locate the document root specified in the vhost so it returns a 403 error.
DocumentRoot "/Users/username/Sites/secondPHPApp"

Laravel 5.1 CentOs7 deployement Not Found The requested URL was not found on this server

I am trying to deploy my laravel project, I have installed Apache, MySQL, PHP, composer and laravel. I have pulled in my project via git and ran composer install, php artisan migrate --seed. When I go to my site I see the homepage of my app great! When I try to go to an other page let's say /auth/register I get the error The requested URL was not found on this server.
Here are my permissions on my files:
drwxr-xr-x 12 root root 4096 Nov 22 16:33 ..
drwxr-x--- 10 apache apache 4096 Nov 22 16:33 app
-rwxr-x--- 1 apache apache 1646 Nov 22 16:33 artisan
-rwxr-x--- 1 apache apache 320 Nov 22 16:33 behat.yml
drwxr-x--- 3 apache apache 4096 Nov 22 16:33 bootstrap
-rwxr-x--- 1 apache apache 1665 Nov 22 16:33 composer.json
-rwxr-x--- 1 apache apache 143064 Nov 22 16:41 composer.lock
drwxr-x--- 2 apache apache 4096 Nov 22 16:33 config
drwxr-x--- 5 apache apache 4096 Nov 22 16:33 database
drwxr-x--- 3 apache apache 4096 Nov 22 16:33 features
drwxr-x--- 8 apache apache 4096 Nov 22 16:33 .git
-rwxr-x--- 1 apache apache 135 Nov 22 16:33 .gitignore
-rwxr-x--- 1 apache apache 503 Nov 22 16:33 gulpfile.js
-rwxr-x--- 1 apache apache 159 Nov 22 16:33 package.json
-rwxr-x--- 1 apache apache 87 Nov 22 16:33 phpspec.yml
-rwxr-x--- 1 apache apache 899 Nov 22 16:33 phpunit.xml
drwxr-x--- 5 apache apache 4096 Nov 22 16:33 public
-rwxr-x--- 1 apache apache 1928 Nov 22 16:33 README.md
drwxr-x--- 5 apache apache 4096 Nov 22 16:33 resources
-rwxr-x--- 1 apache apache 567 Nov 22 16:33 server.php
drwxr-x--- 5 apache apache 4096 Nov 22 16:33 storage
drwxr-x--- 2 apache apache 4096 Nov 22 16:33 tests
-rwxr-x--- 1 apache apache 494 Nov 22 16:33 Vagrantfile
drwxr-x--- 39 apache apache 4096 Nov 22 16:42 vendor
My virtual host file:
<Directory "/home/spark/public">
Require all granted
</Directory>
<VirtualHost *:80>
ServerName myurl
DocumentRoot "/home/spark/public"
ErrorLog "/var/log/httpd/spark-error"
CustomLog "/var/log/httpd/spark-customlog" Common
</VirtualHost>
Fixed it by adding:
Allowoverride All
My virtual host file looks like this now
<Directory "/home/spark/public">
Require all granted
Allowoverride All
</Directory>
<VirtualHost *:80>
ServerName myurl
DocumentRoot "/home/spark/public"
ErrorLog "/var/log/httpd/spark-error"
CustomLog "/var/log/httpd/spark-customlog" Common
</VirtualHost>
Try:
<VirtualHost *:80>
ServerName myurl
DocumentRoot "/home/spark/public"
<Directory "/home/spark/public">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog "/var/log/httpd/spark-error"
CustomLog "/var/log/httpd/spark-customlog" Common
</VirtualHost>
and sudo restart apache2

Laravel 5.1 project deployement permissions issues

I am trying to deploy my laravel project. I have installed apache, mysql, php, composer and laravel and pulled my project into /home/spark and ran composer install. Now when I surf to my ip I only see the apache test page.
When I take a peek in my log files I see these 2 errors:
[Sun Nov 22 17:37:54.598627 2015] [core:error] [pid 16141] (13)Permission denied: [client 78.20.130.157:50142] AH00035: access to /index.html denied (filesystem path '/home/spark/public/index.html') because search permissions are missing on a component of the path
[Sun Nov 22 17:37:54.598708 2015] [core:error] [pid 16141] (13)Permission denied: [client 78.20.130.157:50142] AH00035: access to /index.php denied (filesystem path '/home/spark/public/index.php') because search permissions are missing on a component of the path
I have no idea how to fix the permessions. Anyone can help me out?
Thanks in advance!
Here's my spark.conf file for my virtualhost maybe it's not good either:
<Directory "/home/spark/public">
Require all granted
</Directory>
<VirtualHost *:80>
ServerName myurl
DocumentRoot "/home/spark/public"
ErrorLog "/var/log/httpd/spark-error"
CustomLog "/var/log/httpd/spark-customlog" Common
</VirtualHost>
the permissions on my files in /home/spark/public
drwxr-x--- 5 root root 4096 Nov 22 16:33 .
drwxr-x--- 13 spark apache 4096 Nov 22 16:35 ..
drwxr-x--- 2 root root 4096 Nov 22 16:33 css
-rwxr-x--- 1 root root 0 Nov 22 16:33 favicon.ico
-rwxr-x--- 1 root root 412 Nov 22 16:33 .htaccess
drwxr-x--- 2 root root 4096 Nov 22 16:33 images
-rwxr-x--- 1 root root 1786 Nov 22 16:33 index.php
-rwxr-x--- 1 root root 24 Nov 22 16:33 robots.txt
drwxr-x--- 3 root root 4096 Nov 22 16:33 uploads
Make apache the owner of all your application folders and files like so :
sudo chown -R apache:apache .
your current folder should be the application folder before running this command

Categories