Lock file could not be created TYPO3 - mod-rewrite

I have this error.
Lock file could not be created
So far I've done everything that was recommended: I removed all the files from typo3temp, I have given write permissions recursively, still does not work. Can anybody help?

Typo3 back-end show this error probably because log file gonna be more than 30 MB.
To solve this error do change in localconfiguration.php
for the typo3 version < 6
add this line : $ TYPO3_CONF_VARS ['SYS'] ['enableDeprecationLog'] = '0 ';
for typo3 version > 6
add this 'enableDeprecationLog' => '0',
in 'SYS' => array of localconfiguration.php
I hope this helps u !!!!

in my case i had no typo3temp folder, so i created one
/users/pub00/web/html # mkdir typo3temp
/users/pub00/web/html # chown vmamp:nobody typo3temp/
/users/pub00/web/html # chmod 775 typo3temp/

Related

Deploying Laravel to Elastic Beanstalk: "failed to open stream: Permission denied"

Sometimes when I deploy a Laravel project to AWS Elastic Beanstalk I'm faced with an annoying error saying that the log file cannot be opened:
The stream or file "/var/app/current/storage/logs/laravel-2020-10-21.log" could not be opened: failed to open stream: Permission denied
In my eb deploy.config file I have a statement which, in theory, should fix things, but doesn't:
files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/99_make_storage_writable.sh":
mode: "000755"
owner: root
group: root
content: |
#!/usr/bin/env bash
echo "Making /storage writeable..."
chmod -R 755 /var/app/current/storage
if [ ! -f /var/app/current/storage/logs/laravel.log ]; then
echo "Creating /storage/logs/laravel.log..."
touch /var/app/current/storage/logs/laravel.log
chown webapp:webapp /var/app/current/storage/logs/laravel.log
fi
This is because it's not referencing the daily log file.
I have an .ebignore file in place which explicitly prevents local logs from being deployed, so it isn't the presence of an existing log file that's causing problems:
/storage/logs/*
The issue is that Laravel is creating the daily log as root so it cannot be written to by the normal user (webapp).
I just don't know why it's doing it?
The solution is to allow each process to create its own log file. That way each process will have the correct permissions to write to it.
You can do this in the config/logging.php file and adding the process name (php_sapi_name()) to the file name:
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/' . php_sapi_name() . '-laravel.log'),
'level' => 'debug',
'days' => 14,
],
Now each process will be able to write to its own file and there will be no permission problems.
Important Note: The above example uses "Daily", but make sure you make the change to right logging channel for you.
Try to set storage folder permissions to this
chmod -R gu+w storage/
chmod -R guo+w storage/
If anyone else stumbles upon this one, and can't solve it despite all the great solutions, one other thing that causes the original problem "could not be opened: failed to open stream: Permission denied" is that it seems like the log file is being written by the root user, not the ec2-user or webapp, which means no matter how much the right chmod or chown is done, we can't touch the file.
So the workaround to that is to make sure the log file is saved with the user id and then it will be different files.
Add ".get_current_user()." to the storage_path
config/logging.php
'single' => [
'driver' => 'single',
'path' => storage_path('logs/'.get_current_user().'laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/'.get_current_user().'laravel.log'),
'level' => env('LOG_LEVEL', 'debug'),
'days' => 14,
],
Further though, one can discuss why log files are stored on a Beanstalk instance as it will anyway be overwritten the next time, so I would advice Horizon, S3 storage or whatever else, but that's a different topic. I guess you just want to solve the issue. I spent like a week until I found out the root user wrote the file first...
You can check who owns the file if you can SSH in to the Beanstalk instance "eb ssh". Then go to the folder var/app/current/storage/logs then write "ls -la" (which will list permissions). Then you can see that the root user has written the file once first and then has rights to it. I tried to change predeploy and postdeploy settings but didn't work. Writing it as a separate file name worked fine.

deleteDirectory not working as Cron job

I have a job which I want cron to run at given interval , this removes some old entries from my db and then removes the files that were uploaded with the db entry.
If I run the task from the terminal it works fine, (removing both db entries and the files uploaded). But when I leave the task to cron, it does remove the entries in the db , but it doesn’t remove the uploaded folders in my public directory.
the code that removes the files looks like this
$machtiging = File::files('icec/'.$icecconsult->accesstoken.' /machtiging');
if(count($machtiging) > 0){
File::deleteDirectory(public_path() . '/icec/'.$icecconsult->accesstoken);
}
so it looks if there there, if so , delete them , but this just doesn’t work , ive tried putting the cron job run as root , www-data , and my user , all with same result . files and folder permission I have set them to 777 to be sure, but this doesn’t seem to be the problem.
Ive also tried adding shell=/bin/bash but that didnt do the trick either
Any help on solving this issue would be much appreciated
Update
the crobline looks like this
* * * * * /bin/bash /home/ice/verlopenicec.sh >> /tmp/output 2&>1
also tried
* * * * * /home/ice/verlopenicec.sh >> /tmp/output 2&>1
and
* * * * * /usr/bin/php /var/www/wemedic/artisan verwijder-verlopen-icec-consult 1>> /dev/null 2>&1
All seem to run . its just it doesnt delete or move the directory it needs to
trying to get some debug data , but nothing is showing up
the verlopenicec.sh script itself looks is just a say reference to the original script that laravel should run . thouth might be handy to make a script to test why laravel aint deleting the directory.
script looks like this
#!/bin/bash
SHELL=/bin/bash
USER=ice
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
/usr/bin/php /var/www/wemedic/artisan verwijder-verlopen-icec-consult
wich runs a laravel command that looks like this
$icecconsult = Icecconsult::where('id', '=', $consult_id)->firstOrFail();
$icecconsult->expire = Carbon::now();
$icecconsult->status = 'Gesloten';
$icecconsult->save();
$icec = Icec::where('id', '=', $icecconsult->icec_id)->firstOrFail();
$icec->delete();
$machtiging = File::files('icec/'.$icecconsult->accesstoken.'/machtiging');
if(count($machtiging) > 0){
// File::deleteDirectory(public_path() . '/icec/'.$icecconsult->accesstoken);
$move = 'mv /var/www/wemedic/public/icec/'.$icecconsult->accesstoken.' /tmp' ;
shell_exec('SHELL=/bin/bash');
shell_exec('PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games');
shell_exec($move);
// File::deleteDirectory('/var/www/wemedic/public/icec/'.$icecconsult->accesstoken);
}
return;
(ive commented out the delete function and tried to move it to the temp directory , but having the same result with moving or deleting. both work If I directly run it , but not when cron runs it . Cron does run the task , cause I can see it beeing fired in the /var/log/syslog and the database entru does get changed )
Ive tryied deleting , then moving it to the temp folder, both work if I run them directly , but none work when I leave it to cron/ laravel cron scheduler
If also tried to get a response (tru/false ) from the delete function, but when I try to save that to the db to see it , the function seems to not execute.
dd($machtiging) returns an array like below, showing the files in the folder , after knowing there are files in the folder, it should go ahead and delete the complete folder allong with any files/sub directories located in it
array:1 [▼
0 => "icec/a89ce4c9010e0a745308b29782b5eeae/machtiging/machtiging.pdf"
]
Thanks for you help
Try with this crontab :
*/1 * * * * ice /bin/bash /home/ice/verlopenicec.sh >> /tmp/output.log
Change your bash script to :
#!/bin/bash
moment="`/bin/date +%y_%m_%d`"
echo "--- The script has been executed on $moment ---"
/usr/bin/php /var/www/wemedic/artisan verwijder-verlopen-icec-consult
It should work better, but if not, could you paste here the content of your generated /tmp/output.log ?

