Permission in CakePHP Using EC2 Instance - php

I have new instance in AWS. I have make var/www directory using PuTTy. I have upload all file to var/www/html directory. When i open IP Public Instance in Web Browser there are :
Warning: _cake_core_ cache was unable to write 'cake_dev_id' to File
cache in /var/www/html/lib/Cake/Cache/Cache.php on line 322
Warning: /var/www/html/app/tmp/cache/persistent/ is not writable in
/var/www/html/lib/Cake/Cache/Engine/FileEngine.php on line 384
Then i changed permission:
sudo chmod -R 777 /var/www/html/lib
sudo chmod -R 777 /var/www/html/app
But when i changed the permission there are an error:
Error: Cannot use 'string' as class name as it is reserved File:
/var/www/html/lib/Cake/Utility/String.php Line: 24

It clearly saying error is in the class name. You are using String.php and String is a reserve keyword.
Try Changing the name of String.php to something else and try again.

You need to add permission in your tem and logs folder
if you don't have those folder you need to create those folder
you may use
cd /var/www/html/app
mkdir -m 777 tmp
Here is the Official Doc

Related

My smarty template is not displaying

I am using Php Smarty on Linux.
I have a line in my Php file:
$phpsmart->display("pagetemplate.tpl");
This line is supposed to display pagetemplate.tpl. It doesn't.
Enable errors, or check your logs. The most likely thing is that you haven't set up writeable directories needed by smarty.
I just installed smarty with composer:
$ composer.phar require smarty/smarty
And tried the demo:
( ! ) Fatal error: Uncaught --> Smarty: unable to write file ./templates_c/wrt56681191371d80_85949214 <-- thrown in /var/www/smarty/vendor/smarty/smarty/libs/sysplugins/smarty_internal_write_file.php on line 46
I then created that 'template_c' folder, and made it writeable by the web server.
( ! ) Fatal error: Uncaught --> Smarty: unable to write file ./cache/wrt566812bd6f7b08_17223124 <-- thrown in /var/www/smarty/vendor/smarty/smarty/libs/sysplugins/smarty_internal_write_file.php on line 46
I then created the 'cache' folder, and made it writeable by the web server.
The demo then worked.
See the quick install.
It doesn't display a tpl file even after changing the file permissions and ownership of a file.
for people who are having problem like this.
1) chmod -R 755 /var/www -> This will give read write permission to the owner and other for the group( the owner belongs to), and others the permission in read and execute. and this is assigned recursively so all your files and directories inside www will also be having the same permissions
2) chown -R apache:apache /var/www ->This will give make apache owner of www and including files. This is also applied recursively.
3)your website owner needs write permission to template_c file so check using ls -altr to see whether it has given the write permission, if write is like 755(rwxr-xr-x) and still not working change it to 777 (remember chmod). also check the cache folder..
4) If still it's not working may be selinux is protecting write access to your template_c file. so for this you need the following command
setsebool -P httpd_unified=1 -> This will disable selilnux for apache httpd.
Enjoy!

Permission Issues

Having an issue with unlink() even when executing a script as root.
Getting this error:
Warning: unlink(/var/www/html/services/training/add.php): Permission denied in /var/www/html/sites/services/functions.php on line 228
The owner of the file is root and the file permissions are 775 so it should work.
Are there any further steps I can take to troubleshoot this? Not sure where to go from here...
Open your terminal .. I guess you are an ubuntu user
so just do this
sudo chmod 777 -R /var/www/html/services/
By Default your access is limited . So you have to extend your access using this chmod command :) .. that's it :)

Codeigniter - move_uploaded_file permission(?) issue

This problem was asked before, but did not solve my case. I am working with Codeigniter.
I have a simple form that submits a file and want to move this file into a folder on my server. After submitting I can print_r the $_FILES['new-item-file'] array and everythings looks good.
But when I use move_uploaded_file I get an error:
failed to open stream: HTTP wrapper does not support writeable connections
The folder I want to write in exists and has 777 permissions.
Dies anyone have a solution to this?
Thanks a lot!
I solved it:
Move_uploaded_file does not seem to accept absolute paths. I took out the base_url(); and it worked.
This error happens due to two reasons.
Permission of the folder and invalid group and user owner.
Wrong path.
Permission and owner of folder :
If you are in Linux. Open terminal type this command. This will change the owner of the folder.
$ cd project_path && sudo chown -R www-data:www-data picture_folder/
Type this command to change the permission of folder.
$ sudo chmod -R 777 picture_folder/
note : Use man command more help about these commands.
$ man chmod OR man chown
Path of folder .
In codeigniter, index.php root file is executed. That is responsible for all activities. So don't use base_url() for root path. Instead. Just give root folder name. like
CI application
->
-application
-system
-user_guide
-index.php
-picture_folder
$target_directory="picture_folder/sub_folder";

Laravel: "Failed to open stream' in storage/views

I had my Laravel 3 application running on a different server. I wrapped it up and sent it to my new server. Unpacked it, and while I am trying to display the Laravel application on the new server, I receive this error:
Unhandled Exception Message:
file_put_contents(/var/www/customer_area/storage/views/13f378cf44cd9253eb03394b5a7fd914):
failed to open stream: Permission denied
Location:
/var/www/customer_area/laravel/blade.php on line 63
I have already read through this question several times where others have solved a similar problem by changing permissions on 'storage/directories' to '775'. I even changed permissions on the entire 'var/www' directory to '777', and I still have the error.
Something that I noticed is that there is no '13f378cf44cd9253eb03394b5a7fd914' in the storage/views folder. There are five other files in the folder, but not that one.
Assuming you are running apache on linux, look into recursive chgrp www-data and chown www-data on the folders
Just modify file/folder permissions
Assuming you are in root folder, run one of these commands
chmod -R 0777 storage // for L3
chmod -R 0777 app/storage // for L4

Changing permissions via chmod at runtime errors with "Operation not permitted"

When I use chmod() to change permissions at run time, it gives me the below message:
Warning: chmod() [function.chmod]: Operation not permitted in /home/loud/public_html/readalbum.php
How can I remove this error and make the chmod function work?
$ sudo chmod ...
You need to either be the owner of the file or be the superuser, i.e., user root. If you own the directory but not the file, you can copy the file, rm the original, then mv it back, and then you will be able to chown it.
The easy way to temporarily be root is to run the command via sudo. ($ man 8 sudo)
In order to perform chmod, you need to be owner of the file you are trying to modify, or the root user.
This is a tricky question.
There a set of problems about file permissions. If you can do this at the command line
$ sudo chown myaccount /path/to/file
then you have a standard permissions problem. Make sure you own the file and have permission to modify the directory.
If you cannnot get permissions, then you have probably mounted a FAT-32 filesystem. If you ls -l the file, and you find it is owned by root and a member of the "plugdev" group, then you are certain its the issue. FAT-32 permissions are set at the time of mounting, using the line of /etc/fstab file. You can set the uid/gid of all the files like this:
UUID=C14C-CE25 /big vfat utf8,umask=007,uid=1000,gid=1000 0 1
Also, note that the FAT-32 won't take symbolic links.
Wrote the whole thing up at http://www.charlesmerriam.com/blog/2009/12/operation-not-permitted-and-the-fat-32-system/
You, or most likely your sysadmin, will need to login as root and run the chown command:
http://www.computerhope.com/unix/uchown.htm
Through this command you will become the owner of the file.
Or, you can be a member of a group that owns this file and then you can use chmod.
But, talk with your sysadmin.

Categories