Symfony 3.4 creates "prod?" cache directory - symfony

I'm currently using Symfony 3.4.8 with up to date dependencies.
In production, symfony creates "prod?" directory :
drwxrwxrwx 4 www-data www-data  434 Apr 20 10:26 .
drwxr-xr-x 4 www-data www-data   45 Apr 20 10:21 ..
-rw-rw-rw- 1 www-data www-data  165 Apr 20 10:26 annotations.map
drwxrwxrwx 2 www-data www-data  15K Apr 20 10:26 ContainerDcnvgsr
-rw-rw-rw- 1 www-data www-data 106K Apr 20 10:26 srcProd?DebugProjectContainerCompiler.log
-rw-rw-rw- 1 www-data www-data  628 Apr 20 10:26 srcProd?DebugProjectContainerDeprecations.log
-rw-rw-rw- 1 www-data www-data  784 Apr 20 10:26 srcProd?DebugProjectContainer.php
-rw-rw-rw- 1 www-data www-data  21K Apr 20 10:26 srcProd?DebugProjectContainer.php.meta
-rw-rw-rw- 1 www-data www-data 347K Apr 20 10:21 srcProd?DebugProjectContainer.xml
-rw-rw-rw- 1 www-data www-data  21K Apr 20 10:21 srcProd?DebugProjectContainer.xml.meta
drwxrwxrwx 2 www-data www-data    0 Apr 20 10:21 vich_uploader
var/cache directory :
drwxr-xr-x 4 www-data www-data  45 Apr 20 10:21 .
drwxr-xr-x 4 www-data www-data  44 Apr 19 11:38 ..
drwxr-xr-x 9 www-data www-data 556 Apr 19 11:42 prod
drwxrwxrwx 4 www-data www-data 434 Apr 20 10:26 prod?
public directory :
drwxr-xr-x 3 www-data www-data  104 Apr 19 11:39 build
drwxr-xr-x 2 www-data www-data   27 Apr 19 11:38 bundles
drwxrwxrwx 2 www-data www-data   98 Apr 19 09:27 imports
-rw-rw-rw- 1 www-data www-data 1242 Apr 19 09:27 index.php
Most of users have the following error :
(1/1) FatalThrowableError
Parse error: syntax error, unexpected
'DebugProjectContainer' (T_STRING), expecting ',' or ')'
The app works for few users with the correct "prod" cache directory and no error.
How can I fix this ?

There was a special character (^M) at the end of each line in the .env file due to a bad copy/paste.
¯\_(ツ)_/¯

Related

How do I specify permissions for sbt artefacts

How does one specify the permissions for files output by sbt? I need these to be set correctly in order to be able to test the code with my local Apache server.
In the scalaJS project after a clean fastOptJS I
can see that the launcherapp-fastopt.js files are user read only.
$ ls -al target/scala-2.13/
total 240
drwxr-xr-x 6 hjs staff 192 23 Oct 11:08 .
drwxr-xr-x 5 hjs staff 160 23 Oct 11:08 ..
drwxr-xr-x 6 hjs staff 192 23 Oct 11:08 classes
-rw------- 1 hjs staff 69861 23 Oct 11:08 launcherapp-fastopt.js
-rw------- 1 hjs staff 48380 23 Oct 11:08 launcherapp-fastopt.js.map
drwxr-xr-x 3 hjs staff 96 23 Oct 11:08 update
Apache won't see it with those permissions so I have to change the mode on the files like this:
$ chmod -R a+rX target/
$ ls -al target/scala-2.13/
total 240
drwxr-xr-x 6 hjs staff 192 23 Oct 11:08 .
drwxr-xr-x 5 hjs staff 160 23 Oct 11:08 ..
drwxr-xr-x 6 hjs staff 192 23 Oct 11:08 classes
-rw-r--r-- 1 hjs staff 69861 23 Oct 11:08 launcherapp-fastopt.js
-rw-r--r-- 1 hjs staff 48380 23 Oct 11:08 launcherapp-fastopt.js.map
drwxr-xr-x 3 hjs staff 96 23 Oct 11:08 update
Is there a way to specify the rights in sbt for the produced artefacts so I don't have to chmod everytime I compile?
For a use case see the Launcher App

WP-CLI file permission problems using Docker volumes