Steps for installing Orbfit 4.2

I'm trying to install Orbfit4.2 on a using linux mint maya edition. I'm trying to follow the on line help. I have unzipped the tared file, configured with $ ./config -0 gfortran and then $ make. Both appears to be successful. I am now trying to create the DE405 data files in the /orbfit/src/jpleph directory. I have downloaded the header.405 and the ascp*date* ascii files into the directory from JPL. I have run $ make ephemerides and get the following;
cat header.405 ascp1960.405 ascp1980.405 ascp2000.405 ascp2020.405> input.430
asc2eph.x < input.430
/bin/sh: 1: asc2eph.x: not found
make: *** [ephemerides] Error 127
(I have also used input value of 405 instead of 430)
I have also tried just running from with in
the directory
$ ./asc2eph.x which was the previous method before the Makefile was included. All I get with this is 'authors' introductory message and the flashing working box-still running 6 hrs later.
If anybody has any experience or advice with installing Orbfit 4.2 from the start or can help me move on from the above blockage I would appreciate.
Note I am a real novice and would appreciate idiot step by step guide- I'm the idiot.
Eric
The Makefile assumes that the current directory "." is in your path. This is a security risk. You can either edit the Makefile to rename these binaries:
$ diff -u Makefile.orig Makefile
--- Makefile.orig 2014-01-09 07:14:10.000000000 -0800
+++ Makefile 2014-10-21 11:40:00.850236839 -0700
## -10,7 +10,7 ##
make clean
ephemerides: input asc2eph.x
- asc2eph.x < input.430
+ ./asc2eph.x < input.430
mv JPLEPH jpleph
make clean
Or you can add . to your path (but this is insecure!) by doing
$ PATH=.:$PATH

