PHP form submit 403

Discussion in 'HOWTO-Related Questions' started by 84CJ7, Sep 8, 2017.

  1. 84CJ7

    84CJ7 New Member

    Thanks in advance for the help.
    I have a contact form that I'm get an error: 403 You are not permitted to access the requested URL.
    The file's permissions are rw-r--r--
    This is the only problem that I am having.
    The apache2 error log does not mention any errors.
    Is there a switch that I need to set?
    Thanks
     
  2. Hi,
    There should be some logs generated if you have configured the error logs for that domain. Can you confirm if you have setup the same?
    Also, can you check .htaccess rules which may restricting the page from access?
     
  3. 84CJ7

    84CJ7 New Member

    Thanks for the reply. I will followup in the morning.
     
  4. 84CJ7

    84CJ7 New Member

    Hello,
    I do not have a .httaccess file at / var / www / html. Would it be in another location or is it needed?
    My post count is too low to post the error log so I pasted it into the attached notepad document.
    Thanks
     

    Attached Files:

  5. till

    till Super Moderator Staff Member ISPConfig Developer

    The website root directory seems to be /var/www/mysitedotcom/web/ and not /var/www/html/, so when you have an .htaccess file, then it is in /var/www/mysitedotcom/web/folder.

    Does the file /var/www/mysitedotcom/web/mail.php exist?
     
  6. 84CJ7

    84CJ7 New Member

    Yes , it does. The whole site is in there.
     
  7. 84CJ7

    84CJ7 New Member

    When I enter ls -al or ls -a, I do not see .htaccess in /var/www/mysitedotcom/web
    Thanks
     
  8. Can you post apache virutalhost for mysitedotcom?
     
  9. 84CJ7

    84CJ7 New Member

    <Directory /var/www/mysite.com.
    AllowOverride None
    Require all denied
    </Directory>
    <VirtualHost mystaticIP>
    DocumentRoot /var/www/mysite.com/web
    ServerName mysite.com
    ServerAlias www.mysite.com
    ServerAdmin [email protected]
    ErrorLog /var/log/ispconfig/httpd/mysite.com/error.log
    Alias /error/ "var/www/mysite.com/web/error"
    ErrorDocument 400 /error/400.html
    ErrorDocument 401 /error/401.html
    ErrorDocument 403 /error/403.html
    ErrorDocument 404 /error/404.html
    ErrorDocument 405 /error/405.html
    ErrorDocument 500 /error/500.html
    ErrorDocument 502 /error/502.html
    ErrorDocument 503 /error/503.html
    <IfModule mod_ssl.c>
    </IfModule>
    <Directory /var/www/mysite.com/web>
    # Clear PHP settings of this website
    <FilesMatch ".+\.ph(p[345]?|t|tml)$">
    SetHandler None
    </FilesMatch>
    Options +FollowSymLinks
    AllowOverride All
    Require all granted
    <Files ~ ' .php[s3-6]{0,1}$'>
    Require all denied
    </Files>
    </Directory>
    <Directory /var/www/clients/clients2/web2/web>
    # Clear PHP settings of this website
    <FilesMatch ".+\.ph(p[345]?|t|tml)$">
    SetHandler None
    </FilesMatch>
    Options +FollowSymLinks
    AllowOverride All
    Require all granted
    <Files ~ ' .php[s3-6]{0,1}$'>
    Require all denied
    </Files>
    </Directory>
    # suexec enabled
    <IfModule mod_suexec.c>
    SuexecUserGroup web2 client2
    </IfModule>

    # add support for apache mpm_itk
    <IfModule mpm_itk_module>
    AssignUserId web2 client2
    </IfModule>
    <IfModule mod_dav_fs.c>
    # Do not execute PHP files in webdav directory
    <Directory /var/www/clients/client2/web2/webdav
    <ifModule mod_security2.c>
    SecRuleRemoveById 960015
    SecRuleRemoveById 960032
    </ifModule>
    <FilesMatch "\.ph(p3?|tml)$">
    SetHandler None
    </FilesMatch>
    </Directory>
    DavLockDB /var/www/clients/client2/web2/tmp/DavLock
    # DO NOT REMOVE THE COMMENTS!
    # IF YOU REMOVE THEM, WEBDAV WILL NOT WORK ANYMORE!
    # WEBDAV BEGIN
    # WEBDAV END
    </IfModule>
    </VirtualHost>

    Thanks
     
  10. till

    till Super Moderator Staff Member ISPConfig Developer

    That's a standard ISPConfig vhost, so that's fine. Login to ispconfig, go to the settings f this site, switch to * in the ipv4 field and press save. Wait at least one minute and then try to access the site again. My guess is that you selected a wrong IP in the website settings and therefore apache is routing the traffic to a wrong vhost.
     
  11. HSorgYves

    HSorgYves Active Member HowtoForge Supporter

    If I am not mistaken, then there is no Handler set for php files in that vhost...
     
    till likes this.
  12. till

    till Super Moderator Staff Member ISPConfig Developer

    You're totally right of course. Completely missed that. Set php mode in the website to php-fcgi or php-fpm.
     
  13. 84CJ7

    84CJ7 New Member

    Thanks, it looks like setting the PHP Handler did it! The form is working.
    When I change the IP address to * the default ISPConfig welcome page loads.
     
  14. Landia

    Landia New Member

    I have the same problem, so waiting for comment to fix

    ---------------- appnaz.com -------------------
     
  15. HSorgYves

    HSorgYves Active Member HowtoForge Supporter

    @Landia: If it is really the same problem, then enable php for that domain in ISPConfig.
     
  16. Landia

    Landia New Member

    yes, thanks for this reply, let me try and tell later.
     

Share This Page