wordpress:cli container is not able to manipulate files on a volume shared with wordpress container.
Here's the docker-compose.yml file I use to bootstrap WordPress:
version: "3"
services:
wordpress:
image: wordpress
ports: ["80:80"]
volumes: ["wp_test:/var/www/html"]
environment:
WORDPRESS_DB_NAME: wordpress
WORDPRESS_DB_USER: root
WORDPRESS_DB_PASSWORD: secret
mysql:
image: mysql
environment:
MYSQL_ROOT_PASSWORD: secret
cli:
image: wordpress:cli
volumes: ["wp_test:/var/www/html"]
command: sh -c "sleep 20 && wp core install --path=/var/www/html --url=localhost --title=test --admin_user=test --admin_password=test --admin_email=test#example.com"
volumes:
wp_test:
I start it with docker-compose up and when wp-cli sets up the installation, there is a warning:
cli_1 | Warning: Unable to create directory wp-content/uploads/2018/02. Is its parent directory writable by the server?
The installation works so far, but I'd like to fix this warning, because for other wp-cli tasks manipulating files is critical.
From inside wordpress container, privileges look like this:
drwxr-xr-x 5 www-data www-data 4096 Feb 2 11:21 .
drwxr-xr-x 4 root root 4096 Jan 4 01:30 ..
-rw-r--r-- 1 www-data www-data 234 Feb 2 11:21 .htaccess
-rw-r--r-- 1 www-data www-data 418 Sep 25 2013 index.php
-rw-r--r-- 1 www-data www-data 19935 Jan 6 19:32 license.txt
-rw-r--r-- 1 www-data www-data 7413 Dec 12 2016 readme.html
-rw-r--r-- 1 www-data www-data 5434 Sep 23 12:21 wp-activate.php
drwxr-xr-x 9 www-data www-data 4096 Jan 16 21:39 wp-admin
-rw-r--r-- 1 www-data www-data 364 Dec 19 2015 wp-blog-header.php
-rw-r--r-- 1 www-data www-data 1627 Aug 29 2016 wp-comments-post.php
-rw-r--r-- 1 www-data www-data 2764 Feb 2 11:21 wp-config-sample.php
-rw-r--r-- 1 www-data www-data 3144 Feb 2 11:21 wp-config.php
drwxr-xr-x 4 www-data www-data 4096 Feb 2 11:22 wp-content
-rw-r--r-- 1 www-data www-data 3669 Aug 20 04:37 wp-cron.php
drwxr-xr-x 18 www-data www-data 12288 Jan 16 21:39 wp-includes
-rw-r--r-- 1 www-data www-data 2422 Nov 21 2016 wp-links-opml.php
-rw-r--r-- 1 www-data www-data 3306 Aug 22 11:52 wp-load.php
-rw-r--r-- 1 www-data www-data 36583 Oct 13 02:10 wp-login.php
-rw-r--r-- 1 www-data www-data 8048 Jan 11 2017 wp-mail.php
-rw-r--r-- 1 www-data www-data 16246 Oct 4 00:20 wp-settings.php
-rw-r--r-- 1 www-data www-data 30071 Oct 18 17:36 wp-signup.php
-rw-r--r-- 1 www-data www-data 4620 Oct 23 22:12 wp-trackback.php
-rw-r--r-- 1 www-data www-data 3065 Aug 31 2016 xmlrpc.php
but from within cli container the same volume looks like this:
drwxr-xr-x 5 www-data www-data 4096 Feb 2 11:21 .
drwxr-xr-x 3 root root 4096 Jan 10 07:36 ..
-rw-r--r-- 1 xfs xfs 234 Feb 2 11:21 .htaccess
-rw-r--r-- 1 xfs xfs 418 Sep 25 2013 index.php
-rw-r--r-- 1 xfs xfs 19935 Jan 6 19:32 license.txt
-rw-r--r-- 1 xfs xfs 7413 Dec 12 2016 readme.html
-rw-r--r-- 1 xfs xfs 5434 Sep 23 12:21 wp-activate.php
drwxr-xr-x 9 xfs xfs 4096 Jan 16 21:39 wp-admin
-rw-r--r-- 1 xfs xfs 364 Dec 19 2015 wp-blog-header.php
-rw-r--r-- 1 xfs xfs 1627 Aug 29 2016 wp-comments-post.php
-rw-r--r-- 1 xfs xfs 2764 Feb 2 11:21 wp-config-sample.php
-rw-r--r-- 1 xfs xfs 3144 Feb 2 11:21 wp-config.php
drwxr-xr-x 4 xfs xfs 4096 Feb 2 11:22 wp-content
-rw-r--r-- 1 xfs xfs 3669 Aug 20 04:37 wp-cron.php
drwxr-xr-x 18 xfs xfs 12288 Jan 16 21:39 wp-includes
-rw-r--r-- 1 xfs xfs 2422 Nov 21 2016 wp-links-opml.php
-rw-r--r-- 1 xfs xfs 3306 Aug 22 11:52 wp-load.php
-rw-r--r-- 1 xfs xfs 36583 Oct 13 02:10 wp-login.php
-rw-r--r-- 1 xfs xfs 8048 Jan 11 2017 wp-mail.php
-rw-r--r-- 1 xfs xfs 16246 Oct 4 00:20 wp-settings.php
-rw-r--r-- 1 xfs xfs 30071 Oct 18 17:36 wp-signup.php
-rw-r--r-- 1 xfs xfs 4620 Oct 23 22:12 wp-trackback.php
-rw-r--r-- 1 xfs xfs 3065 Aug 31 2016 xmlrpc.php
While user in cli container is www-data (just like it is in wordpress container), it cannot create the desired folder:
$ mkdir -p wp-content/uploads/2018/02
mkdir: can't create directory 'wp-content/uploads/': Permission denied
I'm running docker compose 1.18.0 and and docker engine 17.12.0-ce on a mac.
I also created a github issue.
I assume your question is "How do I fix WP-CLI file permission problems using Docker volumes?"
You need to make sure to run wp-cli as the same UID in both containers.
From the command line:
docker run -it --rm \
--volumes-from $container \
--network container:$container \
--user 33:33 \
wordpress:cli core install --path=/var/www/html --url=localhost --title=test --admin_user=test --admin_password=test --admin_email=test#example.com
--user 33:33 is a workaround to run wp-cli with the same UID/GID as www-data in the WordPress container. Problems arise because the containers have different UID/GID for www-data. See https://github.com/docker-library/wordpress/issues/256
You should be able to add user: "33:33" to your docker-compose file as well. See https://github.com/docker/compose/issues/1532

