Joomla configuration.php unwritable when permission is 0644 but writable when 0664 - joomla

My Joomla is 3.9.4, when I try to make some global configuration change on back-end, I got this error: Could not write to the configuration file.
I looked at the file system, configuration.php has the right owner and is set to 0644, actually I can make change to it via FTP.
I then try settiong the permission to 0777, it is writable; then I try 0666 and 0664, it is also good. Only when I set it to 0644, I get the above error. I've never encountered this kind of problem before. What could possibly be wrong?

I think you have to check PHP Ownership. PHP code can be executed not using the same user ID like using FTP. You can set your web server to run PHP as CGI to ensures that PHP is executed using the same user.

Related

Creating Model in laravel with correct file permissions

I am having a hard time trying to figure out the issue.
I am creating a Model using this Artisan command,
Artisan::call('make:model',['name' =>'Models\\'.$module.'\\'.$model_name]);
For whatever reasons,
1.there is a lock icon in the file
2.owner of the file is www-data
3.the permission for the file is 644 but when I create the Model from CLI the permission of the file is 757.
It all depends who runs the code, in this case web-server runs the code, thus Apache or NGINX is the owner of newly created file (same goes for uploads).
You can change this using
umask
change user/group of web-server
Best option is to use artisan as its meant to be used, from command line.

Laravel lock some folders on host

Guys I have created my first Laravel Project and I uploaded it to the server successfully and everything works perfect.
But I can write in the url www.mydomain.com/resources/views and show all my views!
Also user can open my .env file and view my database connection info!
I want only the user to navigate only to my routes not to any folder he guess.
Basic Instruction to Deploy Laravel to shared hosting7
You should point your document root to app/public/
run composer install in the project root directory
set writable permissions to bootstrap cache chmod 777 bootstrap/cache
set writable permissions to storage chmod 777 storage -R
There are many things that can go wrong while deploying application. So, it would be easier for us to help you, if you also provide us step by step process that you followed while deploying the laravel application.
For securing your routes and .env file you need to get into your hosting root directory, create .htaccess file and copy the below code and paste it in there
# Disable index view
Options -Indexes
<FilesMatch "\.env$">
Deny from all
</FilesMatch>
I hope this will solve your problem.

local php.ini sessions.save_path issue - sessions not recognised

I have a client who is running a user management script. The host provider had blocked allow_url_fopen but is using suPHP so we created a local copy of php.ini with allow_url_fopen set to "on".
The only problem now is that you can no longer login to using the script - it says 'success logging you in' - then logs you right out (because the sessions are either not getting created or are in the wrong place - excuse my lack server knowledge).
Here are the settings in the local php.ini
upload_tmp_dir = "/home/aspac124/public_html/tmp"
register_globals = On
memory_limit = 256M
session.save_path = "/home/aspac124/public_html/tmp"
safe_mode = off
upload_max_filesize = 32M
allow_url_fopen = On
zend_extension = "/usr/local/IonCube/ioncube_loader_lin_5.3.so"
I'm not sure why the hosting provider turned register_globals on for the client. But is that the correct place for the session.save_path? I've checked and the folder exists and I also set it to 777 just to make sure but no happiness.
Another client using the same system had a similar issue and told me he changed the tmp/ folder to his home directory and everything was fine.
I've tried to put the save path as just /tmp, /home/aspac124/tmp and nothing happens - just get logged out as normal. If I make up a path then I get a "No such file or directory" error.
When I put it as "/home/tmp" I get the following message
Warning: session_start() [function.session-start]: open(/home/tmp/sess_4417d180e599b5f12fc34a28f5467d21, O_RDWR) failed: Permission denied (13) in /home/aspac124/public_html/domainnamehere.com/includes/lightwork_session.php on line 45
What does this mean, is the home/tmp the correct place for this and if so what should I do - should the folder permissions be changed?
edit: I don't have access to folders outside the domain root so cannot change the file permissions - have to wait for the client but would like as much info before then.
Thanks in advance
EDIT: Just for anyone reading this. Please make sure your local php.ini file settings are applied to any sub folder that may require it. I was making ajax requests to a file in a sub folder to the root and this was the issue.
You should place your session and upload directories outside of the document root otherwise these will be accessible by anyone and can result in remote script injection, session hijacking etc.
You should perhaps create a tmp directory as /home/aspac124/tmp and set the permissions so Apache can write to this directory. Perhaps set the chmod to 0760.

Codeigniter not creating any log files

Under config.php I have:
$config['log_threshold'] = 4;
$config['log_path'] = '/home/myaccount/logFilesFolder';
In index.php I have:
error_reporting(E_ALL);
The only way I can seem to get anything to log is if I chmod that directory to rwx (777), which doesn't seem right to me. That and it doesn't see to be logging all the errors.
In my local/dev environment it seems to be working but on my production server nothing is being logged. I can't seem to figure out why.
The log filename in the configuration settings needs a trailing "/" above making sure the webserver process has writeable access to the directory.
Change the logs owner and group to what owner/group your live web server is running, give it write perms and it should work. I take it that in your local/dev server your CI folder is owned by you that is why you need to chmod it to 777 to make it work.
The directory where you want the log files to be saved needs to be writable.
I have tried a lot of solutions and finally what worked for me was this:
Open system/libraries/Log.php
and change the following lines;
set the value of: $this->log_path to a writable directory, preferably home directory so that there are no permission issues. If you want to change the filename also, search for the variable $filepath and change the name.
Example:
$this->log_path = '/log';
touch /log/
restart the webserver.
The logs will start coming.
I have tried a lot of other options, none worked, this is not neat approach but at least I can see my logs now.
I had the same problem with my Codeigniter 4 project. The log was created successfully in my local window machine but was not creating on the remote Linux machine. I was using a custom path to generate log files under the 'app' folder. So what I did is to change the settings in my config/Logger.php file back to
'path' => WRITEPATH.'logs/',
and it created the log files under writeable/logs folder.

How to enable my Joomla extension?

When logged in as Administrator and trying to install a Joomla extension it fails giving this error message
JFolder::create:
Unable to create destination
At another Joomla site it works, and one difference is where it works Joomla is setup with default English and where it fails setup is in Swedish. Can you recommend how to troubleshoot and proceed? I tried with 2 different extensions and both work on the English joomla and not the Swedish.
Probably you have to check the rwx (Read-Write-Execute) permissions (should be 644 or 755) for allowing the extension's folder to be created.
You have to change the owner of the folders/files to the user of the Apache server using the "chown" command.
If the Apache user is httpd, run this command in your Joomla folder
chown -R httpd *
I already get this problem and this solution worked for me.
Also check the path to the /tmp folder in your configuration.php file.

Resources