The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

505 Internal server Error - very difficult to solve

Discussion in 'General Discussion' started by madone, Mar 25, 2008.

  1. madone

    madone Member

    Joined:
    Feb 10, 2003
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    i have the website www.celebirony.com

    sporadically it shows me 505 Internal server error, i really don't understand why.

    Maybe when there are lot of requests it give me this error but i don't why it give it, maybe for server overload and i don't know how to solve it.

    I read all posts and documentations about 505 error.

    i have phpsuexec, all directory has 755 chmod , files 644 , chown user:user

    apache 2.2.8 , php 5.2.5 , csf firewall installed.

    Top command give me

    top - 21:06:36 up 23:52, 1 user, load average: 17.50, 15.60, 15.00
    Tasks: 165 total, 3 running, 161 sleeping, 1 stopped, 0 zombie
    Cpu(s): 18.2% us, 57.6% sy, 24.2% ni, 0.0% id, 0.0% wa, 0.0% hi, 0.0% si
    Mem: 1019428k total, 683228k used, 336200k free, 68208k buffers
    Swap: 979956k total, 94492k used, 885464k free, 309864k cached

    PID USER PR NI %CPU TIME+ %MEM VIRT RES SHR S COMMAND
    2266 mysql 21 6 38.2 718:24.91 4.1 68620 40m 2716 S mysqld
    21607 celebirony 22 3 5.0 0:00.15 2.3 49020 23m 20m R php
    21601 celebirony 18 3 1.7 0:00.05 0.7 50580 6824 3656 S php
    21603 celebirony 19 3 1.7 0:00.05 0.7 50424 6784 3620 S php
    21612 celebirony 21 3 1.7 0:00.05 0.7 49800 6824 3656 S php


    This is the apache file configuration
    i add only the lines give you few ideas.. there are thousands lines..

    Please help me.. im going crazy :(


    PHP:
    CacheEnable mem /
    CacheEnable fd /
    MCacheSize 32000
    MCacheMaxObjectCount 1640
    MCacheMinObjectSize 256
    MCacheMaxObjectSize 128000


    CacheRoot 
    /usr/local/apache/cache/
    CacheEnable disk /
    CacheDirLevels 5
    CacheDirLength 3

    # Turn on Expires and set default to 0
    ExpiresActive On
    ExpiresDefault A0

    # Set up caching on media files for 1 year (forever?)
    <FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$">
    ExpiresDefault A29030400
    Header append Cache
    -Control "public"
    Header unset Pragma
    Header 
    unset Last-Modified
    Header 
    unset ETag
    FileETag None
    </FilesMatch>

    # Set up caching on media files for 1 week
    <FilesMatch "\.(gif|jpg|jpeg|png|swf)$">
    ExpiresDefault A604800
    Header append Cache
    -Control "public"
    Header unset Pragma
    Header 
    unset Last-Modified
    Header 
    unset ETag
    FileETag None
    </FilesMatch>

    # Set up 2 Hour caching on commonly updated files
    <FilesMatch "\.(xml|txt|html|js|css)$">
    ExpiresDefault A7200
    Header append Cache
    -Control "proxy-revalidate"
    Header unset Pragma
    Header 
    unset Last-Modified
    Header 
    unset ETag
    FileETag None


    # Force no caching for dynamic files
    <FilesMatch "\.(htm|php|cgi|pl)$">
    #ExpiresActive Off
    #Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform"
    #Header set Pragma "no-cache"
    ExpiresDefault A30
    Header append Cache
    -Control "proxy-revalidate"
    Header unset Pragma
    Header 
    unset Last-Modified
    Header 
    unset ETag
    FileETag None
    </FilesMatch>

    EnableSendfile on
    EnableMMAP on

    Include "/usr/local/apache/conf/php.conf"
    Include "/usr/local/apache/conf/mod_bandwidth.conf"
    Include "/usr/local/apache/conf/modsec2.conf"


    RLimitMEM 142739797
    RLimitCPU 240
    ErrorLog logs
    /error_log
    DefaultType text
    /plain
    KeepAlive On
    KeepAliveTimeout 2
    MaxKeepAliveRequests 1500
    ServerTokens Prod
    HostnameLookups Off
    AddHandler cgi
    -script .cgi .pl


    # prefork MPM


    StartServers       8
    MinSpareServers    16
    MaxSpareServers    32
    ServerLimit      256
    MaxClients       256
    MaxRequestsPerChild  500

    # worker MPM
    StartServers         2
    MaxClients         150
    MaxRequestsPerChild  0
    SendBufferSize 131072


    <IfModule mime_module>
        
    TypesConfig conf/mime.types
        AddType application
    /x-compress .Z
        AddType application
    /x-gzip .gz .tgz

    </IfModule>

    <
    Location />
        
    SetOutputFilter DEFLATE
        BrowserMatch 
    ^Mozilla/4 gzip-only-text/html
        BrowserMatch 
    ^Mozilla/4\.0[678no-gzip
        BrowserMatch 
    \bMSIE !no-gzip !gzip-only-text/html

        SetEnvIfNoCase Request_URI 
    \.(?:gif|jpe?g|png)$ no-gzip dont-vary

        Header  append Vary User
    -Agent env=!dont-vary

    </Location>

    <
    IfModule mod_rewrite.c>
        
    RewriteEngine on
    </IfModule>


     
  2. philwebservices

    Joined:
    Jul 7, 2006
    Messages:
    12
    Likes Received:
    0
    Trophy Points:
    1
    505 Directory

    take a look at your logs , should be at /etc/httpd/logs/error_log and check if there are any premature ended scripts or any libraries missing

    try running php -v and check what is the output as well
     
  3. Cemtey

    Cemtey Well-Known Member

    Joined:
    Aug 19, 2007
    Messages:
    69
    Likes Received:
    0
    Trophy Points:
    6
    seems to be workin for me.
     
  4. madone

    madone Member

    Joined:
    Feb 10, 2003
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    Errors:


    [Wed Mar 26 00:01:07 2008] [error] [client 74.6.8.120] Premature end of script headers: thepage.php
    [Wed Mar 26 00:01:14 2008] [error] [client 74.6.8.120] File does not exist: /home/celebirony/public_html/500.shtml
    [Wed Mar 26 00:01:21 2008] [error] [client 66.249.70.57] File does not exist: /home/celebirony/public_html/es

    [Wed Mar 26 00:04:06 2008] [error] [client 66.249.70.57] File does not exist: /home/celebirony/public_html/it
    [Wed Mar 26 00:04:06 2008] [error] [client 66.249.70.57] File does not exist: /home/celebirony/public_html/404.shtml
    [Wed Mar 26 00:04:15 2008] [error] [client 64.1.215.162] Premature end of script headers: thepage.php
    [Wed Mar 26 00:04:16 2008] [error] [client 66.249.70.57] File does not exist: /home/celebirony/public_html/es
    [Wed Mar 26 00:04:16 2008] [error] [client 66.249.70.57] File does not exist: /home/celebirony/public_html/404.shtml
    [Wed Mar 26 00:04:22 2008] [error] [client 64.1.215.162] File does not exist: /home/celebirony/public_html/500.shtml
    [Wed Mar 26 00:04:42 2008] [error] [client 66.249.70.57] File does not exist: /home/celebirony/public_html/it


    php -v give me:


    PHP 5.2.5 (cli) (built: Mar 8 2008 04:19:58)
    Copyright (c) 1997-2007 The PHP Group
    Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
    with eAccelerator v0.9.5.2, Copyright (c) 2004-2006 eAccelerator, by eAccelerator
    with Zend Extension Manager v1.2.0, Copyright (c) 2003-2007, by Zend Technologies
    with Zend Optimizer v3.3.0, Copyright (c) 1998-2007, by Zend Technologies
     
  5. madone

    madone Member

    Joined:
    Feb 10, 2003
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    Usually the website works well.

    After testing it for long sometimes it has issues showing 505 error, i viewed these errors and checked them into the /etc/httpd/logs/error_log file
     
  6. mtindor

    mtindor Well-Known Member

    Joined:
    Sep 14, 2004
    Messages:
    1,279
    Likes Received:
    36
    Trophy Points:
    48
    Location:
    inside a catfish
    cPanel Access Level:
    Root Administrator
    Check this page out: thepage.php

    [Wed Mar 26 00:04:15 2008] [error] [client 64.1.215.162] Premature end of script headers: thepage.php

    That particular error message would have been accompanied with a 500 Internal error.

    Mike
     
  7. madone

    madone Member

    Joined:
    Feb 10, 2003
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    that page is like the masterpage of the website.
    I don't know what i have to check, if this page working always ok, sometimes give that error.

    Is it possible this error caused by cookies set ?
     
  8. Phoenix cg

    Phoenix cg Member

    Joined:
    Feb 21, 2008
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    could it possibly be an update issues by cpanel? mine automatically updated to an edge release and ive been getting 500 internal server errors all day
     
  9. madone

    madone Member

    Joined:
    Feb 10, 2003
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    Hello, after view a top command, i see usage of ram memory too high..

    940 Mb of 1 giga

    Is it possible issues ?
    How can i solve it ?

    It shows me 500 error when too much usage of memory.
     
  10. Sindorf

    Sindorf Member

    Joined:
    Aug 3, 2007
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    Maybe it is better to optimize your PHP scripts.
     
  11. madone

    madone Member

    Joined:
    Feb 10, 2003
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    i optimize a lot php scripts,
    i notice the issues is generated only when there are too many requests at the same time.

    I tried 7 requests at the same time, from my part.

    1 give me portion of the website.
    1 give me 500 Internal Server Error
    other requests were all done.


    ---------------------------------------------------------------------------------
    Maybe, is there a method to cache the pages requests ?
    So it shows the pages as static results.

    The first time you open the page you will see dinamically content, after other users see the same page as static, maybe it loads less more than using always php scripts and mysql interaction.
     
  12. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    That's actually a fairly common technique for application-level caching in PHP. I believe Smarty Templates has this functionality built-in and enabled by default and some third party scripts now have plug-ins for such functionality (e.g. WP-Cache for WordPress).
     
  13. madone

    madone Member

    Joined:
    Feb 10, 2003
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    1
    already has caching with eaccelerator and memcache diskcache in apache,
    now i am looking for other kind of software to install and improve performance.

    Like memcached, libevent.

    Putting keepalive off in apache it sends less errors.

    Please help me.

    Maybe i will use a new system like a scalable cdn.

    I think my dedicated server isn't very good for this such of usage.

    What you think about scalable cdn, someone use it ?
     
Loading...

Share This Page