XAMPP OS X PHPMyAdmin Error

Just installed a clean install of XAMPP 1.8.2-0 (They changed the look... not a fan..) When I visit localhost/phpmyadmin/ I get the following error:
Cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly. Also ensure that cookies are enabled in your browser.
The log says:
[Wed Jul 10 19:14:43.016201 2013] [core:notice] [pid 3839] AH00094: Command line: '/Applications/XAMPP/xamppfiles/bin/httpd -E /Applications/XAMPP/xamppfiles/logs/error_log -D SSL -D PHP'
Not sure what this means to be honest, XAMPP normally works first time every time for me on a clean install...
Any help would be awesome!
Ta
Rick
Ran into the same problem. Whatever fragments of information I could find online led me to this discovery:
Check your xamppfiles/etc/php.ini file and find the "session.save_path = " and uncomment that. Not sure how that one slipped through the cracks.
UPDATE
Sorry about not being specific. The first few instances are just examples within an instructional comment block. The one you want is at the end of that.
here is a code snippet of the end of the comment block where you will find the line you need:
; where MODE is the octal representation of the mode. Note that this
; does not overwrite the process's umask.
; http://php.net/session.save-path
session.save_path = "/tmp" <<<<<<----- THAT ONE.
Nathan - thank you for pointing this out. Can you be a little more specific?
I am seeing four instances of session.save_path in the file you are referencing. There were no instances that looked exactly as you described. There are a few like this:
session.save_path = "/tmp"
session.save_path = "N;/path"
session.save_path = "N;MODE;/path"
All are preceeded with a ; on the line.

PHP session handling errors

