XAMPP migration issue from WIndows to Linux

Problems with the Linux version of XAMPP, questions, comments, and anything related.

XAMPP migration issue from WIndows to Linux

Postby nc3man » 26. December 2016 22:42

I have a live server (linux) website Wordpress setup that I wanted to test locally, so I first set up on WIndows to share with a Windows-only colleague. It worked just fine using xampp 5.6.28 on Windows 10. Note that I used httpd-vhosts.conf to locate all files in an area separate from xampp/htdocs. I simply copied my live site to windows, exported databases, installed xampp, configured ports, edited httpd-vhosts.conf to point to the wordpress copy , edited /etc/hosts to recognize the subdomain at 127.0.0.1, reimported databases using xampp/phyAdmin, edited a couple of my Wordpress configuration files, and it works perfectly.

I then wanted to see if I had some windows-specific misbehavior by doing the "same" xampp 5.6.28-1 setup on my linux laptop (Ubuntu 16.04 LTS) where I'm much more comfortable. I followed the SAME steps, with 2 slight additions.
(1) I had to uncomment the inclusion of httpd-vhosts.conf in httpd.conf to set my new subdomain. I have done NO other customization to the default xampp installation.
(2) Because we have to be careful with permissions, I needed to carefully set permission. I used the same script that I use on my linux site, where everything is working just fine. Details of fix-wordpress-permission.sh are at https://gist.github.com/Adirael/3383404.

When I go to http://sdbikecoalition.localhost (my subdomain) in chrome, I get
Code: Select all
[b]Warning[/b]: require_once(/opt/vhost/sdbikecoalition/wp-config.php): failed to open stream: Permission denied in /opt/vhost/sdbikecoalition/wp-load.php on line 37
[b]Fatal error[/b]: require_once(): Failed opening required '/opt/vhost/sdbikecoalition/wp-config.php' (include_path='.:/opt/lampp/lib/php') in /opt/vhost/sdbikecoalition/wp-load.php on line 37


Note that changing permissions on that file have no effect on the issue. In fact, if the permissions on wp-config.php are too wild (like 775 or 777) it just throws me to http://localhost/dashboard, the XAMPP welcome page. So, I figure it's an owner:group issue. I first encountered it for me:mygroup. I then changed it to www-data:www-data as in the origifinal fix-wordpress-permissions.sh (and also added MYSELF to the www-data group). That didn't work. I then set it to daemon:daemon which is the user:group set in my httpd.conf. I even tried root:root

I then searched this forum and found a situation that I thought "might" be similar to mine, solved and locked Dec 2011
https://community.apachefriends.org/f/viewtopic.php?f=17&t=49184&p=189640&hilit=wordpress+permission#p189640
I tried usr:pwd = root:nobody as recommended there and still get the same fatal error.

I haven't done anything exotic and I'm quite familiar with dealing with ownership, groups and permission on linux, so I'm not sure what is going on.

Any help would be welcome :)

For reference, these are my lines in httpd-vhosts.conf
Code: Select all
# This is where we place all the files, as subdirectories for local websites
<Directory /opt/vhost>
    AllowOverride All
    Require all granted
</Directory>

#this is the default address of XAMPP   
<VirtualHost *:80>
   DocumentRoot "/opt/lampp/htdocs"
   ServerName localhost
</VirtualHost>

# test site for sdbikecoalition.org
<VirtualHost *:80>
    DocumentRoot "/opt/vhost/sdbikecoalition"
    ServerName sdbikecoalition.localhost
</VirtualHost>
Last edited by nc3man on 26. December 2016 23:54, edited 4 times in total.
nc3man
 
Posts: 6
Joined: 26. December 2016 21:34
XAMPP version: 5.6.28-1
Operating System: linux (Ubuntu 16.04 LTS)

Re: XAMPP migration issue from WIndows to Linux

Postby nc3man » 26. December 2016 23:06

Let me add one other note. The exact same error message is encountered in this post:
https://www.digitalocean.com/community/questions/server-error
There, the problem was solved by changing user:group to www-data:www-data, which I have already tried.
nc3man
 
Posts: 6
Joined: 26. December 2016 21:34
XAMPP version: 5.6.28-1
Operating System: linux (Ubuntu 16.04 LTS)

Re: XAMPP migration issue from WIndows to Linux

Postby JJ_Tagy » 27. December 2016 02:52

I find this odd:

(include_path='.:/opt/lampp/lib/php')
JJ_Tagy
 
Posts: 722
Joined: 30. January 2012 13:44
Operating System: Windows 10 Pro x64

Re: XAMPP migration issue from WIndows to Linux

Postby nc3man » 27. December 2016 09:46

That doesn't seem odd to me. A path list in unix is a list of directories separated by a semicolon(:). In this case, it says to first search in the current directory(.) and then to search in /opt/lampp/lib/php.
nc3man
 
Posts: 6
Joined: 26. December 2016 21:34
XAMPP version: 5.6.28-1
Operating System: linux (Ubuntu 16.04 LTS)

Re: XAMPP migration issue from WIndows to Linux

Postby Nobbie » 27. December 2016 12:11

nc3man wrote: and I'm quite familiar with dealing with ownership, groups and permission on linux, so I'm not sure what is going on.


Honestly, it is a plain rights/permissions issue anyway. For me it looks as if you "randomly" try to apply this or that ownership without having a clear overview, how rights management works. I think that you overlooked the fact, that not only files have to have certain rights, but as well the folder, which contains the file and (and this is overlooked by quite a lot of people) also ALL folders ABOVE your current folder. That means, as Apache currently is executed by daemon:daemon, not only the mentioned file has to grant read access for User/Group daemon, but also

