This information is ONLY relevant to PHP4 and Apache 1.3. (BUT possible can be work also in PHP 5.x and Apache 2.x ) We historically used PHP for all our web work. We have decided to migrate to ruby for lots of reasons for all our new web development but we still have lots of PHP stuff hanging around.
Background
We regularly mix PHP and SSIs for the following reasons:
- Laziness – we have a lot of historic SSI stuff lying around and do not want to change it. We prefer evolution to revolution.
- Appropriateness. Not all systems are good at everything. We find that conditionally selecting ‘lumps’ of code to deliver browser specific pages (see server side browser sniffing) is a lot cleaner and easier with SSI. That does not take away from either technology.
Nesting PHP and SSI
The rules go like this (PHP4 and Apache 1.3 – we understand that Apache 2 is more flexible but have not yet made the transition):
- You can invoke SSI files from within PHP but must use the PHP virtual() function not include(). Variables set within PHP are NOT available to SSI so our favorite ‘wheeze’ of supplying last modified dates to a standard footer do not work.
- You can include SSI files using the include virtual SSI directive but the SSI filename must have a .shtml extension even if the XBitHack is being used.
- You cannot include PHP files using the include virtual SSI directive.
- Variables set within the General Apache section (we use this technique for server side bowser sniffing) are available to both .php and .shtml files no matter how they are called.
Note: We would guess that the Apache environment for each type of file (.php and .shtml) is initialised to the same state as when the page is first called, whereas a nested .php files uses the same php environment and therefore reflects any dynamic changes.
Question:
I am having troubles with serverpronto bots attacking my site in droves.
How would I block this range of ip address in .htaccess using deny:
69.60.114.0 – 69.60.125.255
for example, to block one ip I would have:
Deny from 64.251.14.99But how would I block the whole range given?
Thank you in advance
jdMorgan
Answer:
Mar 13 2009
PHP configuration inside httpd.conf
How to set PHP error notice hidden in httpd.conf (vhost):
<VirtualHost *:80> ... php_flag display_startup_errors off php_flag display_errors off php_flag html_errors off ... </VirtualHost>
How to set individual php.ini in httpd.conf (vhost):
<VirtualHost *:80> ... PHPIniDir '/path/to/php/conf/php-foo.ini' ... </VirtualHost>
How to set individual PHPError.log in httpd.conf (vhost):
<VirtualHost *:80> ... php_flag log_errors on php_value error_log /path/to/site/PHPerror.log ... </VirtualHost>