OpenSuSE Leap15, weird paths after packagist install
Views 237
Sweets 1
Images 0

5 months ago Topic

pebwindkraft
Offline
Member
Total Posts: 9
Joined: May 03, 2019
Posted: May 04, 2019 @ 04:45 PM
Running OpenSuse Leap15, installed mariadb and apache, installed mod_rewrite, and an index page and info.php page is displayed correctly (from /srv/www/htdocs). No virtual host. Apache on OpenSuSE is using /srv/www, and then /srv/www/htdocs as document root. I am marrying two apps, so created a folder called /srv/www/htdocs/marriage, and according to README.md, I tried packagist install. composer create-project userapplepie/uap-user-management uap dev-master Restarted Apache, and went in the browser line to folder "http://127.0.0.1/marriage/uap", which leads me to install step1. All green, so click on button for step 2. Apache shows me a 404 error. Observation: the browser shows e.g. "http://127.0.0.1/?instal l_step=2...". I was wondering, why my subfolders were not recognized (marriage/uap), and entered it manually (http://127.0.0.1/marriage/uap/?install_step=2...). And there you go! It continued to the next step. Same procedure for step 3, 4 and 5. Once finished, I could see the "HOME" page, but any link for sure would not work, as it points to a wrong directory path. Config.php has this entry: define('SITE_URL', 'http://192.168.8.103/marriage/uap/'); (also tried localhost), and didn't any changes to index.php (no change to APPDIR, SYSTEMDIR, PUBLICDIR or ROOTDIR). I thought about step 3 in manual installations, where Apache rewrite base is to be changed? I am not familiar with this concept, as I am used to lighty (lighttpd)... I did that change, but it got me to the same error ("http://127.0.0.1/?install_step=2&update_config_file_refresh=true") I can purge database and do a fresh install with more details per each step, if required.


Reply By: DaVaR
5 months ago #1

DaVaR
Offline
Administrator
Total Posts: 141
Joined: July 14, 2015
Posted: May 05, 2019 @ 07:43 AM
Looks like you have UAP installed in "/srv/www/htdocs/marriage/uap" You want to make sure apache is loading from the "/srv/www/htdocs/marriage/uap/public" From the sounds of things, it is not happy with being in a sub folder. It has been a long time since I have used a sub folder for UAP, but I know it is possible. Try the instructions on this post and let me know if that helps... https://www.userapplepie.com/Topic/45/

Signature UAP v4.3.0 is Here!!!

Please keep questions and comments in the forum.

Reply By: pebwindkraft
5 months ago #2

pebwindkraft
Offline
Member
Total Posts: 9
Joined: May 03, 2019
Posted: May 05, 2019 @ 04:21 PM
Quote
Looks like you have UAP installed in "/srv/www/htdocs/marriage/uap"
correct :-) I read the instructions in Topic/45, and tried as per last reply without virtual server. I could get only one step further. Details: 1.) downloaded full install, installed in "/srv/www/htdocs/marriage/uap" 2.) changed /srv/www/htdocs/marriage/uap/public/.htaccess to have "RewriteBase /uap/" 3.) changed /etc/apache2/default-server.conf:
Code
Alias /uap "/srv/www/htdocs/marriage/uap/public"


        AllowOverride All
        Options FollowSymLinks
        Options +Indexes
        Require all granted

note I had to add the FollowSymLinks, otherwise Apache would complain about the rewrite base. 4. Changed "/srv/www/htdocs/marriage/uap/app/Example-Config.php"
Code
define('DIR', '/uap/');
define('SITEURL', 'http://localhost/uap/');
5. went in the browser to "http://localhost/uap/" This would bring me to the first step of the installation, all green, clicked on button "Move on to Step2" Changed the "WebSite Setting to "http://localhost/uap/" and adapted the database settings. Clicked on button "Update Config File". The image to update config file appears, and during this time I can see the browser line being "http://localhost/uap/?install_step=2&update_config_file_refresh=true" - which is correct. When the page reloads after some seconds, I get an error 403 (Access forbidden! You don't have permission to access the requested directory...), and the browser line shows "http://localhost/?install_step=2&update_config_file=true". It is missingthe "uap" part. Don't know whats going on here... So I thought I manually add the missing "uap" part, and then reloaded successfully the page, and clicked on the button "Move on to step 3". The browser line changes to "http://localhost/?install_step=3" - again missing the "uap" part. Same for step 4 and 5, one can add manually the uap, and then I end up in a HOME screen, but all the links are not working (due to wrong folders...) I stop here the manual setup, and if I can find some time will try the virtual host. I I get to spend some time this week on a non virtual host setup in a subfolder, I'll post the update here (only if I get it to work...).


Reply By: DaVaR
5 months ago #3

DaVaR
Offline
Administrator
Total Posts: 141
Joined: July 14, 2015
Posted: May 05, 2019 @ 04:40 PM
Did you update the Config.php file with the correct SITE_URL? http://localhost/uap/

Signature UAP v4.3.0 is Here!!!

Please keep questions and comments in the forum.

Reply By: pebwindkraft
5 months ago #4

pebwindkraft
Offline
Member
Total Posts: 9
Joined: May 03, 2019
Posted: May 06, 2019 @ 06:38 AM
Quote
Did you update the Config.php file with the correct SITE_URL?
I tried the full zip file, when I unzip it, it has no Config.php, only the Example-Config.php. This I changed though, to no avail. I further reviewed the code, and it becomes clear, that in line 80:
Code
echo "<meta http-equiv='refresh' content='5; url=/?install_step=2&update_config_file=true'>";
As one can see, the url is replaced with "/?install_step...", which replaces the previously defined path from the previous install dir in STEP2
Code
http://127.0.0.1/marriage/uap/public/?install_step=2
to
Code
http://127.0.0.1/?install_step=2&update_config_file=true
I tried to play around with the parameters in .htaccess, Example-Config.php, Step2.php, and had some funny, non-consistent (at least for me...) results. Anyhow, I coldn't get it to work. This is a too complex and time consuming for me. I will leave it as is, and go with the standard settings (without subdirs and eventually with virtual host). At the end I want to play around with user mgmt, and not the installer code :-) Meanwhile I played around with the virtual host, and tried two different settings, both without success. Puzzled ... I'll create a new / updated reply with all steps.


