Posted: May 31, 2019 @ 02:20 AM
#################################################
### To get UAP v4 working on a SuSE Leap 15 installation, several
### preps are required, which are described in the file README.
### To get lighty to work with uap, several changes are required.
### This is a bit advanced stuff, so better to get UAP with Apache
### working first, and then try the setup with lighty server.
#################################################
#######################
### System Configuration: ###
#######################
A working configuration with OpenSuSE Linux, UAPv4, mariadb and Apache2 is described here in the forum:
https://www.userapplepie.com/Topic/67/
After system is working with Apache, these are the necessary changes:
Codesudo zypper in lighttpd
File
/etc/group:
The userID of the running lighty process must be added to the www group, mine looks like this:
Codewww:x:497:wwwrun,lighttpd
######################
### lighty Configuration: ###
######################
Lighty doesn't know .htaccess files, and some slight changes in the config files are required, to get it to work. Files which were changed (diff output):
Codelighttpd.conf
93c93
< #server.use-ipv6 = "enable"
---
> server.use-ipv6 = "enable"
328c328
< "index.php", "index.xhtml", "index.html", "index.htm", "default.htm"
---
> "index.xhtml", "index.html", "index.htm", "default.htm", "index.php"
Codedebug.conf
17c17
< debug.log-request-handling = "enable"
---
> #debug.log-request-handling = "enable"
Codefastcgi.conf
133,148d132
< #
<
< fastcgi.server = ( ".php" =>
< ( "localhost" =>
< (
< # "socket" => "/var/run/lighttpd/php-fastcgi.socket",
< "socket" => socket_dir + "/php-fastcgi-1.socket",
< "bin-path" => "/usr/bin/php-cgi",
< "max-procs" => 5,
< "bin-environment" => (
< "PHP_FCGI_CHILDREN" => "16",
< "PHP_FCGI_MAX_REQUESTS" => "10000" ),
< "broken-scriptfilename" => "enable"
< )
< )
< )
Codemodules.conf
48a49
> # "mod_rewrite",
51,52d51
< "mod_fastcgi",
< "mod_rewrite",
60,66d58
< # test ok: url.rewrite-once = ( "^/?test.html$" => "test.php" )
< url.rewrite-if-not-file = ( "^/(.*)$" => "/index.php?url=$1" )
< ##
< #######################################################################
<
< #######################################################################
< ##
146c138
< include "conf.d/fastcgi.conf"
---
> #include "conf.d/fastcgi.conf"
############################
### Check if lighty works for UAP: ###
############################
Create the following files in lighty's DocumentRoot:
File
info.php:
File
test.html:
Code<h1 style="color:red">This is the HTML file.</h1>
File
test.php:
Code<h1 style="color:green">HELLO WORLD! This is the PHP file.</h1>
Codechown wwwrun:www /srv/www/htdocs/*
chmod 664 *
1.) Check if PHP is working in lighty:
Direct your browser to /srv/www/htdocs/info.php. This should display the PHP webpage with it's version number and the many settings of PHP.
2.) Check if lighty's redirect works:
Check lighty's modules.conf file, if mod_rewrite is not commented out. Also there should be a line below like this:
Codeurl.rewrite-once = ( "^/?test.html$" => "test.php" )
Restart lighty, and direct your browser to /srv/www/htdocs/test.html, the result should be the
green HELLO WORLD line from the php file. If the
red HELLO WORLD line from test.html is shown, the mod_rewrite doesn't work.
########################
### MariaDB Configuration ###
########################
There are no specific changes required to mariadb and it's config.
##############
### UAP files: ###
##############
A script called "uap_install.sh" helped to install with an Apache setup,
supporting different installation options. They are "Apache centric", cause
also UAP's setup is Apache centric. As such the script "uap_install.sh" doesn't
work for all options. The best way is to use option "-ds3", which is a
complete installation, without going though UAP's setup procedure.
Again: the script reads its data from "uap.conf", where you can change
to your required settings.
If the redirect test succeeds, comment out this test line and uncomment the line or add it accordingly:
Codeurl.rewrite-if-not-file = ( "^/(.*)$" => "/index.php?url=$1" )
Restart lighty, and direct your browser to your document root (/srv/www/htdocs/). The default UAP site should appear.
File
app/View/Home/Home.php:
I found out, that there is an issue with double (forward) slashes in the URL path, which obviously Apache can handle, but lighty fails. The picture in the home page would then not be displayed. Looking at the source code of the homepage in the web browser, one can see after the <!-- BreadCrumbs --> section the line with the logo:
Code... img src='http://test.my.domain//Templates/Default/Assets/images/uap3logolg.gif'
After the SITE_URL is a slash, cause in the config.php file I provided "http://test.my.domain/" acordingly. Looking at the code in app/View/Home/Home.php, line 19 is providing the additional slash:
Code<center><img src='<?=SITE_URL?>/Templates/<?=DEFAULT_TEMPLATE?>/Assets/images/uap3logolg.gif' class='img-fluid' /></center>
Removing the slash before "Templates" makes it work again.
File
app/System/ErrorLogger.php:
A similiar thing appears, when an error shall be logged:
CodeWarning: file_put_contents(/srv/www/htdocs//errors/php-error.log): failed to open stream: Permission denied in /srv/www/htdocs/app/System/ErrorLogger.php on line 157
The "permission denied" error is certainly due to access rights on the file system, verify that the process userID of lighty is included in the group www (file
/etc/group).
The line 157 in "app/System/ErrorLogger.php" is:
Codefile_put_contents(ROOTDIR.self::$errorFile, $logMessage, FILE_APPEND);
The variable "ROOTDIR" is defined in index.php as a simple slash. And line 42 would define the variable errorFile as:
Codepublic static $errorFile = '/errors/php-error.log';
resulting again in a double slash. I simply removed the first slash to get it to work.