Koozali.org: home of the SME Server

wordpress and php5-cgi

Offline Stefano

  • *
  • 10,894
  • +3/-0
wordpress and php5-cgi
« on: October 21, 2010, 11:56:27 AM »
Hi all

just installed wordpress (updated to last release)  and php5-cgi  via wiki howto.. so far so good

Now I want wordpress use php5-cgi, so I copied 92wordpress fragment in /templates-custom/ tree and edited this way:

Code: [Select]
{
     my $status = $wordpress{'status'} || "disabled";
     return "    # wordpress is disabled in this VirtualHost"
            unless $status eq 'enabled';

   $OUT = "";
    my $allow = 'all';
    my $pass = '0';
    my $satisfy = 'all';
    my $name = $wordpress{'Name'} || 'Wordpress weblog';
   
    for ('exit-if-none')
    {
      if ($wordpress{'PublicAccess'})
      {
          if ($wordpress{'PublicAccess'} eq 'none')
          {
           next;
          }
          elsif ($wordpress{'PublicAccess'} eq 'local')
          {
            $allow   = $localAccess;
            $pass    = 0;
            $satisfy = 'all';
          }
          elsif ($wordpress{'PublicAccess'} eq 'local-pw')
          {
            $allow   = $localAccess;
            $pass    = 1;
            $satisfy = 'all';
          }
          elsif ($wordpress{'PublicAccess'} eq 'global')
          {
            $allow   = 'all';
            $pass    = 0;
            $satisfy = 'all';
          }
          elsif ($wordpress{'PublicAccess'} eq 'global-pw')
          {
            $allow   = 'all';
            $pass    = 1;
            $satisfy = 'all';
          }
          elsif ($wordpress{'PublicAccess'} eq 'global-pw-remote')
          {
            $allow   = $localAccess;
            $pass    = 1;
            $satisfy = 'any';
          }
      }
     
      $OUT .= "#------------------------------------------------------------\n";
      $OUT .= "# wordpress - $name\n";
      $OUT .= "#------------------------------------------------------------\n";
     
      {
        if (exists $wordpress{'URL'})
        { $OUT .= "Alias  /$wordpress{'URL'}  /opt/wordpress\n"; }
      }
     
      $OUT .= "Alias  /wordpress  /opt/wordpress\n";
     
      $OUT .= "\n";
      $OUT .= "<Directory /opt/wordpress>\n";
      $OUT .= "    AddType application/x-httpd-php .php\n";
      $OUT .= "    php_admin_value open_basedir /opt/wordpress\n";
      $OUT .= "    Options None\n";
      $OUT .= "    order deny,allow\n";
      $OUT .= "    deny from all\n";
      $OUT .= "    allow from $allow\n";
      $OUT .= "    php_value mysql.default_host $wordpress{DbName}\n";
      $OUT .= "    php_value mysql.default_user $wordpress{DbUser}\n";
      $OUT .= "    php_value mysql.default_password $wordpress{DbPassword}\n";
      $OUT .= "    AddHandler php5-cgi .php\n";
      $OUT .= "    Action php5-cgi /php5-cgi/php-cgi\n";

      if ($pass)
      {
          $OUT .= "    AuthName \"$name\"\n";
          $OUT .= "    AuthType Basic\n";
          $OUT .= "    AuthExternal pwauth\n";
          $OUT .= "    require valid-user\n";
          $OUT .= "    Satisfy $satisfy\n";
      }
      $OUT .= "</Directory>\n";
    }
}

expanded template,checked syntax with
Code: [Select]
httpd -t

and restarted e-smith-httpd service

my httpd.conf file, for wordpress, says:
Code: [Select]
Alias  /wordpress  /opt/wordpress

<Directory /opt/wordpress>
    AddType application/x-httpd-php .php
    php_admin_value open_basedir /opt/wordpress
    Options None
    order deny,allow
    deny from all
    allow from all
    php_value mysql.default_host wordpress
    php_value mysql.default_user wordpress
    php_value mysql.default_password ***************
    AddHandler php5-cgi .php
    Action php5-cgi /php5-cgi/php-cgi
</Directory>

but if I run phpinfo() from /opt/wordpress/index.php I see:
Quote
PHP Version 4.3.9

any hint?

Tia

edit by Cactus: removed the password
« Last Edit: October 21, 2010, 12:05:22 PM by cactus »

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: wordpress and php5-cgi
« Reply #1 on: October 21, 2010, 12:11:23 PM »
Code: [Select]
    Action php5-cgi /php5-cgi/php-cgi
