Write access not permitted in Windows 7 for CakePHP app - php

I primarily use Mac OSX for programming and then test it in windows periodically. I just installed XAMPP on a Windows 7 computer and I'm getting the following errors
Warning: _cake_core_cache was unable to write 'cake_dev_en-us' to File cache in C:\Program Files\xampp\htdocs\testproj\lib\Cake\Cache\Cache.php
Warning: C:\Program Files\xampp\htdocs\testproj\lib\Cake\Cache\persistent is not writable in C:\Program Files\xampp\htdocs\testproj\lib\Cake\Cache\Engine\FileEngine.php
I opened up the testproj folder properties and unchecked Read Only and applied it to all folders/subfolders. I tried to open the Cake application again and the same error message was displaying so I checked the folder properties again and it had a square in the Read-Only box, not a check mark. Does that signify anything? I'm not sure what exactly the square means instead of a check mark.
I am signed into the administrator account on this computer. Is there some kind of command similar to chmod -R 777 for windows?
Thanks
Update - I changed the installation from Program Files to C:\xampp... and I still get the errors. I then created a partition and installed xampp to G:\xampp... and the error still exists

Using C:\ and especially the Program Files folder is a really bad idea for developing with PHP on Windows. Use another partition or at least a folder outside of system internal folders.
There is a reason WAMP and most tools by default try to install themselves in C:\wamp\ etc.
Edit: also try to avoid folder names with spaces in them like the windows-stupid "Program Files" default folder. And mind your casing, even if that is not directly visible in Windows, it will otherwise kill your app when going live with it on a unix server.

Related

Can't view re-uploaded php web files in my Linux server

I used to have a Windows OS server where i uploaded some old php web files to it. I could then access them, edit them, and view them online via my host name.
After much debating and reasoning, we had to change the OS of the server from Windows to Linux. After the change had been completed, a backup of the server was uploaded to the new Linux installation where all my old files were kept.
I could view these files online as I used to do when the server had windows OS.
The only thing I did encounter was the following:
a) I downloaded my files from the server using putty,
b) I deleted the old copy in my Linux server,
c) I then re-uploaded the same file that used to be in the server without making absolutely no change whatsoever to it, to the exact place where it was,
d) When I try to access it via its web address like I did earlier, it throws an error message saying..."The page isn't working".
I don't know much about Linux and there fore I am stuck. I don't know what the problem is. I can't understand why I can view all the files via their web address if they were placed there from the backup, but when I download them, delete their file from the server and then re-upload the exact same downloaded file to the exact place where it used to work, I get an error message.
Extra info: I connect to this Linux server from a windows OS machine using putty.
I found the problem. Since I migrated from a Windows OS server to a Linux Cent OS server, I didn't know that you had to configure the privileges of each folder in order to be accessed from the web. By default, my uploaded files where tagged by ownership of "user". The server was configured to only display files that were tagged by ownership of "root". The way I solved this was by typing the following command in the terminal.
NOTE: "You have to be in the folder where the file you are going to change ownership is."
sudo chown root:root filename.php
sudo -> Execute in admin mode
chown -> Change ownership of file to...
root:root -> ... root instead of user
filename.php -> the name of my file
Executing this corrected the error. Hope it helps someone else since I coudn't find anything related.

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.

Creating a symlink in WAMP server on Windows

I am working on a downloaded version of an application and am getting multiple errors due to:
( ! ) Warning: include(/home/USERNAME/public_html/dir/includes/functions.php): failed to open stream: No such file or directory in C:\wamp\www\dir\includes\db_connection.php on line 6
I understand what the error is but I don't want to have to manually change all these includes in the code mainly as doing so means when I update my ive site they will then be wrong.
Is there a way using either WAMP or Windows of creating something like a symlink to tell WAMP that anything in /home/USERNAME/public_html/dir should be served from C:\wamp\www\dir?
I found an option in WAMP for creating an alias but I am not sure if this is the right thing to use?
There is an answer on SO here.
This link https://www.sevenforums.com/tutorials/278262-mklink-create-use-links-windows.html would serve well too (from the answer above).
Basically you have to use mklink Windows command from command prompt (the latter must be run as administrator).
Now. Assume you have WAMP installed and virtual host named mysite.local is created and pointinig to the physical d:\mysite folder. You want now the files in the folder f:\otherfolder\realfolder to be accessible via mysite.local/otherfolder/somefile.ext kind of URL.
For this you have to create the symbolic link named otherfolder in d:\mysite that will point to f:\otherfolder\realfolder. You have to execute:
mklink /D d:\myfolder\otherfolder f:\otherfolder\realfolder
from Windows command prompt. The link otherfolder is created in d:\myfolder and you can access files via an URL as mentioned above.

PHP exec('git') failing

Specifically, I'm trying to get ViewGit working on a PHP/Apache/Windows installation.
It seems that PHP is unable to run exec('git');.
exec('whoami'); works just fine, so it isn't a problem with exec() being disabled.
Apache is running under it's own user account- if I log in as this user and attempt to run git on the command line I get the expected results. The account also has full permissions to do everything with the /Program Files/Git folder.
If I run exec('git'); on my local machine it works fine, but just won't work on the server.
Any ideas?
When you type 'git' in command-line on Windows, it opens git.cmd. In typical msysgit installation on Windows, git.cmd is in PATH, but git.exe may not be!
So, you can try one of below:
Create a git.bat in Windows folder with following contents:
C:\Program Files (x86)\Git\bin\git.exe (check path)
Add git's bin directory also in Windows PATH. (You can do so by editing system environmental variables)
I've managed to fix this by upgrading from PHP 5.2 to PHP 5.4. Not sure what the issue was, but that has resolved it.

How to set read/write permissions in Apache on a Windows computer

I am building a web page with Apache2.2, PHP5.2.2 on a Windows XP computer in a localhost configuration. I'm developing app/pages/submitProcessor.php to validate photo uploads from users. It validates file existance, size, mime type, drops unwanted characters, assigns a new file name, and uses move_uploaded_file() to store the file in app/uploads. I read in PHP - Question about uploading & uploaded image file that this photo storage file should be write only from app/pages/submitProcessor.php and it would be nice if it were read only from code within app/pages.
I've read a lot of info, and being pretty new to this, I still don't understand how to set read/write permissions in Windows XP in something resembling my configuration. I'm completely confused by 777, 775, 755, php.ini vs httpd.config and linux vs Windows. I'm also not comfortable with command line stuff, and would prefer to edit the appropriate file, if that is possible. How do I configure Apache so any file in app/uploads will not be executable, will write only from app/pages/submitProcessor.php, and read from app/pages/display or others in app/pages . . . or at least I'd like to get close to that. Not executable in the app/upload directory is pretty important to me.
If you are running Apache as a Service (the default setup for stand-alone & WAMP Apache installations), then that Apache Service is running under Windows' LocalSystem account.
This Windows account already has full read and write ('777') permissions on most local paths.
So when you read instructions to chmod 777 this, chmod 755 that, etc, ... you can ignore those parts of the instructions. Apache already can read-from and writeout-to those directories (unless it's a UNC path of a networked drive).
Setting File Permissions with chmod on Windows for Apache and PHP
I'm not 100% positive if that was the account on Windows XP (it is on Vista and up), but the behavior was the same.
In Windows, access to directories/folders is set by right clicking the directory, and reading through the selections provided by the various tabs to set access and specific uses of the directory. Its not as fine-grained as CHMOD, but it was good enough for my purposes at the moment.

Categories