Sugarcrm CE Fatal error: sugar_file_put_contents_atomic() in wamp - php

I am running Sugarcrm CE under wamp on a windows 7 machine and I keep getting the following error. It just happens randomly and if I reload the page it seems to work. But this error is very annoying and I never used to get it under this development environment. I know if this was linux it would be a permissions issue but permissions look fine in windows to me. I have developer mode switched on and have deleted the cache folder but it still happens. Does anybody know how to prevent this?
Fatal error: sugar_file_put_contents_atomic() : fatal rename failure 'E:\wamp \www\sugargantt-project\cache\modules\Employees\tem177F.tmp' -> 'cache/modules/Employees/Employeevardefs.php' in E:\wamp\www\sugargantt-project\include\utils\sugar_file_utils.php on line 187

I had the 'cache' directory but found it was owned by 'root' so I resolved it by correcting ownership from the sugarcrm directory:
chown -R apache:apache .
Where 'apache' is your web server user.

I had this error and fixed it by editing the realpath_cache_size setting from the default of 16k to 32k in my php.ini.
realpath_cache_size = 32k
EDIT: Although, the above solution helped, this issue returned in my local development environment (I am running on Windows 7). I ended up resolving it by closing my PHP IDE, PhpED by NuSphere, and deleting the localhost debugging cookie in my browser that this IDE sets named "DBGSESSID". I re-ran my local sugarCRM instance again without PhpED and the error disappeared.

I was also facing this issue and resolved it by performing following steps
The root folder of sugar must have a folder named 'cache' in which it creates the cache files.If the folder is missing then create one.
Increase the Memory usage and script execution time in php.ini file, i had set these to Memoray: 256, Script execution time to 1000.

Visit http://localhost/?phpinfo=1 and see if WinCache or APC are enabled. They're both caching mechanisms for PHP on Windows environments, and I've had similar issues with such things in Sugar where temporary files aren't able to be deleted and rebuilt correctly.
If one or the other are enabled, you'll want to modify your active php.ini file or otherwise disable the PHP module from the WAMP menu.

Just create a cache directory in root directory of sugarcrm and check permission on it make it 777 and try hard reload it after this

Related

Permissions Issue on Wordpress Core Version Upgrade

I have a centOS -based virtual machine on digital ocean.
It is running NGINX HTTP sever.
I configured it to use multi domains, and set up SSL.
One of my domains runs a Wordpress application.
I migrated the WordPress files from my godaddy hosting.
Everything works great except when I try to upgrade the wordpress core ( updating and installing plugins works just fine).
When I try to upgrade WordPress to version 5.4.2 I get a permissions error (as shown in attachment photo):
Permission denied in /var/www/mydomain.com/wordpress/wp-admin/includes/class-wp-filesystem-direct.php on line 281
wordpress core upgrade file permissions error display
I tried doing the following just to diagnose the issue... I have the directory full access to nginx user:
chmod -R 777 /var/www/
chown nginx:nginx /var/www/
This did not work
I made sure php user is nginx by outputting echo exec('whoami'); on the page.
I am completely dumbfounded.
Does anyone know what the problem may be?
As a last resort I manually upgraded my wordpress version using FTP, but I'm concerned that I never figured out the root cause of this issue and it will spring back up again opening up a can of worms.
CentOS includes a mandatory access control (MAC) security mechanism in its Linux kernel by the name of SELinux. According to a support forum thread on Wordpress.org, this mechanism sometimes can cause issues that manifest with this error.
SSH into your server and use the following command to change the SELinux "context" for the entire /var/www/mydomain.com folder:
chcon -R –-type httpd_sys_rw_content_t /var/www/mydomain.com/
The last post in the above-linked thread indicated that this change of context alleviated the errors you're seeing.
As an aside, for your system's security, ensure you change your file permissions back to their defaults.

Xampp install WordPress stuck on step2 installer

I'm installing WordPress through Xampp. I used to work with MAMP and it basically works the same way.
Normally I do everything manually as in copying the files and installing the database.
When loaded the famous "can't establish database connection" kicks in.
Now I thought this might have something to do with the fact that MAMP and Xampp have some minor differences. So I decided to use the WordPress installer.
After placing the files in XAMPP->xamppfiles->htdocs->customFolder I ran the installer.
Database is created in phpMyAdmin and I expect the installer to finish after adding the credentials. But nooooo. For some reason this sob keeps denying the wp-config.php to be created.
I quadruple checked every credential of the database. Have no idea on why step2 fails to install WordPress.
So I might think this is an port issue. I have also installed MAMP and it is running on port:8080. After setting xampp to port:8080 it gives me an error saying it can't bind to that port. Changed it to port:8666 but the same problem occurs.
Any thoughts or extra info?
---- UPDATE ---
So I created the wp-config.php manually and got these extra error messages.
All files in the htaccess folder have now file permission 777. This is merely for testing and would never happen in a live environment.
Warning: mysqli_real_connect(): (HY000/1045): Access denied for user 'root'#'localhost' (using password: YES) in /Applications/XAMPP/xamppfiles/htdocs/testing/wp-includes/wp-db.php on line 1531
There must be file permission issue, You must grand 777 rites to create wp-config file. chmod 775 wp-content/upload
Also note
All files should be owned by the actual user's account, not the user account used for the httpd process.
Group owneraship is irrelevant, unless there's specific group requirements for the web-server process permissions checking. This is not usually the case.
All directories should be 755 or 750.
All files should be 644 or 640. Exception: wp-config.php should be 440 or 400 to prevent other users on the server from reading it.
No directories should ever be given 777, even upload directories. Since the php process is running as the owner of the files, it gets the owners permissions and can write to even a 755 directory.
It sounds like a folder/file permissions issue rather than a port issue.
This question should help you solve the permissions on your xampp/xamppfiles/htdocs/customfolder
XAMPP permissions on Mac OS X?
When WordPress gives that error it's most often because it can't create the wp-config.php file due to insufficient write permissions.
I found the solution.
MAMP uses a user root and password root.
XAMPP in contrast to MAMP doesn't.
The user name is root but the password is empty.....
I faced this issue attempting to install within XAMPP and what solved it for me was to run XAMPP as administrator. This reflects other answers referring to permissions.
The other thing that can be an issue is XAMPP timing out on the install. One can modify their php.ini file within xampp to increase the max execution time. As they say "I hope this helps"
;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;
; Maximum execution time of each script, in seconds
; http://php.net/max-execution-time
; Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time = 90
I had same issue using XAMPP 8.1.12 on WINDOWS 10;
Try installing an older version, in my case XAMPP 8.0.25 fixed the problem.

Session Persistance Issues Laravel

I keep having the problem on setting up my environment. Here is the spec:
System: Windows 8.1 x64
PHP: 5.6.10
Vagrant: 1.7.0
Laravel Homestead: https://github.com/laravel/homestead
As I am new to the framework I get that it has the problem with Session Persistance Issues. Here is the log of the error i get when I open up the page in the browser.
https://gist.github.com/brainiac080195/e21db5d122c367b48fa4
This is not about session, this is about permission denied. Give permissions to your Storage, Bootstrap and to Vendor directory. Hope this will resolve your problem.
Go to your php.ini file, look for session.save_path and set it to a direcotry which is actually writable for the user running the webserver / php-worker.
I see you are using vagrant with linux and not windows.
/home/vagrant/www/api.example.dev/resources/views/welcome.blade.php
So setting /tmp/ is a good value for the session save path.
The problem was trivial. Bad setup documentation. /storage folder was added to exclude folder from local synchronization. The folder wasn't even pushed to the vagrant. Problem fixed.

Symfony2: prod in a chroot environment?

As a learning exercise I used Symfony to update an existing application for a local non-profit. Development was in a Windows environment. Now that the application has been installed on their ISP's shared host I start to learn about chroot on a FastCGI server. There are errors such as this:
PHP Fatal error: Uncaught exception 'UnexpectedValueException' with
message 'The stream or file
"/home/projectmana/www2.projectmana.org/app/logs/prod.log" could not
be opened: failed to open stream: No such file or directory' in
/www2.projectmana.org/app/cache/prod/classes.php:4823
The ISP responds with:
Bad path. PHP is chrooted in /home/projectmana/.
OK. I get it that this is the problem. Web searches so far have not provided a clue as to how to proceed. (I've gained greater appreciation for Symfony wanting to avoid shared hosting.) Is there a solution that I, a relative novice and a volunteer, can implement in my code, or does the application have to find a new home?
You've got to set the doc_root variable according to your chrooted directory:
doc_root = "/home/projectmana"
cgi.fix_pathinfo = 0
You do this in the php.ini file - which seems to be not an option for you since you're on a shared server environment. When using Apache as a webserver, you can use a .htaccess file and set the proper PHP directives there via php_value.
The solution in this instance was to override the locations of the cache and logs directories according to the cookbook. This, however, by itself causes the cache:clear command to fail. The answer to that problem will have to appear in another question if I can't find it on my own.
Update
The other solution here cannot work because any php setting in .htaccess when Apache server is running FastCGI will cause a server error. Clearing the cache was never solved so the site was moved to a non-CGI host.

Issues with PHP 5.3 and sessions folder

I recently upgraded to PHP 5.3 and since then I get (sporadic) error messages which indicate Apache (or may be the cleaner of the session files) has no permissions to the folder where the sessions are stored.
This happens randomly and can't be reproduced with exact steps, which led me to guess it is the session cleaner.
Any one has any experience with such errors?
The error message (which is fired on the session_start() line) is:
ps_files_cleanup_dir:
opendir(/var/lib/php5) failed:
Permission denied.
ls -ltr on the session directory gives:
drwx-wx-wt 2 root root 4096 2010-05-25 12:39 php5
Inside this directory I do see session files owned by www-data which is my Apache, and the app does work fine.
Which makes me wonder, under which user does the session GC runs?
The fix: In your php.ini set session.gc_probability to 0
The cause
I believe I found the answer here http://somethingemporium.com/2007/06/obscure-error-with-php5-on-debian-ubuntu-session-phpini-garbage
Essentially, the garbage collection is set up to be done by cron jobs on some systems (i.e. Ubuntu/Debian). Some php ini executables like php-cli also try to do garbage collection and that results in the error you got.
This seems to be a typical error on Ubuntu servers (I'm using Lucid LTS). The default permissions of the /var/lib/php5 directory there are
drwx-wx-wt 2 root root 4096 2011-11-04 02:09 php5
so it can be written but not read by the web server, I guess that explains the errors.
As Ubuntu has it's own garbage cleaning via cron (/etc/cron.d/php5), it's probably best to disable php's garbage collection as suggested above by Diwant Vaidya.
session.gc_probability = 0
There's actually a reason the session folder should not be world readable - as the PHP Manual says:
If you leave this set to a world-readable directory, such as /tmp (the
default), other users on the server may be able to hijack sessions by
getting the list of files in that directory.
The solution I currently use (which I am not sure is the correct one) is to give ownership on the session folder to the Apache user (www-data in my case).
This issue has been bugging me for a while. I changed the value as suggested in php.ini and the issue kept occurring. I found the same config value in my index.php and also private/Zend/session.php. So it's worth looking a bit deeper if the issue keeps occurring. I hope this is useful for someone.

Categories