Announcement

Collapse
No announcement yet.

How do I run PSP on a local server?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How do I run PSP on a local server?

    I have a pc as a server on my wlan (running Kubuntu 14.04)
    What do I need to do to use PHP in my html code?
    Last edited by Snowhog; Sep 14, 2015, 09:11 AM.

    #2
    I can see that php is actually running from the command line.
    ~$ php -a
    php > echo "test";
    test

    But in my index.html (which is at \var\www\html) the code doesn't run.

    any ideas?

    Comment


      #3
      Have you enabled the apache php module?

      Code:
      sudo a2enmod php5
      Since a2enmod is just a convenient way of creating symlinks between /etc/apache2/mods-available and /etc/apache2/mods-enabled, you need to reload your apache configuration after running that command, so that the module gets loaded:

      Code:
      sudo service apache2 reload
      Also, make sure your php code is wrapped in tags like this:

      Code:
      <?php header("HTTP/1.0 403 Forbidden"); ?>
      If not, you'll probably find that the html is served but the php is ignored.

      Your index file does not need to be made executable. Interestingly, there are two ways of using php, one is as an apache module (the way i've descibed here); the other is to use CGI (where each php file is a script, and you do need the files to be executable). There are pros and cons of both approaches, but I think the apache module way is the most common.
      samhobbs.co.uk

      Comment


        #4
        Thanks for the reply.
        Code:
        sudo service apache2 reload
        produces:-

        Code:
         * Reloading web server apache2                                                                                                  * 
         * The apache2 configtest failed. Not doing anything.
        Output of config test was:
        apache2: Syntax error on line 140 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/php5.load: Cannot load /usr/lib/apache2/modules/libphp5.so into server: /usr/lib/apache2/modules/libphp5.so: cannot open shared object file: No such file or directory
        Action 'configtest' failed.
        The Apache error log may have more information.
        Not quite sure what all this means.
        I'll look for the log file

        Comment


          #5
          This is the content of the error log:-
          Code:
          [Mon Jan 05 11:13:54.134240 2015] [mpm_event:notice] [pid 8390:tid 140039361808256] AH00489: Apache/2.4.7 (Ubuntu) configured -- resuming normal operations
          [Mon Jan 05 11:13:54.134348 2015] [core:notice] [pid 8390:tid 140039361808256] AH00094: Command line: '/usr/sbin/apache2'
          [Mon Jan 05 11:14:15.331472 2015] [mpm_event:notice] [pid 8390:tid 140039361808256] AH00491: caught SIGTERM, shutting down
          [Mon Jan 05 11:14:16.409399 2015] [mpm_prefork:notice] [pid 11113] AH00163: Apache/2.4.7 (Ubuntu) configured -- resuming normal operations
          [Mon Jan 05 11:14:16.409490 2015] [core:notice] [pid 11113] AH00094: Command line: '/usr/sbin/apache2'
          [Mon Jan 05 11:14:17.710319 2015] [mpm_prefork:notice] [pid 11113] AH00169: caught SIGTERM, shutting down
          [Mon Jan 05 11:14:18.819164 2015] [mpm_prefork:notice] [pid 11199] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.5 configured -- resuming normal operations
          [Mon Jan 05 11:14:18.819216 2015] [core:notice] [pid 11199] AH00094: Command line: '/usr/sbin/apache2'
          [Mon Jan 05 11:43:45.262819 2015] [mpm_prefork:notice] [pid 11199] AH00169: caught SIGTERM, shutting down
          [Mon Jan 05 11:44:56.957256 2015] [mpm_prefork:notice] [pid 1592] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.5 configured -- resuming normal operations
          [Mon Jan 05 11:44:57.003378 2015] [core:notice] [pid 1592] AH00094: Command line: '/usr/sbin/apache2'
          [Mon Jan 05 23:08:45.637172 2015] [mpm_prefork:notice] [pid 1592] AH00169: caught SIGTERM, shutting down
          [Tue Jan 06 08:26:34.349759 2015] [mpm_prefork:notice] [pid 1557] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.5 configured -- resuming normal operations
          [Tue Jan 06 08:26:34.438573 2015] [core:notice] [pid 1557] AH00094: Command line: '/usr/sbin/apache2'
          [Wed Jan 07 08:29:07.317681 2015] [mpm_prefork:notice] [pid 1549] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.5 configured -- resuming normal operations
          [Wed Jan 07 08:29:07.355220 2015] [core:notice] [pid 1549] AH00094: Command line: '/usr/sbin/apache2'
          [Wed Jan 07 22:39:18.509575 2015] [mpm_prefork:notice] [pid 1549] AH00169: caught SIGTERM, shutting down
          [Thu Jan 08 08:03:45.218083 2015] [mpm_prefork:notice] [pid 1505] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.5 configured -- resuming normal operations
          [Thu Jan 08 08:03:45.255629 2015] [core:notice] [pid 1505] AH00094: Command line: '/usr/sbin/apache2'
          [Thu Jan 08 22:35:56.659683 2015] [mpm_prefork:notice] [pid 1505] AH00169: caught SIGTERM, shutting down
          [Fri Jan 09 08:18:13.741797 2015] [mpm_prefork:notice] [pid 1560] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.5 configured -- resuming normal operations
          [Fri Jan 09 08:18:13.779259 2015] [core:notice] [pid 1560] AH00094: Command line: '/usr/sbin/apache2'
          [Fri Jan 09 23:07:01.783832 2015] [mpm_prefork:notice] [pid 1560] AH00169: caught SIGTERM, shutting down
          [Sat Jan 10 07:15:03.797330 2015] [mpm_prefork:notice] [pid 1556] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.5 configured -- resuming normal operations
          [Sat Jan 10 07:15:03.870833 2015] [core:notice] [pid 1556] AH00094: Command line: '/usr/sbin/apache2'
          [Sat Jan 10 23:17:39.425729 2015] [mpm_prefork:notice] [pid 1556] AH00169: caught SIGTERM, shutting down
          [Sun Jan 11 07:49:15.241789 2015] [mpm_prefork:notice] [pid 1546] AH00163: Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.5 configured -- resuming normal operations
          [Sun Jan 11 07:49:15.291222 2015] [core:notice] [pid 1546] AH00094: Command line: '/usr/sbin/apache2'
          [Sun Jan 11 08:13:02.945006 2015] [mpm_prefork:notice] [pid 1546] AH00171: Graceful restart requested, doing restart
          AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message

          Comment


            #6
            What do your apache2.conf and php5.load files look like?

            Comment


              #7
              apache2.conf looks very complicated!
              Line 140 is
              Code:
              IncludeOptional mods-enabled/*.load
              php5.load has one line
              Code:
              LoadModule php5_module /usr/lib/apache2/modules/libphp5.so
              There is no /usr/lib/apache2/modules/libphp5.so

              Thanks

              Comment


                #8
                Strange... maybe it's not installed (but then why did the module exist in mods-available?). Try:

                Code:
                apt-cache policy php5
                and

                Code:
                apt-cache policy libapache2-mod-php5
                If they aren't installed, install them and try again...
                samhobbs.co.uk

                Comment


                  #9
                  I would reinstall all of php to see if it can correct itself.

                  Code:
                  sudo apt-get purge php5 libapache2-mod-php5 php5-mcrypt
                  sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt

                  Comment


                    #10
                    Thanks, reinstalled all of php as suggested and its all working.
                    Many thanks for all the help

                    Comment

                    Working...
                    X