Installing Wordpress Plugin from uploaded file require FTP logging

I'm trying to install the wordpress plugging but just can't bypass this FTP credential page.
I have tried:
1, add FS_METHOD: 'direct' to wp-config.php
2, change permission on the file folder, see blow,
Still just can't have it working, please help
:/var/www/html/wordpressblog# ls -la
total 196
drwxr-xr-x 5 nobody nogroup 4096 Jan 15 08:43 .
drwxr-xr-x 3 nobody nogroup 4096 Jan 15 07:36 ..
-rw-r--r-- 1 nobody nogroup 418 Sep 25 2013 index.php
-rw-r--r-- 1 nobody nogroup 19935 Jan 3 2017 license.txt
-rw-r--r-- 1 nobody nogroup 7413 Dec 12 2016 readme.html
-rw-r--r-- 1 nobody nogroup 5434 Sep 23 20:21 wp-activate.php
drwxr-xr-x 9 nobody nogroup 4096 Nov 30 03:06 wp-admin
-rw-r--r-- 1 nobody nogroup 364 Dec 19 2015 wp-blog-header.php
-rw-r--r-- 1 nobody nogroup 1627 Aug 29 2016 wp-comments-post.php
-rw-r--r-- 1 nobody nogroup 2901 Jan 15 08:43 wp-config.php
drwxrwxrwx 4 nobody nogroup 4096 Nov 30 03:06 wp-content
-rw-r--r-- 1 nobody nogroup 3669 Aug 20 12:37 wp-cron.php
drwxr-xr-x 18 nobody nogroup 12288 Nov 30 03:06 wp-includes
-rw-r--r-- 1 nobody nogroup 2422 Nov 21 2016 wp-links-opml.php
-rw-r--r-- 1 nobody nogroup 3306 Aug 22 19:52 wp-load.php
-rw-r--r-- 1 nobody nogroup 36583 Oct 13 10:10 wp-login.php
-rw-r--r-- 1 nobody nogroup 8048 Jan 11 2017 wp-mail.php
-rw-r--r-- 1 nobody nogroup 16246 Oct 4 08:20 wp-settings.php
-rw-r--r-- 1 nobody nogroup 30071 Oct 19 01:36 wp-signup.php
-rw-r--r-- 1 nobody nogroup 4620 Oct 24 06:12 wp-trackback.php
-rw-r--r-- 1 nobody nogroup 3065 Sep 1 2016 xmlrpc.php
/var/www# ls -la
drwxr-xr-x 3 root root 4096 Jan 10 10:28 .
drwxr-xr-x 12 root root 4096 Jan 10 10:28 ..
drwxr-xr-x 3 nobody nogroup 4096 Jan 15 07:36 html
The wp-content directory needs to be owned by the same user and group than the webserver. You might need to change these settings, e.g. in the httpd.conf if you are using apache
I encountered this before when I setup my own web server using nginx. The whole /var/www/html folder and all descendants need to be owned by the same user running nginx worker to enable install plugin without ftp inside wordpress dashboard for my case. Hope it helps!