I have this at the very top of my send.php file:
ob_start();
#session_start();
//some display stuff
$_SESSION['id'] = $id; //$id has a value
header('location: test.php');
And the following at the very top of my test.php file:
ob_start();
#session_start();
error_reporting(E_ALL);
ini_set('display_errors', '1');
print_r($_SESSION);
When the data sends to test.php, the following is displayed:
Array ( )
Warning: Unknown: open(/var/lib/php/session/sess_isu2r2bqudeosqvpoo8a67oj02, O_RDWR) failed: Permission denied (13) in Unknown on line 0
Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php/session) in Unknown on line 0
I've tried only using session_start(); but the results are the same.
Look at your message
So first thing it relate to permission
open(/var/lib/php/session/sess_isu2r2bqudeosqvpoo8a67oj02, O_RDWR) failed: Permission denied (13) in Unknown on line 0
you have to check file permission
change mode this /var/lib/php/session/
Second thing it relate to session.save_path
Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php/session) in Unknown on line 0
in php.ini
[Session]
; Handler used to store/retrieve data.
session.save_handler = files
; Argument passed to save_handler. In the case of files, this is the path
; where data files are stored. Note: Windows users have to change this
; variable in order to use PHP's session functions.
;
; As of PHP 4.0.1, you can define the path as:
;
; session.save_path = "N;/path"
;
; where N is an integer. Instead of storing all the session files in
; /path, what this will do is use subdirectories N-levels deep, and
; store the session data in those directories. This is useful if you
; or your OS have problems with lots of files in one directory, and is
; a more efficient layout for servers that handle lots of sessions.
;
; NOTE 1: PHP will not create this directory structure automatically.
; You can use the script in the ext/session dir for that purpose.
; NOTE 2: See the section on garbage collection below if you choose to
; use subdirectories for session storage
;
session.save_path = /tmp/ <= HERE YOU HAVE TO MAKE SURE
; Whether to use cookies.
session.use_cookies = 1
you have to change your session.save_path setting to the accessible dir, /tmp/ for example
How to change: http://php.net/session_save_path
Being on the shared host, it is advised to set your session save path inside of your home directory but below document root
also note that
using ob_start is unnecessary here,
and I am sure you put # operator by accident and already going to remove it forever, don't you?
This was a known bug in version(s) of PHP . Depending on your server environment, you can try setting the sessions folder to 777:
/var/lib/php/session (your location may vary)
I ended up using this workaround:
session_save_path('/path/not/accessable_to_world/sessions');
ini_set('session.gc_probability', 1);
You will have to create this folder and make it writeable. I havent messed around with the permissions much, but 777 worked for me (obviously).
Make sure the place where you are storing your sessions isn't accessible to the world.
This solution may not work for everyone, but I hope it helps some people!
You can fix the issue with the following steps:
Verify the folder exists with sudo cd /var/lib/php/session. If it does not exist then sudo mkdir /var/lib/php/session or double check the logs to make sure you have the correct path.
Give the folder full read and write permissions with sudo chmod 666 /var/lib/php/session.
Rerun you script and it should be working fine, however, it's not recommended to leave the folder with full permissions. For security, files and folders should only have the minimum permissions required. The following steps will fix that:
You should already be in the session folder so just run sudo ls -l to find out the owner of the session file.
Set the correct owner of the session folder with sudo chown user /var/lib/php/session.
Give just the owner full read and write permissions with sudo chmod 600 /var/lib/php/session.
NB
You might not need to use the sudo command.
Go to your PHP.ini file or find PHP.ini EZConfig on your Cpanel and set your session.save_path to the full path leading to the tmp file, i.e: /home/cpanelusername/tmp
please make sure the session.save_path is set correctly in the php.ini. php needs read/write access to the directory to which this variable is set.
more information: http://www.php.net/manual/en/session.configuration.php#ini.session.save-path
I had the same error everything was correct like the setting the folder permissions.
It looks like an bug in php in my case because when i delete my PHPSESSID cookie it was working again so aperently something was messed up and the session got removed but the cookie was still active so php had to define the cause differently and checking first if the session file is still they and give another error and not the permission error
When using latest WHM (v66.0.23) you may go to MultiPHP INI Editor choose PHP version and set session.save_path to default i.e. /var/cpanel/php/sessions/ea-php70 instead of previous simple tmp - this helped me to get rid of such errors.
When using the header function, php does not trigger a close on the current session. You must use session_write_close to close the session and remove the file lock from the session file.
ob_start();
#session_start();
//some display stuff
$_SESSION['id'] = $id; //$id has a value
session_write_close();
header('location: test.php');
check your cpanels space.remove unused file or error.log file & then try to login your application(This work for me);
I got these two error messages, along with two others, and fiddled around for a while before discovering that all I needed to do was restart XAMPP! I hope this helps save someone else from the same wasted time!
Warning: session_start(): open(/var/folders/zw/hdfw48qd25xcch5sz9dd3w600000gn/T/sess_f8bgs41qn3fk6d95s0pfps60n4, O_RDWR) failed: Permission denied (13) in /Applications/XAMPP/xamppfiles/htdocs/foo/bar.php on line 3
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /Applications/XAMPP/xamppfiles/htdocs/foo/bar.php:3) in /Applications/XAMPP/xamppfiles/htdocs/foo/bar.php on line 3
Warning: Unknown: open(/var/lib/php/session/sess_isu2r2bqudeosqvpoo8a67oj02, O_RDWR) failed: Permission denied (13) in Unknown on line 0
Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/var/lib/php/session) in Unknown on line 0
I'm using php-5.4.45 and I got the same problem.
If you are a php-fpm user, try edit php-fpm.conf and change listen.owner and listen.group to the right one. My nginx user is apache, so here I change these to params to apache, then it works well for me.
For apache user, I guess you should edit your fast-cgi params refer the two params I mention above.
If you use a configured vhost and find the same error then you can override the default setting of php_value session.save_path under your <VirtualHost *:80>
#
# Apache specific PHP configuration options
# those can be override in each configured vhost
#
php_value session.save_handler "files"
php_value session.save_path "/var/lib/php/5.6/session"
php_value soap.wsdl_cache_dir "/var/lib/php/5.6/wsdlcache"
Change the path to your own '/tmp' with chmod 777.

Resources