-
-
Notifications
You must be signed in to change notification settings - Fork 451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PDO CHMOD 0777 #27
Comments
hi saiful, Normally, when php run under CGI, FCGI or suPHP , they don't need CHMOD 0777 because PHP have permission on owner account files & folder. If PHP is running as MOD of Apache, then you have to chmod 0777. The chmod 0777 for cache folder only required for: auto, pdo, and files:
When you set $storage = "memcache" or some memory cache, you don't have to chmod 0777 for cache folder under "PHP5 MOD". The PDO can be download so easy. To make more security, you can try 1 of these way:
I will add .htaccess automatic on next revision for phpfastcache, your question is a good suggestion for me. |
Thank you... In this case, I must create and set CHMOD these folder manually, not by phpFastCache, I think it will be better if these folder created automatically according phpFastCache parameter if exists if not auto create, so cronjob will be run automatically without as us to create these folder. I set it globally for module frontend/backend and cronjob module
Thank you very much, I am waiting for next version.. |
That because you are running PHP as module under Apache. However, PHP can't do it automatic as Apache Module because of security problem. So, you can switch to suPHP and your folder will be create automatic without any problem. The function "auto create if not exist" is embedded already from the beginning. If you can't switch from Mod-PHP to other CGI / suPHP, then you can set the $path = "/tmp/" ; I believe MOD-php have full permission on /tmp folder , and it will automatic.
As your suggestion, I will make next version use /tmp folder automatic for Mod-PHP , so that user don't need create and chmod 0777 themself. Also, will add .htaccess DENY FROM ALL to cache folder for suPHP / CGI user for more security. Next Revision with these 2 functions will be updated for you on tomorrow. |
Awesome! With these 2 function very interested, phpFastCache will be more reliable and safe. Thank you very much, |
I'm working on it. Will publish it soon after I have a meeting with some php guys tonight. |
@saiful You can re-download it, revision 618 Here is the changes:
It default set as true, .htaccess files will be created automatic under cache folder. No one can send request to download or run from outside, except local users from 127.0.0.1 - Make sure you enable AllowOverride All in Apache Virtual Host for .htaccess ( most of the host enabled this as default ) Here is the .htaccess content that I have used:
For users who are running PHP as MOD PHP5 / Apache2Handler, right now don't need to chmod 0777 anymore, /tmp dir will be used as default. If you don't want to use /tmp dir, simple change $path to somewhere and chmod 0777 manual. Here is the code I have used to check tmp dir
Try: Delete cache.storage folder, and do not set $path. Run your testing.php and see if it works or not. |
I have try by set $path = ''; and it run like a charm (in cron job and others). But when I set $path with a cache path, cron job still need ask me with Sorry, Please create /root/content/8899/94857283/html/myweb/cache/f011a24472fb8efed77741001d5bc793/ and SET Mode 0777 or any Writable Permission!. It does not create a .htaccess. I think we need everything run automatically with set path or not for cron job module or not. I just want to adjustment any probability with server setting and phpFastCache parameters. |
Keep $path = ""; // default With your current PHP Mod config, if you try to install wordpress, then they gonna tell you CHMOD 0777 for many folders to install plugins automatic. If you want everything automatic switch your PHP Config to suPHP or CGI/FCGI On ROOT@localhost
Then setup cron like this:
Do not use WGET, with PHP run as ROOT, your PHP CRON Files, have full permission on whole server. |
Thank you khoaofgod I think there is a bug, I try run on localhost with setting phpFastCache::$storage = "files";// "pdo","mpdo","files","memcache","memcached","apc","xcache","wincache" But raise exception like below: Sorry, Please create /Applications/MAMP/htdocs/myweb/cache/sdfsa3322342sdfa/ and SET Mode 0777 or any Writable Permission! Last time I try $storage = "files" it's run normally. This is if I am not wrong on parameters. |
I have remove @ to check what happen in line 228 and 231 Warning: mkdir() [function.mkdir]: No such file or directory on line 228 Warning: chmod() [function.chmod]: No such file or directory on line 231 I look my path is real path/full path, this path is right |
Oh I am sorry, I must set full access for myweb folder on localhost to do this. thank you |
Thank you @khoaofgod for cron job I will keep $path = ''; It's good solution and safe |
for information I don't use WGET and other CMS opensource. |
Here the config $cms39_cache_config = array(
"storage" => "apc",
"path" => ABS_CACHE_PATH , /** /var/www/vhosts/###/httpdocs/tmp/cache/ */
"htaccess" => false
);
phpFastCache::setup($cms39_cache_config);
$cache = phpFastCache(); The server running FastCGI with PHP 5.4.37 Why ignore the storage aPC and return the FILE chmod issue? Fatal error: Uncaught exception 'Exception' with message 'PLEASE CHMOD /var/www/vhosts/###/httpdocs/tmp/cache//cache.storage.###/ - 0777 OR ANY WRITABLE PERMISSION!' in /var/www/vhosts/###/httpdocs/vendor/phpfastcache/phpfastcache/phpfastcache/2.4.2/drivers/files.php:58 Stack trace: #0 /var/www/vhosts/###/httpdocs/vendor/phpfastcache/phpfastcache/phpfastcache/2.4.2/drivers/files.php(108): phpfastcache_files->getFilePath('4cf0c74dd903c3b...') #1 /var/www/vhosts/###/httpdocs/vendor/phpfastcache/phpfastcache/phpfastcache/2.4.2/base.php(159): phpfastcache_files->driver_get('4cf0c74dd903c3b...', Array) #2 /var/www/vhosts/###/httpdocs/library/cache.php(151): phpFastCache->get('4cf0c74dd903c3b...') #3 /var/www/vhosts/###/httpdocs/library/functions.php(1385): cms39_cache_fetch('siteurl') #4 /var/www/vhosts/###/httpdocs/library/plugins.php(6): get_option('siteurl') #5 /var/www/vhosts/###/httpdocs/library/settings.php(6): cms39_has_su in /var/www/vhosts/###/httpdocs/vendor/phpfastcache/phpfastcache/phpfastcache/2.4.2/drivers/files.php on line 58 |
i will test fastcgi tonight with ur config and do a hotfix. -----Original Message----- Here the config phpFastCache::setup($cms39_cache_config); |
The APC driver work with Fast CGI in my server, i will try and memcache without success $cache = phpFastCache("apc"); here my PHPINFO
|
ok, I work on that. I will rewrite the way abstract class work right now on next release Feb 23. |
Hallo
I have a issued about pdo cache.
I created a modul for cron job, in cron job need to create a folder
cache/f011sdfasddsd8efed7as420323c793/ exampled. In these folder will be consist two files they are :
pdo.caching and config.41065cf4fd8asdf 7d52bedfda24a32adf75b1fe0.cache.ini
And I am considering for chmod it 0777 or Writable permission, I am afraid if some body can download these file via browser. I have test and it can be downloaded.
Other modul I set automatically, other module created cache APC, so I look cron job module and others moduls have created different cache, they are still in one application.
How to set chmod not to 0777 but still created pdo cache.
Thanks
The text was updated successfully, but these errors were encountered: