Openlightspeed and php not working

anay

Verified User
Joined
Dec 7, 2005
Messages
114
I configured one of DA with OpenLightspeed , imported few accounts from other servers. They are working fine however, if I create new account, I can't use PHP with it. If I check logs , I get this :
Code:
MIME type [application/x-httpd-php] for suffix '.php' does not allow serving as static file, access denied

If it was Apache, could be easily managed through DA UI at Advanced Feature --> Advanced Handlers , I can see that under "System Apache Handlers" is set to
application/x-httpd-php.inc .php .php5 .php73 .phtml

Since I don't have idea how OpenLight speed stuff is handled , can anyone point where to look to get it fixed ?


UPDATE:

While looking more into it, I got it working if I add following in .htaccess in root :
Code:
AddHandler application/x-httpd-php7  .php .phtml

I assume, somehow new account is not set to handle PHP.

Content of /usr/local/lsws/conf/httpd-scripthandler.conf
Code:
scriptHandler{
add lsapi:lsphp71 php
add lsapi:lsphpwebapps lsphpwebapps
}

I checked directadmin-vhost config file ie. : /usr/local/directadmin/data/users/username/openlitespeed.conf
Its scripthandler part says (if I select PHP 7.1
Code:
scripthandler  {
    add                     lsapi:lsphp71 inc
    add                     lsapi:lsphp71 php
    add                     lsapi:lsphp71 phtml
    add                     lsapi:lsphp71 php71
  }
If I switch to PHP 7.3 from DA UI
Code:
  scripthandler  {
    add                     lsapi:lsphp73 inc
    add                     lsapi:lsphp73 php
    add                     lsapi:lsphp73 phtml
    add                     lsapi:lsphp73 php73
  }

Then why It is not working without adding AddHandler directive to .htaccess ?


Another Update

I checked /var/log/httpd/error_log found series of following errors for multiple users:
Code:
2020-04-30 17:30:10.189284 [ERROR] [config:server:epsr:lsphp73] invalid path - /usr/local/php73/bin/lsphp, it cannot be started by Web server!
2020-04-30 17:30:10.760024 [ERROR] [config:server:vhosts:vhost:zap.userA-443:context:/cgi-bin/] path is not accessible: /home/userA/domains/userA.com/public_html/cgi-bin/
2020-04-30 17:30:10.761159 [ERROR] [config:server:vhosts:vhost:userB.com-80:scripthandler:add] HttpMime::addMimeHandler getHandler with name lsphp73 ret (nil)
2020-04-30 17:30:10.761195 [ERROR] [config:server:vhosts:vhost:userB.com-80:scripthandler:add] use static file handler for suffix [inc]
 
Last edited:
I'd suggest managing PHP versions/selections in DirectAdmin interface, not manually :) And make sure you've installed PHP using CustomBuild too.
 
I have installed it from Custombuild only, went through custombuild guides, did some test install and then only went for production. If I had wanted to do it all manually then why I opted for DirectAdmin, you guys are already working to make it easier.

The findings you are seeing above are just for diagnosis so that someone informed can give some pointers. I tried to give as much as information I can give in advance in order to get it sorted out efficiently as with my limited knowledge.

I though I could get it sorted out without rebuild but I will now give it a try ,perhaps there is new version available for Lsws as per custombuild. Lets hope rebuild along with upgrade will fix errors.
 
DA does not use application/x-httpd-php7 handler, that's why I think something is wrong there :) Try "./build php".
 
Did the same to me. Fresh install today, just switched from Apache httpd to Openlitespeed to test it. Nothing else touched.


# tail -f /var/log/httpd/error_log
2020-06-11 10:04:01.748834 [ERROR] [config:server:vhosts:vhost:eek:ls.xxx-443:scripthandler:add] use static file handler for suffix [inc]
2020-06-11 10:04:01.748842 [ERROR] [config:server:vhosts:vhost:eek:ls.xxx-443:scripthandler:add] HttpMime::addMimeHandler getHandler with name lsphp73 ret (nil)
2020-06-11 10:04:01.748845 [ERROR] [config:server:vhosts:vhost:eek:ls.xxx-443:scripthandler:add] use static file handler for suffix
PHP:
2020-06-11 10:04:01.748850 [ERROR] [config:server:vhosts:vhost:ols.xxx-443:scripthandler:add] HttpMime::addMimeHandler getHandler with name lsphp73 ret (nil)
2020-06-11 10:04:01.748853 [ERROR] [config:server:vhosts:vhost:olsxxx-443:scripthandler:add] use static file handler for suffix [phtml]
2020-06-11 10:04:01.748858 [ERROR] [config:server:vhosts:vhost:ols.xxx-443:scripthandler:add] HttpMime::addMimeHandler getHandler with name lsphp73 ret (nil)
2020-06-11 10:04:01.748860 [ERROR] [config:server:vhosts:vhost:ols.xxxr-443:scripthandler:add] use static file handler for suffix [php73]
2020-06-11 10:35:56.925971 [ERROR]  MIME type [application/x-httpd-php] for suffix '.php' does not allow serving as static file, access denied!
2020-06-11 10:36:12.041801 [ERROR]  MIME type [application/x-httpd-php] for suffix '.php' does not allow serving as static file, access denied!
2020-06-11 10:36:14.090590 [ERROR]  MIME type [application/x-httpd-php] for suffix '.php' does not allow serving as static file, access denied!

I had to rewrite confs and rebuild php to fix it.

# cd /usr/local/directadmin/custombuild
# ./build rewrite confs
# ./build php

Just changing from httpd to lsws and building results to this error. You also need to build php again.

Leaving this here, maybe it helps someone searching for this error.
 
Back
Top