Generate new symfony project: permissions for directories created

I have just generated a new Symfony 3 project, and I have realized that directories has 755 permissions. For examppe, in project root directory:
drwxr-xr-x 3 me me 4096 oct 3 21:14 web
drwxr-xr-x 15 me me 4096 oct 10 12:08 vendor
drwxr-xr-x 5 me me 4096 oct 10 12:08 var
drwxr-xr-x 3 me me 4096 oct 10 12:08 tests
drwxr-xr-x 3 me me 4096 oct 10 12:08 src
drwxr-xr-x 2 me me 4096 oct 10 12:08 bin
drwxr-xr-x 4 me me 4096 oct 10 12:08 app
In case my current umask is 0002 so when I create a new directory (mkdir) at /tmp for example, the permissions are 775.
So why the Symfony directories has 755? Why did they choose that? Is this configurable?
Im on Ubuntu 14.04.

Wordpress - unable plugin update ftp login

I have a wordpress blog on a server, the admin portal is also on the same server.
The auto update of plugins from the admin portal is not working.
I get an error saying that I am not authorize to login.
Error message - Error: There was an error connecting to the server, Please verify the settings are correct.
I know the login details are correct.
Could the problem be that the server is trying to connect to itself ?
I have looked at the other articles about this problem, I havent got SELinex installed and the permissions seem to be correct.
Directories
-rw-r--r-- 1 root root 200 May 23 2010 .htaccess
-rw-r--r-- 1 www-data www-data 1406 May 16 2010 favicon.ico
-rw-r--r-- 1 www-data www-data 397 May 25 2008 index.php
-rw-r--r-- 1 www-data www-data 15410 Dec 6 2008 license.txt
drwxr-xr-x 6 www-data www-data 4096 Jul 28 2010 mint
-rw-r--r-- 1 www-data www-data 9122 Jul 22 2010 readme.html
-rw-r--r-- 1 www-data www-data 4391 Apr 19 2010 wp-activate.php
drwxr-xr-x 7 www-data www-data 4096 Sep 3 12:33 wp-admin
-rw-r--r-- 1 www-data www-data 40284 Jul 25 2010 wp-app.php
-rw-r--r-- 1 www-data www-data 220 Oct 14 2008 wp-atom.php
-rw-r--r-- 1 www-data www-data 274 May 25 2008 wp-blog-header.php
-rw-r--r-- 1 www-data www-data 3926 May 6 2010 wp-comments-post.php
-rw-r--r-- 1 www-data www-data 238 Oct 14 2008 wp-commentsrss2.php
-rw-r--r-- 1 www-data www-data 3173 May 25 2010 wp-config-sample.php
-rw-r--r-- 1 www-data www-data 3208 Sep 5 14:49 wp-config.php
drwxrw-rw- 19 www-data www-data 4096 Feb 8 21:59 wp-content
-rw-r--r-- 1 www-data www-data 1255 Mar 17 2010 wp-cron.php
-rw-r--r-- 1 www-data www-data 240 Apr 19 2010 wp-feed.php
drwxr-xr-x 7 www-data www-data 4096 Sep 3 12:41 wp-includes
-rw-r--r-- 1 www-data www-data 2002 Mar 18 2010 wp-links-opml.php
-rw-r--r-- 1 www-data www-data 2441 Feb 28 2010 wp-load.php
-rw-r--r-- 1 www-data www-data 26059 Jun 1 2010 wp-login.php
-rw-r--r-- 1 www-data www-data 7774 May 26 2010 wp-mail.php
-rw-r--r-- 1 www-data www-data 487 Apr 20 2009 wp-pass.php
-rw-r--r-- 1 www-data www-data 218 Oct 14 2008 wp-rdf.php
-rw-r--r-- 1 www-data www-data 316 May 25 2008 wp-register.php
-rw-r--r-- 1 www-data www-data 218 Oct 14 2008 wp-rss.php
-rw-r--r-- 1 www-data www-data 220 Oct 14 2008 wp-rss2.php
-rw-r--r-- 1 www-data www-data 9177 May 2 2010 wp-settings.php
-rw-r--r-- 1 www-data www-data 18695 Jul 21 2010 wp-signup.php
-rw-r--r-- 1 www-data www-data 3702 Feb 24 2010 wp-trackback.php
-rw-r--r-- 1 www-data www-data 94184 Jul 14 2010 xmlrpc.php
Thanks, Alex
Try to give www-data permission in wordpress directory:
cd /yourwordpressdirectory/
sudo chown -R www-data:www-data *

Resources