PHP-скрипт порождает запросы к бесконечному циклу

Я даже не уверен, правильно ли описываю эту проблему. Я думаю, что главное, что я хочу знать, это то, как я могу отслеживать источник этих запросов в коде.

Проблема возникла раньше, и я «решил» ее, добавив deny в .htaccess против IP-адреса самого сервера.

Проблема возникла внезапно и без видимых причин. Мое .htaccess потеряло магическую защитную силу. В коде не было внесено никаких изменений. Во время повторения я изменил настройку конфигурации, чтобы добавить домен cookie. Я попытался изменить его на пустое, и я попытался удалить все файлы сеанса (и кэш Magento). Если настройки сеанса вызвали повторение, это должно было исправить, но это не так.

Единственное, что «исправлено» – это отключить настройку Magento для перезаписи веб-сервера для «чистых» URL-адресов, а также прокомментировать эту строку в .htacces :

 RewriteRule .* index.php [L] 

Сайт теперь «работает», с уродливыми адресами и, что таинственно, невероятно деградировал. 10-20 секунд для загрузки страниц, которые использовались для 1-2. PHP и MySQL работают нормально.

Но с первоначальной настройкой после возникновения проблемы, я видел кучу PHP-экземпляров top в командной строке. MySQL SHOW PROCESSLIST позволяет постоянно увеличивать количество спальных процессов. И моя папка session веб-сайта Magento непрерывно добавляла новые сеансы (около 1 нового сеанса в секунду, хотя мой IP-адрес моего браузера был ТОЛЬКО, разрешенным htaccess во время этого теста). В браузере на стороне клиента большинство запросов тайм-аут, и редко страница загружается после ОЧЕНЬ долгого времени (10+ минут – PHP max_execution_time длинный, чтобы завершить длительные процессы импорта / экспорта).

Статический index.php который просто эхом «работает», загружает без каких-либо странных ошибок.

Я понятия не имею, в чем проблема. Это вредоносный код? Это проблема с обработкой сессии? Может ли это быть связано с DNS? Я мог бы добиться прогресса, решив проблему, если бы мог каким-то образом проследить источник «зомби».

EDIT: Вот мой полный файл .htaccess, с некоторыми изменениями (я изменил IP-адреса)

 ############################################ ## default index file DirectoryIndex index.php <IfModule mod_php5.c> ############################################ ## adjust memory limit # php_value memory_limit 512M # php_value max_execution_time 10 php_value max_input_time 18000 ############################################ ## disable magic quotes for php request vars php_flag magic_quotes_gpc off ############################################ ## disable automatic session start ## before autoload was initialized php_flag session.auto_start off ############################################ ## enable resulting html compression php_flag zlib.output_compression on ########################################### # disable user agent verification to not break multiple image upload php_flag suhosin.session.cryptua off ########################################### # turn off compatibility with PHP4 when dealing with objects php_flag zend.ze1_compatibility_mode Off </IfModule> <IfModule mod_security.c> ########################################### # disable POST processing to not break multiple image upload SecFilterEngine Off SecFilterScanPOST Off </IfModule> <IfModule mod_deflate.c> ############################################ ## enable apache served files compression ## http://developer.yahoo.com/performance/rules.html#gzip # Insert filter SetOutputFilter DEFLATE # Netscape 4.x has some problemsÂ~E BrowserMatch ^Mozilla/4 gzip-only-text/html # Netscape 4.06-4.08 have some more problems BrowserMatch ^Mozilla/4\.0[678] no-gzip # MSIE masquerades as Netscape, but it is fine BrowserMatch \bMSIE !no-gzip !gzip-only-text/html # DonÂ~Rt compress images SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary # Make sure proxies donÂ~Rt deliver the wrong content Header append Vary User-Agent env=!dont-vary # enable resulting html compression #php_flag zlib.output_compression on </IfModule> <IfModule mod_ssl.c> ############################################ ## make HTTPS env vars available for CGI mode SSLOptions StdEnvVars </IfModule> <IfModule mod_rewrite.c> ############################################ ## enable rewrites Options +FollowSymLinks RewriteEngine on ############################################ ## you can put here your magento root folder ## path relative to web root # if site is at raw ip/user url like http://111.22.33.44/~users_folder/ # RewriteBase /~users_folder/ RewriteBase / ############################################ ## workaround for HTTP authorization ## in CGI environment RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] ############################################ ## always send 404 on missing files in these folders RewriteCond %{REQUEST_URI} !^/(media|skin|js)/ ############################################ ## never rewrite for existing files, directories and links RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l ############################################ ## rewrite everything else to index.php RewriteRule .* index.php [L] </IfModule> ############################################ ## Prevent character encoding issues from server overrides ## If you still have problems, use the second line instead AddDefaultCharset Off #AddDefaultCharset UTF-8 <IfModule mod_expires.c> ############################################ ## Add default Expires header ## http://developer.yahoo.com/performance/rules.html#expires ExpiresActive On ExpiresDefault "access plus 1 year" #ExpiresDefault "access plus 1 year" </IfModule> ############################################ ## By default allow all access Order allow,deny Allow from all #try denying own ip. it seems like it is sending the requests! #this server ip eg 111.22.33.44 # this hack "fixed" the problem a long time ago. Deny from 111.22.33.44 # Order deny,allow # Deny from all # Allow from [particular IP for testing] <FilesMatch "\.(?:inc|ini|txt|tar|gz|sql|sh|zip|htm|html|log)$|apc.php"> Order allow,deny Deny from all </FilesMatch> ############################################ ## If running in cluster environment, uncomment this ## http://developer.yahoo.com/performance/rules.html#etags FileETag none Options All -Indexes # 4 Weeks <FilesMatch "\.(html|htm|phtml)$"> Header set Cache-Control "max-age=2419200, must-revalidate" </FilesMatch> <FilesMatch "\.(js|css|swf)$"> Header set Cache-Control "max-age=2419200" </FilesMatch> <FilesMatch "\.(jpg|jpeg|png|gif|swf|PNG|JPEG|GIF|SWF|JPG)$"> Header set Cache-Control "max-age=2419200, public" </FilesMatch> <ifModule mod_gzip.c> mod_gzip_on Yes mod_gzip_dechunk Yes mod_gzip_item_include file .(html?|txt|css|js|php|pl)$ mod_gzip_item_include handler ^cgi-script$ mod_gzip_item_include mime ^text/.* mod_gzip_item_include mime ^application/x-javascript.* mod_gzip_item_exclude mime ^image/.* mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.* </ifModule> # compress text, HTML, JavaScript, CSS, and XML AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/phtml AddOutputFilterByType DEFLATE text/xml AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE application/xhtml+xml AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE application/x-javascript # remove browser bugs BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4\.0[678] no-gzip BrowserMatch \bMSIE !no-gzip !gzip-only-text/html Header append Vary User-Agent <IfModule mod_expires.c> # Enable expirations ExpiresActive On # Default directive ExpiresDefault "access plus 1 month" # My favicon ExpiresByType image/x-icon "access plus 1 year" # Images ExpiresByType image/gif "access plus 1 month" ExpiresByType image/GIF "access plus 1 month" ExpiresByType image/PNG "access plus 1 month" ExpiresByType image/JPG "access plus 1 month" ExpiresByType image/JPEG "access plus 1 month" ExpiresByType image/png "access plus 1 month" ExpiresByType image/jpg "access plus 1 month" ExpiresByType image/jpeg "access plus 1 month" # CSS ExpiresByType text/css "access 1 month" # Javascript ExpiresByType application/javascript "access plus 1 year" </IfModule>