php and Hiawatha forbidden error

Forum Forums New users New Users and General Questions php and Hiawatha forbidden error

  • This topic has 5 replies, 2 voices, and was last updated Dec 6-10:20 am by oldman.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #3360
    Member
    oldman

      I have installed Antix 17 using the net install ISO. Having installed the base system, I also installed php 7.0, mariadb and Hiawatha (from a unofficial deb) with apt.

      Now I am trying to run the Hiawatha server with php 7.0 (fpm), but I cannot get php to work through the server, I keep getting a “403 FORBIDDEN” error when trying to view the output from any php file, but normal html files work.

      I have looked on the internet for help and changed file permissions, but to no avail.

      My main objective is to run a personel copy of Mediawiki on a LAN.

      I have in the past (12+ years ago) setup a Ubuntu server running Apache, php 5 and Mysql successfully, But I do not like Apache and I do like Hiawatha and would very much like to be able to run it.

      So if anyone here is able to help, I would be thankful for any help and advice which enables me to set it up correctly.

      These are the files permissions:

      /usr/bin/php Irwxrwxrwx 1 root root 21 -> /etc/alternatives/php
      /usr/bin/php7.0 -rwxr-xr-x 1 root root 4087440
      /usr/bin/php-cgi Irwxrwxrwx 1 root root 25 -> /etc/alternatives/php-cgi
      /usr/bin/php-cgi7.0 -rwxr-xr-x 1 root root 4021984

      /var/www
      drwxrwsr-x 1 www-data webstaff 20 hiawatha
      -rw-r—-x 1 root webstaff 25 index.cgi
      -rw-rw—x 1 www-data webstaff 250 index.html
      -rwxrwxrwx 1 oldman webstaff 25 index.php
      drwxrwsr-x 1 www-data webstaff 808 mediawiki

      /var
      drwxrwsr-x 1 root webstaff 90 www

      The index.cgi and the index.php, are just for testing; they are the same file (<?php echo phpinfo(); ?>) but with different file extensions. Changing oldman to www-data does not help, still the same error.
      Looking at the permissions for php; my problem could be that php is running as root? I have tried to change the permission on php, from root to www-data, but it did not change from root.

      #3363
      Anonymous

        At a glance, forbidden ~= “saving you from shooting self in foot”

        -rwxrwxrwx 1 oldman webstaff 25 index.php

        0777 permissions ? (ouch)

        When using PHP with Hiawatha, make sure you use the following PHP settings in php.ini

        cgi.fix_pathinfo = 0
        cgi.rfc2616_headers = 0

        The following settings are not required, but recommended.

        # Enable GZip content encoding
        zlib.output_compression = On
        zlib.output_compression_level = 6

        # Security settings
        expose_php = Off
        display_errors = Off
        register_globals = Off
        magic_quotes_gpc = Off
        allow_url_include = Off

        ^— outdated? (in PHP7, magic_quotes is “no longer a thing”, eh)

        #3364
        Anonymous

          HTH

          found via websearch “hiawatha server cgi”
          Common Gateway Interface (CGI) scripts work with Hiawatha out of the box, the CGI module in the VirtualHost section just needs to be enabled as follows:
          ———- click the link. Fearing the wrath of WordFence, I won’t dare to attempt pasting it here ———-

          #3365
          Member
          oldman

            At a glance, forbidden ~= “saving you from shooting self in foot”

            -rwxrwxrwx 1 oldman webstaff 25 index.php

            0777 permissions ? (ouch)

            That was done just to see if that made any difference; I did say they were for testing.

            When using PHP with Hiawatha, make sure you use the following PHP settings in php.ini

            cgi.fix_pathinfo = 0
            cgi.rfc2616_headers = 0

            The following settings are not required, but recommended.

            # Enable GZip content encoding
            zlib.output_compression = On
            zlib.output_compression_level = 6

            # Security settings
            expose_php = Off
            display_errors = Off
            register_globals = Off
            magic_quotes_gpc = Off
            allow_url_include = Off

            The above looks familiar, I think that as already been done!

            #3367
            Anonymous

              That was done just to see if that made any difference; I did say they were for testing.

              Just understand that the 403 response is the expected (hardcoded) server behavior.
              “testing” with 0777… only serves to confirm that the server “gots ya covered, just in case”.
              So, what’s the outcome when given normal permissions?

              I dropped out of the scene back around PHP v5.3
              From foggy memory, the only other detail which comes to mind: check php.ini for line(s) mentioning mod_cgi (may be present, but outcommented, by default)

              hmmmm, websearch “hiawatha htaccess cgi” ?

              #3466
              Member
              oldman

                This is an update:

                I decided to do a fresh install of Antix. I had problems with Grub not being installed properly, so I solved that by using a re-install option for Grub, on an Ubuntu CD, which allowed me to boot into Antix.

                I have found a script here that automates the installation of hiawatha, php and mariadb. It is a little out of date now. I first ran it as it is, but with no luck, then I changed php5 to php7.0, but still could not download php. First time it said that it could not find php5 the second time it said that it could grep or mod (?). So at the moment, I have got an OS that cannot do anything really useful.

                If I cannot get Hiawatha and php to work, then I look like having to go with the default Ubuntu server (Apache) and hope that I can get Mediawiki to work.

              Viewing 6 posts - 1 through 6 (of 6 total)
              • You must be logged in to reply to this topic.