CakePHP 2.2 random notice message - cakephp

From time to time, randomly and very rarely, I get this message on my CakePHP site:
Notice (8): session_start(): ps_files_cleanup_dir: opendir(C:\WINDOWS\TEMP) failed: No such file or directory (2) [CORE\Cake\Model\Datasource\CakeSession.php, line 615]
Why is this happening?
I am using sessions all the time since the user gets in so... why do I only get this message from time to time and so rarely?
I am using Windows Server 2003 over IIS 6 but i get the exactly same problem over Windows 7 and IIS 7.

It seems that either there is no C:\WINDOWS\TEMP directory or it is not writable by the IIS User.
That's why it cant open a new session.
There could also be a dead-lock or write-lock on the disc, but this is highly unlikely. Check the users that are trying to access that folder.

More than likely, the only permission IUSR is missing and needs to be granted is "List folder" under Advanced Security on the C:\Windows\Temp folder.
Notice (8): session_start() at CakePHP 2.2
If you're on a Windows server it's highly unlikely that C:\Windows\Temp does not exist.

Related

Failed to update database becase the database is read only

I have created a winform application and programmatically trying to attach the database when an application runs first time. Unfortunately in windows 7 i always got an error. Please view the screenshot below it tells the whole story. Now my question is that how can i get rid from this error, is there any way to automatically give required rights on the folder where the application installs?. I want to permanently resolve this error and need smooth attachment. Anyone please help.
Please view the error below. Thanks in advance
Try ALTER DATABASE MyDatabaseName SET READ_WRITE
More informations here on This forum
Edit
This was asked by someone else
If you put your database in your own subdirectory of the directory returned by Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData then the user will have read/write access to it.
See Environment.SpecialFolder Enumeration to determine if a different location would be more suitable, e.g. ApplicationData if you need it to roam or CommonApplicationData if you need all users of the computer to use it.
Edit: I found a slightly more extensive version of this answer: Where Should I Store my Data and Configuration Files if I Target Multiple OS Versions?, please also see the articles it links to.
I know this answer is somehow late, but I believe people always face the same problems so my case is worth to be shared.
tl;dr = Change the permission of deployed files manually or using icacls command.
Actually I use InstallForge for packing and deploying my application(s).
No matter what setup creator is used, when the application is installed to a non-system folder ( e.g. D:\ ) the program works perfectly and the database is readable/writable.
Whereas when the application is installed in [Program Files] folder or [Program Files (X86)] folder, Windows takes a preventive security measurement and sets file permission to be only [Read] and [Read & Execute].
I think Windows Vista and later versions of Windows have this behavior.
You can check that by right-clicking the installed file and going to properties then Security tab.
The files I installed on D:\ had Full-Control permission while, as I mentioned, the ones on C:\ had only Read & Execute permissions.
You won't notice the difference when you install a normal program on C:\ because you might not be writing data on a file or a database. But in case of database deployment, the file has to be writable.
Finally, the solution for this case was telling InstallForge to change file permissions at the end of the installation using icacls commands :
icacls "C:\MyApp\MyDB.mdf" /Grant Everyone:F
icacls "C:\MyApp\MyDB_log.ldf" /Grant Everyone:F
In my case, it is okay to give everyone full-control on the database files, but you might need a customized solution for your case so please refer to :
http://ss64.com/nt/icacls.html
You can tell your setup creator to run those commands, or you can put them together in a batch file and run it after the installation.

ClickOnce issue with Corporate IT client

So I am having some difficulty with our WPF ClickOnce deployment. I knew that we would run into issues when our clients from coporations with complex IT policies started installing. Up to this point, I have not had an issue. The application itself has a prerequisite of .NET 4.5 – which I know requires administrator privileges. Here is the error that the client is sending to me:
“C:\documents and settings\gdevlin\local settings\Temporary Internet Files\content.ie5\9wkrp310\setup[1].exe
Windows cannot access the specified device, path, or file. You may not have the appropriate permissions to access the item.”
Seems pretty obvious to me. They have of course consulted their IT dept and they confirm that there should be no problems and that they have sufficient permissions. They did note that the setup.exe file is empty – that file should be around 430 kb.

cakephp: warning 512 /tmp/cache/ not writable on shared host justhost

When I go to www.merryflowers.com/webroot/ i'm getting the following warnings. Based on the guidance i got from my previous post (cakephp: configuring cakephp on shared host justhost), I right clicked on the app/tmp/ (on the remote server) and all the folders within that and set the permission to be writable (ie. 777). But I'm still getting the same warnings.
Since i'm using windows 7 (chmod doesn't work), I also tried CACLS on the command prompt for tmp folder. Since i'm not familiar with CACLS, i don't know the exact command to make tmp writable to all. Can someone please help me out. Thank you.
Warning (512): /home/aquinto1/public_html/merryflowers.com/tmp/cache/ is not writable [CORE/cake/libs/cache/file.php, line 278].php, line 429
Warning (512): /models/ is not writable [CORE/cake/libs/cache/file.php, line 278]
Warning (512): /persistent/ is not writable [CORE/cake/libs/cache/file.php, line 278]
Is your site hosted locally on your Windows machine, like through XAMPP or WAMP, etc? Those are *nix paths, not Windows paths.
Did you FTP to your sites - like, with an FTP client - and change the permissions? Doing this through FTP clients isn't always 100% reliable. It looks like you changed the perms on /tmp, but they didn't cascade to /tmp/cache, etc. like you thought. Try setting them all one by one.
According to your other post - cakephp: configuring cakephp on shared host justhost - your site is set up with remote hosting. I looked at their service briefly, from the looks of them, you can probably remote (aka, "shell" or "ssh") into your server and get access to the command line. A lot of webhosts provide this these days, although you may have to specifically request they enable it for you.
On a Windows machine, you can use PuTTY to shell into your remote server: http://www.chiark.greenend.org.uk/~sgtatham/putty/
HTH. :)