Reply By: DaVaR
5 months ago #5

DaVaR
Offline
Administrator
Total Posts: 141
Joined: July 14, 2015
Posted: May 06, 2019 @ 07:08 PM
You can bypass the install script by coping Example-Config.php and renaming it to Config.php. However, you will have to manually setup the database with the database.sql file that is in the root folder. I belive you can just import the file.

Signature UAP v4.3.0 is Here!!!

Please keep questions and comments in the forum.

Reply By: pebwindkraft
5 months ago #6

pebwindkraft
Offline
Member
Total Posts: 9
Joined: May 03, 2019
Posted: May 10, 2019 @ 11:36 AM
I could find a way to install on a VirtualBox machine, and also on my work laptop. The way I got success is similiar to "Install Without Composer" and "and All Files in Public Folder". Here is my write-up: fresh install of OpenSuSE Leap 15 in a virtual machine, with all updates. System Configuration: =====================
Code
Pattern Web and LAMP server, and these packages:
apache2-mod_php7
php7
php7-fileinfo
php7-mysql
and load the modules:
Code
sudo a2enmod php7
sudo a2enmod fileinfo
sudo a2enmod rewrite
Apache Configuration: ===================== The file /etc/hosts should be prepared, I used this:
Code
127.0.0.1       localhost
127.0.0.1       oslhpeb840.my.domain oslhpeb840
/etc/apache2/default-server.conf
Code
ServerName "oslhpeb840.my.domain"
DocumentRoot "/srv/www/htdocs"

<Directory "/srv/www/htdocs">
        Options FollowSymLinks
        AllowOverride All
        ...
</Directory>
Check if Apache works for UAP: ############################## (shamelessly stolen from the interwebs) Create the following files in Apache's DocumentRoot: File info.php:
Code
<?php
    phpinfo();
?>
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>
File .htaccess:
Code
RewriteEngine on 
RewriteRule ^/?test.html$ test.php [L]
Code
chown wwwrun:www *
chmod 664 *
1.) Check if PHP ('a2enmod php7') is working in Apache: 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 redirect ('a2enmod rewrite') is working
Code
apache2ctl -t -D DUMP_MODULES 2>&1 |grep rewrite
It should display a line like this:
Code
rewrite_module (shared)
If it is not, then you might have to run 'a2enmod rewrite' Direct your browser to /srv/www/htdocs/test.html (Apache's DocumentRoot), 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. Check in the config file, if "AllowOverride All" is set for the DocumentRoot. MariaDB Configuration ===================== After the default installation from the LAMP stack, follow the instructions to provide a password to "mariadb root user". Create this simple script file, name it e.g. ~/uap_initdb.sh, chmod it to 755 and execute it. File ~/uap_initdb.sh:
Code
#! /bin/bash

newUser='uap_user'
newDbPassword='uap_password'
newDb='uap_databse'
host=localhost
#host='%'
 
commands="CREATE DATABASE \`${newDb}\`;CREATE USER '${newUser}'@'${host}' IDENTIFIED BY '${newDbPassword}';GRANT USAGE ON *.* TO '${newUser}'@'${host}' IDENTIFIED BY '${newDbPassword}';GRANT ALL privileges ON \`${newDb}\`.*
TO '${newUser}'@'${host}';FLUSH PRIVILEGES;"

echo "setup initial user and database:"
echo "user:     ${newUser}"
echo "user pw:  ${newDbPassword}"
echo "database: ${newDb}"
echo "Enter mariadb root password to continue:"
echo "${commands}" | /usr/bin/mysql -u root -p
UAP files: ========== UserApplePie-v4-4.2.1-Full.zip, no composer, installer files in DocumentRoot:
Code
cd /srv/www/htdocs
rm index.html
unzip /tmp/UserApplePie-v4-4.2.1-Full.zip
mv UserApplePie-v4-4.2.1-Full/* .
rm -r UserApplePie-v4-4.2.1-Full
correct ownership and access rights (as root)
Code
chown -R wwwrun:www *
chown -R wwwrun:www .*
sh -c "find . -type f -exec chmod 664 {} \;" 
sh -c "find . -type d -exec chmod 775 {} \;"
move installer files to DocumentRoot:
Code
mv ./public/.htaccess .
mv ./public/index.php .
edit the lines 11-14 to be:
Code
define('APPDIR', realpath(__DIR__.'/app/').'/');
define('SYSTEMDIR', realpath(__DIR__.'/system/').'/');
define('PUBLICDIR', realpath(__DIR__).'/');
define('ROOTDIR', realpath(__DIR__.'/').'/');
point browser to /srv/www/htdocs, and feel good :-)


Reply By: DaVaR
5 months ago #7

DaVaR
Offline
Administrator
Total Posts: 141
Joined: July 14, 2015
Posted: May 10, 2019 @ 05:53 PM
Nice work! Thank you for taking the time to share with everyone.

Signature UAP v4.3.0 is Here!!!

Please keep questions and comments in the forum.

Forum Permissions
You cannot post in this forum.
You cannot moderate this forum.
You cannot administrate this forum.
Search Forums
Forum Recent Posts