Jump to content
Larry Ullman's Book Forums

sandy

Members
  • Posts

    6
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by sandy

  1. Started looking at my directory of session files and it seems like they are never getting garbage collected.

     

    I started looking around in the Yii codebase and in v1.1.13 they had what looked like a default setting of 1%

     

    In v1.1.14 it seems that code has been removed to allow the default of php.ini to be the default. When I looked at the php.ini in the Amazon AWS (AMI Linux) it was something like this -

     

    session.gc_probability = 1
     

    and

     

    session.gc_divisor = 1000

     

    Which gives a .1% chance by default. So the default in 1.1.14 is not 1%, but 0.1% unless set.

     

    I'm not sure if this is the problem why I have not seen a GC in the subdirectory but I'm going to set the default in code to see if it does change.

     

    One perplexing note is that is in php.ini is mentions this -
     

     NOTE: If you are using the subdirectory option for storing session files
    ;       (see session.save_path above), then garbage collection does *not*
    ;       happen automatically.  You will need to do your own garbage
    ;       collection through a shell script, cron entry, or some other method.
    ;       For example, the following script would is the equivalent of
    ;       setting session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes):
    ;

    ;       find /path/to/sessions -cmin +24 | xargs rm

     

     

    Has anyone else run into this where no GC is taking place due to the default save dir being change?

     

    Sandy
     

  2. I ran into this too and had to chmod them to 777 them. BUT I think the problem might also be related to owner and groups to use anything other then 777. I'm not a Linux hack, but Larry might chime in with more insight, but I can't remember if I changed them www-data:www-data or something like that and less then 777 for the access.

     

    I'm just moving stuff to Amazon Web Services and just set a few of the directories to 777 to get things going will experiment with it and if it's anything different then 777 will tell the tail

     

    Sandy

    • Upvote 1
  3. Edward -

     

    Don't create the sizes on the fly It's brutal for CPU utilization. I have had to fix up a few old Wordpress sites that relied on autosizing the images with timthumb.php. After removing that option to autosize images on the fly cpu's became quite even with the caching that it had.

     

    One other area to watch out for on some autosized images is that file size will become larger after re-sizing. I think this was related to how the resizers are set up for compression and how they do their job. Some seem to convert .jpg to .png  and back to .jpg to do the work and the file sizes with default settings get larger even with smaller image sizes as I recall. 

     

    And I'm just learning Yii and have had many of the 6 hour session with the ultimate conclusion wow this was easy once I figured it out :)

     

    Sandy

    • Upvote 1
  4. One more .htaccess post - Moving your Yii app out of web root

     

    Just got the rest of my .htaccess working for the Yii app I have been working on. The Yii app is in a subdir under the web root.

     

    This seems to work well and is similar to some of the above examples, posting as it's always madding dealing with .htaccess and making things work ... This was cobbled from some other .htaccess files I had found.

     

    Put this in your webroot's .htaccess not in the local Yii App directory

     

    replace subdir with the directory that your yii app is in (with index.php)

    replace yourdomain with the domain name of the site (may be other ways to do this without explicitly setting this)

     

    As always use .htaccess on a test instance before crashing your web server...

     

    ============ .htaccess at web root  ============

     

    # allow no one to read .htaccess

    <Files .htaccess>
    order allow,deny
    deny from all
    </Files>

    # Common options, hide directory listing, etc
    Options ALL -Indexes +SymLinksIfOwnerMatch

    # Allow first html then php index files to be the default
    DirectoryIndex index.html index.php

    # Must have this!
    RewriteEngine on

     

    # May be the default, but doesn't hurt
    RewriteBase /

    # Don't apply rules to URLs that are existing files or folders.
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d

    # Only apply to URLs that aren't already under /subdir
    RewriteCond %{REQUEST_URI} !^/subdir/

    # Rewrite all those to insert /subdir.
    RewriteRule ^(.*)$ /subdir/$1

    # Redirect the root folder.
    RewriteCond %{HTTP_HOST} ^(www.)?yourdomain.com$
    RewriteRule ^(/)?$ subdir/ [L]
     

  5. This was a huge help. Here are a few more things to check, I'm running Ubuntu/Mint 15 on a virtualBox instance.

     

    I could not get the simple examples working, .htaccess and the code was as the book has but no-go.

     

    Looked at the apache2 enabled modules in /etc/apache2/mods-enabled and saw that their was a symlink set up to rewrite.load so the module was setup for loading.

     

    Then took a look at

     

    /etc/apache2/sites-enabled directory, it has one entry in my case which is a symlink to the /etc/apache2/sites-available/default file where I found pretty much what Gio said,

     

     <Directory /var/www/>
                    Options Indexes FollowSymLinks MultiViews
                    AllowOverride none
                    Order allow,deny
                    allow from all
     </Directory>
     

     I just changed the

     

    AllowOverride none 

     

    to

     

    AllowOverride all

     

    and restarted apache2 as Gio did below.

     

    Lastly Don't forget to add the

     

    'showScriptName'=>false,

     

    Line to the

    'urlManager' section in config/main.php file as the book shows, it's easy to miss.

     

     

    And Thank You GIO!

     

    Sandy

     

     

    I know that this is an old thread but wanted to share that I had the same problem with the OP. matthuisman's suggestion didn't work on my setup on Ubuntu13.10 with apache2.4.6. Instead, I had to add the following to my /etc/apache2/sites-available/mysite.conf

    <Directory /var/www/mysite/>
        Options Indexes FollowSymLinks
        AllowOverride All
    </Directory>
    
    

    Then reload apache with

    sudo service apache2 restart
    

    Hope this helps someone.

     

×
×
  • Create New...