Database errors in Quantum Grid demos in Delphi XE Professional

Whenever I open one of the Quantum Grid demos in Delphi XE Pro (on Windows 7 32-bit), the following error is displayed for every table (I think) in the project:
error message http://www.tranglos.com/img/qgerror.png
The message is:
Network initialization failed.
File or directory does not exist.
File: C:\PDOXUSRS.NET
Permission denied.
Directory: C:\.
I understand permission issues writing to c:\, but the result is that while I can build and run the demo projects, no data is displayed, which makes the demos rather useless. And what kind of database writes its configuration to c:\ directory in the 21st century anyway? :) (Yes, I know very little about Paradox databases, but I won't ever be using one either. I just want to learn how to use the grid.)
Using BDE Administrator I've tried changing the Paradox "NET DIR" value to a folder with write permissions on the C drive. Result: now the database tables cannot find their data:
Path not found.
File: C:..\..\Data\GENRES.DB.
...and the unhelpfully truncated path gives no indication where the files are expected to be.
Is there a way to work around the problem so that the demos can load their sample data correctly?
Did you install the BDE correctly? It should use the DBDEMOS files. Do you see such an alias in the BDE administration utility? Can you open that database in one of the Delphi demos?
The BDE is not a XXI century database, it was developed twenty years ago and never upgraded lately. It's an obsolete tecnology, but because it comes still with every release of Delphi with a known database it is still often used in demos because nothing new has to be installed.
Anyway that file is not its configuration file. It's a sharing lock file to allow more than one user to use the database concurrently. Because it is a file based database without a central server, it has to use such kind of shared files. Usually its position is changed to a network share, but it defaults to C:\ for historical reasons.
Anyway it's not only the BDE still attempting to write in the prong directories. I still see a full bunch of applications attempting to write to C:\ (especially logs) or other read-only positions.
Using BDE Admin to change the location for PDOXUSRS.NET helped, but it wasn't sufficient. DevExpress did the right thing in specifying a relative folder for the data location, and the relative folder seems perfectly allright, but for some reason the DB can't find it.
Solution: under the \Demos\ folder find all the *.dfm files that contain the string
..\..\Data
and replace that string with the absolute path to the demos folder. That done, all the demos open correctly.
I know this message from our own applications. It has to do with security measures introduced with Windows Vista. The operating system trying to protect critical files denies access to them. There is a method how to bypass this mechanism without compromising security. Try to run your application in compatibility mode. When application is running in compatibility mode, read / write operations from / to system folders are redirected to "safe" directories located in C:\Users[Current User]\AppData\Local\VirtualStore.
More info on http://www.windowsecurity.com/articles/Protecting-System-Files-UAC-Virtualization-Part1.html.

log4net writing to file. How to open up permissions

I was happily using log4net with my WPF program on an XP machine and happily using a fileAppender FileAppender to write log messages to c:\log.txt. All was well. However, it does not work on a Windows 7 machine. No error or anything, just that the file isn't created, much less logged to. A little research reveals that it's a file permissions problem (UAC) with Windows 7, and in fact it works if I run the executable as administrator. It doesn't work if I just click on it (even though I'm logged on as administrator) and it doesn't work when I launch from Visual Studio.
Questions:
1. Can someone point me to an example where I ask for permission to write to one and only one file (C:\log.txt). I've seen some examples of where the app.config is configured to ask that the whole program is run with admin privileges. This seems like overkill but I guess it would work.
2. Is there as better way to send the information to a log file? After all, perhaps C: does not exist on user machine. I think I recall the idea of a "user partition" in Windows 7, but whatever I do has to work on XP and Vista.
Thanks a ton,
Dave
You should not be trying to write directly to the root folder. Under windows 7, you will either have to run as administrator or disable UAC for that to work and neither are recommended.
Instead you can write to a folder in the 'application data' area
If you are using a .config file to configure log, you can use something like
<file value="${ALLUSERSPROFILE}\CompanyName\ProductName\Log.txt" />
or
<file value="${APPDATA}\CompanyName\ProductName\Log.txt" />
depending on whether you want the log files to be specific to a user or not.
(Obviously you replace CompanyName and ProductName with your own details).
This should work on Xp/Vista/W7.
You have 3 options in my eyes:
like mentioned always run your app as admin altough thats not a brilliant solution
Use the local path of the executing app to store your log - I always prefer this method as I always know where my logs are ( AppDomain.CurrentDomain.BaseDirectory will help you)
Use "My Documents" or some similar special folders - a quick google gives us: special folders
I hope this helps.

Resources