Running XAMPP on Mac with other user not working - wordpress

I'm currently having a problem with XAMPP and WordPress on my Mac. I've downloaded the latest XAMPP version and installed it on my Mac.
After moving WordPress into the htdocs folder, I've got an error in the Dashboard because of missing write permissions.
After searching for some minutes, I've tried to give everyone access to the htdocs folder via the Finder. But that don't helped. So I've tried this here:
https://www.zigpress.com/2018/03/19/resolving-permissions-issues-in-xampp-on-mac-high-sierra/
So I've entered my local Mac user name (johnnymarten, found out via whoami) and the group staff. The problem is, that the Apache Server don't starts anymore now and I'm getting this error message here:
INFO: Starting "apache"
ERROR: Failed to start "apache": cannot start
service: AH00543: httpd: bad user name johnnymarten
I'm coming from Windows and I don't get this done. I'm at lease done with this. Do you have any idea what I can do?

Xampp runs as root. Reset file permissions to get it to start.
1) reset directory: sudo chown -R root:admin /Applications/XAMPP
2) on my Xampp 2 directories are different:
sudo chown -R daemon:daemon /Applications/XAMPP/xamppfiles/logs
sudo chown -R daemon:daemon /Applications/XAMPP/xamppfiles/temp
3) Make a new directory for WordPress and let everyone use it.
mkdir new_dir
chmod 777 new_dir
4) Add directory to httpd.conf
<Directory "/new_dir">
Options ExecCGI FollowSymLinks
AllowOverride All
Require all granted
RewriteEngine On
RewriteBase /
</Directory>
Load WP in /new_dir
Restart Apache.

Related

Does bitnami wordpress stack allow multiple wordpress installs

I am currently using the bitnami wordpress stack, I have a website I'm working on but I also want to start another but I don't want to use multisite because I don't want them to share a database.
so is it possible to install another WordPress on bitnami? if yes how do i go about it?
Bitnami Engineer here,
You can deploy another application on top of a running Bitnami instance by following these steps. They assume that your application will live in the /opt/bitnami/apps/myapp/ directory:
Run the following commands to create the directories and assign the necessary permissions:
sudo mkdir /opt/bitnami/apps/myapp
sudo mkdir /opt/bitnami/apps/myapp/htdocs/
sudo mkdir /opt/bitnami/apps/myapp/conf
sudo chown -R bitnami:daemon /opt/bitnami/apps/myapp/htdocs/
sudo chmod -R g+w /opt/bitnami/apps/myapp/htdocs/
Create and edit the /opt/bitnami/apps/myapp/conf/httpd-prefix.conf file and add the line below to it:
Alias /myapp/ "/opt/bitnami/apps/myapp/htdocs/"
Alias /myapp "/opt/bitnami/apps/myapp/htdocs/"
Include "/opt/bitnami/apps/myapp/conf/httpd-app.conf"
Create and edit the /opt/bitnami/apps/myapp/conf/httpd-app.conf file and add the content below to it. This is the main configuration file for your application, so modify it further depending on your application’s requirements.
<Directory /opt/bitnami/apps/myapp/htdocs/>
Options +FollowSymLinks
AllowOverride None
<IfVersion < 2.3 >
Order allow,deny
Allow from all
</IfVersion>
<IfVersion >= 2.3>
Require all granted
</IfVersion>
</Directory>
NOTE: If your application uses .htaccess files, you should change the AllowOverride None option to AllowOverride All. Find out how to move the .htaccess file content to the main server configuration file.
Once you have created the files and directories above, add the following line to the end of the main Apache configuration file at /opt/bitnami/apache2/conf/bitnami/bitnami-apps-prefix.conf, as shown below:
Include "/opt/bitnami/apps/myapp/conf/httpd-prefix.conf"
Restart the Apache server:
sudo /opt/bitnami/ctlscript.sh restart apache
You should now be able to access the application at http://SERVER-IP/myapp.
Note: As WordPress requires a database, you will need to create a new database in the server
You can find more information about how to deploy a custom application in this guide of our documentation
https://docs.bitnami.com/general/apps/wordpress/administration/create-custom-application-php/
Thanks

How to give bitnami user edit permission on .htaccess for bitnami multisite ec2?

I have installed a Bitnami Multisite Wordpress AMI on my Amazon EC2 instance. to setup the Multiite Network I need to make changes in the .htaccess file.
I checked the permission on the file :
-rw-r--r-- 1 daemon daemon 235 Nov 29 12:15 .htaccess
I need the bitnami user to be able to edit the file. So first I did
getfacl .htaccess
# file: .htaccess
# owner: daemon
# group: daemon
user::rw-
group::r--
other::r--
I am logged in as bitnami user. So i used the command as below to give bitnami edit permissions.
sudo setfacl –m u:bitnami:rwx .htaccess
But I get the error as
Usage: setfacl [-bkndRLP] { -m|-M|-x|-X ... } file ...
Try `setfacl --help' for more information.
Need help to resolve the same.
Thanks
Bitnami Engineer here.
You can change the permissions of the .htaccess file by running this command
sudo chown bitnami:daemon .htaccess
sudo chmod g+w .htaccess
After running those commands, you can start to edit the file.
For security and performance reasons, we do not allow Apache to read the .htaccess files. For this reason, we moved the configuration in the .htaccess files to the main application configuration files and set the AllowOverride option to None by default.
You have two different options to start using .htaccess files:
- Edit the /opt/bitnami/apps/mediawiki/conf/htaccess.conf file and include the information of the .htaccess file inside a Directory block. You will find more information about this in this guide
https://docs.bitnami.com/aws/apps/wordpress-multisite/administration/use-htaccess/
Edit the /opt/bitnami/apps/wordpress/conf/httpd-app.conf file and change the AllowOverride option to All. After that, you will need to restart Apache
In both options, you will need to restart Apache after that:
sudo /opt/bitnami/ctlscript.sh restart apache

WordPress nginx can't create Directories - Permissions correct

I know there are bunch of posts all over the internet about the WordPress permissions, but I am facing an issue I can't explain from the other posts. I am running debops WordPress on Ubuntu 16.04 with nginx.
Basically my updates within WordPress are failing, I am getting the "Could not create directory error". So I checked the permissions, and they are all correct (755 for the directories, 644 for the files).
Furthermore I checked that nginx is actually running as www-data user, which it does:
ps aux|grep nginx|grep -v grep
Shows that nginx is running as www-data.
To verify the permissions, I tried:
sudo -u www-data mkdir test
which worked and created the test directory.
Then some other posts made me think it has to do with a FTP configuration, most of them point to the vsftpd.conf file, but I don't have vsftpd installed (though I am able to connect via sftp to the ubuntu machine).
Question: What other reasons might cause this issue? Technically, WordPress has all the permissions to create it's directories.
Ok I found the problem:
nginx was indeed running as www-data user, but that wasn't the issue. From the debops issues I found that the correct user who should own the WordPress directory is the 'wordpress' user, not www-data.
chown wordpress:wordpress /var/www/ -R
Now everything works well with the updates.

Drupal - The directory sites/default/files exists but is not writable and could not be made writable

When I try to add "Public file system path" and "Private file system path" in Administration > Configuration > Media > File System in my drupal site, I get "The directory sites/default/files exists but is not writable and could not be made writable" Error. But it is working fine in localhost.
The permission for the folders is 755, I changed it to 777. But still it didnt work.
I also changed the owner following some blogs using:
chown -R apache:apache private
But it didnt help either.
Please Help.
Thanks in advance.
Try to replace .htaccess in sites/default/files with the original one or
try to remove .htaccess in sites/default/files or
try to change .htaccess in sites/default/files from
Options None
Options +FollowSymLinks
to
#Options None
#Options +FollowSymLinks
You could try same with .htaccess in Drupal root
I am too late for this answer but may help someone who searches for it.
If SELinux security is enabled and there is not a "rw" in the context for the files/ directory it will not be writable no matter which group, user, or Unix permissions are granted.
To see these "hidden" settings:
ls -laZ sites/default
drwxr-sr-x. apache www unconfined_u:object_r:httpd_sys_content_t:s0 .
drwxr-xr-x. apache www unconfined_u:object_r:httpd_sys_content_t:s0 ..
-rwxr-sr-x. apache www unconfined_u:object_r:httpd_sys_content_t:s0 default.settings.php
drwxrwsr-x. apache www unconfined_u:object_r:httpd_sys_content_t:s0 files
-rwxr-sr-x. apache www unconfined_u:object_r:httpd_sys_rw_content_t:s0 settings.php
To change the settings on files/ so it is writable:
sudo chcon -R -t httpd_sys_rw_content_t files
When the install is done reset the context using the same command with the original "http_sys_content_t" context.
FYI - This command will also be necessary to enable writes when installing themes under the "all" directory.
Probably you need to run restorecon on the directory
for eg:
restorecon -rv default/
chmod -R 777 sites/default/files/
^ worked for me, however I had no private file system path.

Upload file wordpress

I am trying to upload a file in wordpress using the Media > Add New -- Option but when I click upload I get the following error:
Unable to create directory wp-content/uploads/2012/11. Is its parent
directory writable by the server?
I have Wordpress 4.3.1 installed.
Thank you
EDIT:
I am on a shared server with: host=i686-redhat-linux-gnu and Apache. I changed the permissions to 755 and 777 of wp-content/uploads but I get the following error:
“my_file.jpg” has failed to upload due to an error Unable to create
directory wp-content/uploads/2012/11. Is its parent directory writable
by the server?
Any ideas?
You need to set folder permissions for /uploads/ and possibly for /wp-content/ , too.
Typically, both folders should be 755. You may have to temporarily raise /uploads/ to 777 and upload an image (this will also force the server to change the folder permissions and user to the correct settings), but change it back to 755 right away.
It's easiest to set permissions with an FTP client. See Filezilla and FTP Clients « WordPress Codex.
And see Changing File Permissions « WordPress Codex for the correct Wordpress permission settings:
From the codex.wordpress: Typically, all files should be owned by your user (ftp) account on your web server, and should be writable by that account. On shared
hosts, files should never be owned by the webserver process itself
(sometimes this is www, or apache, or nobody user).
Any file that needs write access from WordPress should be owned or
group-owned by the user account used by the WordPress (which may be
different than the server account). For example, you may have a user
account that lets you FTP files back and forth to your server, but
your server itself may run using a separate user, in a separate
user group, such as dhapache or nobody. If WordPress is running as the
FTP account, that account needs to have write access, i.e., be the
owner of the files, or belong to a group that has write access. In the
latter case, that would mean permissions are set more permissively
than default (for example, 775 rather than 755 for folders, and 664
instead of 644).
ssh in and navigate to the wp-content folder and type in these 2 lines:
sudo chown -R www-data uploads/
sudo chmod -R 755 uploads/
or you can use the static and full path:
sudo chown -R www-data /var/www/wp-content/uploads/
sudo chmod -R 755 /var/www/wp-content/uploads/
Do not change it to permissions 777 because that is simply insecure
I had the same problems last week. After trying all proposed solutions with no success, it occurred to me that we had SElinux enabled on the server. In my case, and maybe for many other people, SElinux was responsible of the error message:
Unable to create directory wp-content/uploads/2013/04. Is its parent directory writable by the server?
My solution is based on the one proposed here: http://doc-ok.org/?tag=selinux which could be more suitable to other people's needs.
In my case, my wordpress directory resides in my home folder on the server, to which I have ssh access. Otherwise you will have to ask your administrator.
Anyway, this is my solution.
chgrp -R apache wordpress #change wordpress with your base directory for wp..
#alternatively, chown the whole directory to apache
chmod -R 774 wordpress/wp-content #if chown by apache, the permissions can be more restrictive
In my case not only the folder ownership / group ownership had to be changed to apache. Also the SElinux label of wp-content directory had to be changed to either httpd_sys_rw_content_t or httpd_sys_content_t:
chcon -Rv --type=httpd_sys_content_t wordpress/wp-content
This did the trick for me.
More information on SElinux can be found for example at:
wiki.centos.org/HowTos/SELinux
and
fedoraproject.org/wiki/SELinux
The /wp-content/uploads directory needs to be writeable by your webserver. Assuming that you are using Apache on Linux, and that it is running as user apache (change to your appropriate user) one quick fix for this would be to run the following command from your web root.
chown -R apache.apache wp-content/uploads
chmod -R 755 wp-content/uploads
I faced the same issue and I found a better solution:
go to cpanel > phpmyadmin
select database
open wp_options table
make sql query SELECT * FROM wp_options WHERE option_name LIKE '%upload_path%'
change the path
this should fix it.
sudo chown -R www-data:www-data wp-content/uploads
Do not change the permissions to 755 if it's not necessary.
If it still doesn't work try:
chmod -R 755 wp-content/uploads
this works for me, after many weeks headache
sudo chown -R apache uploads
sudo chmod -R 755 uploads
assuming you're in wp-content
for those who stumbled on selinux permission issue, here are the steps i made to fix them. We need to allow the following selinux boolean variables to allow installing of wordpress plugins from wordpress admin console using FTP. They are httpd_can_network_connect and ftpd_full_access. They can be activated by
setsebool ftpd_full_access on
setsebool httpd_can_network_connect on
also wp-content folder should be write permissible for the ftp user used for uploading.

Resources