i think the problem lies in above line. IMHO the Action keyword first parameter is a filetype (see also http://httpd.apache.org/docs/2.0/mod/mod_actions.html#action). I am not sure if you set the proper file type here, AFAICT there is no php5-cgi file type. Did you copy this line from somewhere?

As far as I know the type should be application/x-httpd-php. But perhaps the php5-cgi handler is valid, but not configured in your case, see the link to the documentation I supplied for some examples.
« Last Edit: October 21, 2010, 12:20:24 PM by cactus »
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: wordpress and php5-cgi
« Reply #2 on: October 21, 2010, 12:17:25 PM »
Hi Cactus..

I copied from here

thanks

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: wordpress and php5-cgi
« Reply #3 on: October 21, 2010, 12:22:13 PM »
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: wordpress and php5-cgi
« Reply #4 on: October 21, 2010, 12:25:12 PM »
Then I am puzzled.

Then again... is your php5-cgi executable located at the location you specify (/php5-cgi/php-cgi)?
Code: [Select]
<Directory /opt/wordpress>
    ....
    AddHandler php5-cgi .php
    Action php5-cgi /php5-cgi/php-cgi
</Directory>
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline David Harper

  • *
  • 653
  • +0/-0
  • Watch this space
    • Workgroup Technology Solutions
Re: wordpress and php5-cgi
« Reply #5 on: October 21, 2010, 12:41:52 PM »
Does PHP5 work anywhere? Try enabling it on the Primary iBay and upload a phpinfo() file to check.

Also, try following the wiki instructions rather than editing the Wordpress template itself. That way the direction to load PHP5-CGI will likely be parsed by Apache before it processes the other options.

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: wordpress and php5-cgi
« Reply #6 on: October 21, 2010, 02:52:39 PM »
Does PHP5 work anywhere? Try enabling it on the Primary iBay and upload a phpinfo() file to check.

yes, it works flawlessy on ibays, just tested

finally I found the problem (after having dinner...): wordpress is in /opt but I'm using it as primary site, so I have:

Code: [Select]
[root@srvsrv scripts]# cd /home/e-smith/files/ibays/Primary/html/
[root@srvsrv html]# ls -la
total 12
drwxr-s---  2 admin shared 4096 Aug  2 16:16 .
drwxr-xr-x  5 root  root   4096 Aug  5 18:34 ..
lrwxrwxrwx  1 root  shared   24 Aug  2 16:16 .htaccess -> /opt/wordpress/.htaccess
-rw-r-----  1 admin shared  240 Jan 12  2010 index.old
lrwxrwxrwx  1 root  shared   24 Aug  2 12:11 index.php -> /opt/wordpress/index.php
lrwxrwxrwx  1 root  shared   26 Aug  2 12:11 license.txt -> /opt/wordpress/license.txt
lrwxrwxrwx  1 root  shared   26 Aug  2 12:11 readme.html -> /opt/wordpress/readme.html
lrwxrwxrwx  1 root  shared   30 Aug  2 12:11 wp-activate.php -> /opt/wordpress/wp-activate.php
lrwxrwxrwx  1 root  shared   23 Aug  2 12:11 wp-admin -> /opt/wordpress/wp-admin
lrwxrwxrwx  1 root  shared   25 Aug  2 12:11 wp-app.php -> /opt/wordpress/wp-app.php
lrwxrwxrwx  1 root  shared   26 Aug  2 12:11 wp-atom.php -> /opt/wordpress/wp-atom.php
lrwxrwxrwx  1 root  shared   33 Aug  2 12:11 wp-blog-header.php -> /opt/wordpress/wp-blog-header.php
lrwxrwxrwx  1 root  shared   35 Aug  2 12:11 wp-comments-post.php -> /opt/wordpress/wp-comments-post.php
lrwxrwxrwx  1 root  shared   34 Aug  2 12:11 wp-commentsrss2.php -> /opt/wordpress/wp-commentsrss2.php
lrwxrwxrwx  1 root  shared   28 Aug  2 12:11 wp-config.php -> /opt/wordpress/wp-config.php
lrwxrwxrwx  1 root  shared   35 Aug  2 12:11 wp-config-sample.php -> /opt/wordpress/wp-config-sample.php
lrwxrwxrwx  1 root  shared   25 Aug  2 12:11 wp-content -> /opt/wordpress/wp-content
lrwxrwxrwx  1 root  shared   26 Aug  2 12:11 wp-cron.php -> /opt/wordpress/wp-cron.php
lrwxrwxrwx  1 root  shared   26 Aug  2 12:11 wp-feed.php -> /opt/wordpress/wp-feed.php
lrwxrwxrwx  1 root  shared   26 Aug  2 12:11 wp-includes -> /opt/wordpress/wp-includes
lrwxrwxrwx  1 root  shared   32 Aug  2 12:11 wp-links-opml.php -> /opt/wordpress/wp-links-opml.php
lrwxrwxrwx  1 root  shared   26 Aug  2 12:11 wp-load.php -> /opt/wordpress/wp-load.php
lrwxrwxrwx  1 root  shared   27 Aug  2 12:11 wp-login.php -> /opt/wordpress/wp-login.php
lrwxrwxrwx  1 root  shared   26 Aug  2 12:11 wp-mail.php -> /opt/wordpress/wp-mail.php
lrwxrwxrwx  1 root  shared   26 Aug  2 12:11 wp-pass.php -> /opt/wordpress/wp-pass.php
lrwxrwxrwx  1 root  shared   25 Aug  2 12:11 wp-rdf.php -> /opt/wordpress/wp-rdf.php
lrwxrwxrwx  1 root  shared   30 Aug  2 12:11 wp-register.php -> /opt/wordpress/wp-register.php
lrwxrwxrwx  1 root  shared   26 Aug  2 12:11 wp-rss2.php -> /opt/wordpress/wp-rss2.php
lrwxrwxrwx  1 root  shared   25 Aug  2 12:11 wp-rss.php -> /opt/wordpress/wp-rss.php
lrwxrwxrwx  1 root  shared   30 Aug  2 12:11 wp-settings.php -> /opt/wordpress/wp-settings.php
lrwxrwxrwx  1 root  shared   28 Aug  2 12:11 wp-signup.php -> /opt/wordpress/wp-signup.php
lrwxrwxrwx  1 root  shared   31 Aug  2 12:11 wp-trackback.php -> /opt/wordpress/wp-trackback.php
lrwxrwxrwx  1 root  shared   25 Aug  2 12:11 xmlrpc.php -> /opt/wordpress/xmlrpc.php

applying php directive to Primary ibay solved the issue

thank you

Offline David Harper

  • *
  • 653
  • +0/-0
  • Watch this space
    • Workgroup Technology Solutions
Re: wordpress and php5-cgi
« Reply #7 on: October 21, 2010, 02:55:06 PM »
Glad to have stumbled across the answer!

Offline Fumetto

  • *
  • 899
  • +1/-0
Re: wordpress and php5-cgi
« Reply #8 on: October 21, 2010, 03:48:28 PM »
finally I found the problem (after having dinner...)
New rule for solving problems at SME: with a full stomach is better reasoning... :)