/opt/vhost/sdbikecoalition
/opt/vhost
/opt

(all the three folders above!). It does not help to grant 777 to a single file, if one the folders above shows up 700 for example. You have to analyze clearly and exactly, which files and folders do have which rights, change them as needed, maybe you can change the Apache User/Group as well (i did so, as daemon:daemon is only general work around, but not very usefull when a user wants to put his own files to htdocs etc.) and grant all necessary rights carefully. Dont simply try this and that - that is randomly and chaotic.

nc3man wrote:A path list in unix is a list of directories separated by a semicolon(:).


A "semicolon" is like ";", the separator is a "colon" and not a semicolon.
Nobbie
 
Posts: 9556
Joined: 09. March 2008 13:04

Re: XAMPP migration issue from WIndows to Linux

Postby nc3man » 28. December 2016 04:45

Thanks for your reply. The issue is now resolved.

Yes I do understand permissions. Basically 755 on all Wordpress folders, 664 on all files and 660 on wp-config.php and any other files that may expose passwords or compromise security. If you'd taken the time to follow the link to fix-wordpress-permissions.sh, you would know that is NOT the issue. Also user:group works well as daemon:daemon and I prefer not to use my personal account for security - I did change passwd for daemon and also added myself to the daemon group for working in that area. Also, the immediate parent folder vhost is also set at daemon:daemon, but you WANT /opt as root:root. That is where most folks, including me, install all my other local applications. You never want ALL folders above to be daemon:daemon (or whatever the owner:group is in httpd.conf, or else root(/) would need to be daemon:daemon ;) Even /opt/lampp is root:root as set by the xampp linux installer. And if you want all your different websites' source to sit somewhere else, I find it also helps to have this in your httpd-vhosts.conf:
Code: Select all
<Directory /opt/vhost>
    AllowOverride All
    Require all granted
</Directory>


I would suggest that rather than spending time telling people that they need to understand unix better, it might be simpler to patiently provide guidelines for correct permissions on issues like this. Or just provide a reference. Although, that still wasn't the issue in my case.

The problem is completely solved and it was an issue with wp-config.php, which had gone through several upgrades on our server. I grabbed a brand new, clean wp-config.php for Wordpress 4.7, edited it from scratch, and this worked. Why the permissions error was thrown is a mystery as that file always was 660 with same owner:group as everything else, but not to worry at this point. I didn't change permissions or ownership at all, only the physical file. Somehow, windows was more forgiving.

[and thanks for correcting my typing semicolon instead of colon - at least the colon(:) wasn't fat-fingered ;)... I was just trying to help JJ_Tagy understand path lists and hope he wasn't confused by my sloppiness.]
nc3man
 
Posts: 6
Joined: 26. December 2016 21:34
XAMPP version: 5.6.28-1
Operating System: linux (Ubuntu 16.04 LTS)

Re: XAMPP migration issue from WIndows to Linux

Postby Nobbie » 28. December 2016 09:59

nc3man wrote:Yes I do understand permissions. Basically 755 on all Wordpress folders, 664 on all files and 660 on wp-config.php and any other files that may expose passwords or compromise security. If you'd taken the time to follow the link to fix-wordpress-permissions.sh, you would know that is NOT the issue.


You are still far from understanding. It is NOT only a question of binary patterns as you still think, it is as well (and most important) a question of ownership. And (what you still ignores) ownership and patterns have to match ALL folders above as well, not only files and not only the wordpress folder.

nc3man wrote:[and thanks for correcting my typing semicolon instead of colon -


Also still wrong . you did it quite vice verse, you typed(!) a colon (what is right on linux), but you CALLED it semicolon. Nothing fat fingered nonsense.

And If you dont like my answers, simply dont read them.
Nobbie
 
Posts: 9556
Joined: 09. March 2008 13:04

Re: XAMPP migration issue from WIndows to Linux

Postby nc3man » 28. December 2016 17:43

First thing I do when using a new forum is to read the rules, Nobbie. Last one for this forum is "Be Polite and Patient." Yes, I've read some of your other "advice" in response to others on this Forum and, yes, I will not read your answers from now on. Since you troll here with 8,857 posts you might try re-reading the rules here and help the people who may be using xampp for the first time and who also may require a little linux hand-holding. I'll ignore your slander and rely on my 30+ years unix experience. My problem is solved and I'll unsubscribe to this forum altogether.
nc3man
 
Posts: 6
Joined: 26. December 2016 21:34
XAMPP version: 5.6.28-1
Operating System: linux (Ubuntu 16.04 LTS)

Re: XAMPP migration issue from WIndows to Linux

Postby Nobbie » 28. December 2016 18:58

nc3man wrote:First thing I do when using a new forum is to read the rules,


Obviously you overlooked the part that you are totally wrong here, Your Wordpress issue is NOT a Xampp issue.

nc3man wrote:I'll ignore your slander and rely on my 30+ years unix experience. My problem is solved and I'll unsubscribe to this forum altogether.


You are simply a stupid idiot, if your unix "experience" is really only 10 years less than mines (i am working on unix since 1976), it is really astonishing how poor your knowledge actually is. Youre question is a pure beginners question in any means. I would not be proud of this "outcome" of 30 years "experience".

And now you may leave, i do not answer to troll and idiots. *plonk*
Nobbie
 
Posts: 9556
Joined: 09. March 2008 13:04


Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 3 guests