Offline cactus

  • *
  • 4,880
  • +3/-0
    • http://www.snetram.nl
Re: wordpress and php5-cgi
« Reply #9 on: October 21, 2010, 05:41:06 PM »
finally I found the problem (after having dinner...): wordpress is in /opt but I'm using it as primary site, so I have:
Dinner at this time? I thought you were living in CET-zone...
Be careful whose advice you buy, but be patient with those who supply it. Advice is a form of nostalgia, dispensing it is a way of fishing the past from the disposal, wiping it off, painting over the ugly parts and recycling it for more than its worth ~ Baz Luhrmann - Everybody's Free (To Wear Sunscreen)

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: wordpress and php5-cgi
« Reply #10 on: October 21, 2010, 05:50:31 PM »
Dinner at this time? I thought you were living in CET-zone...

well, you are right.. I meant lunch, but after I solved the problem, I fell asleep :-D

Offline janet

  • *****
  • 4,812
  • +0/-0
Re: wordpress and php5-cgi
« Reply #11 on: October 22, 2010, 12:06:43 AM »
Stefano

Quote
wordpress is in /opt but I'm using it as primary site..

From your directory listing it appears you have created a whole lot of symlinks to the files in /opt
Is that how you made access to /opt functional (from the Primary ibay) ?
Did you need to use/create any other aliases or do anything else eg along the lines of the web application redirect howto ?
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.

Offline Stefano

  • *
  • 10,894
  • +3/-0
Re: wordpress and php5-cgi
« Reply #12 on: October 22, 2010, 12:22:12 AM »
Stefano

From your directory listing it appears you have created a whole lot of symlinks to the files in /opt
Is that how you made access to /opt functional (from the Primary ibay) ?
Did you need to use/create any other aliases or do anything else eg along the lines of the web application redirect howto ?


Mary, IIRC, I just followed this suggestion, adapted to wordpress

HTH