Archive for November, 2009

Setting up and getting DOMpdf to work in XAMPP on Windows

Monday, November 23rd, 2009

Setting up the Dompdf (a pdf generation package in php) in XAMPP in windows environment can sometimes be an issue.
After we have set up the package in the htdocs and go for testing the examples in the packages , error is encountered which is as follows-

A PHP Error was encountered
Severity: Warning
Message: domdocument::domdocument() expects at least 1 parameter, 0 given
Filename: include/dompdf.cls.php
Line Number: 165
Fatal error: Call to undefined method domdocument::loadHTML() in C:\xampp\htdocs\bambooinvoice\bamboo_system_files\plugins\dompdf\include\dompdf.cls.php on line 284


The error message is caused due to a conflict between DomDocument and DomXML extentions , so the first thing we did was to disable the domdocument extention in php.ini.
extension = php_domxml.dll

After restarting the apache and then again running the examples again blank pages were being rendered. The problem was due to the fact that dompdf uses PDFLib by default if it is available in the system and PDFLib is a commercial package which is not available by default in the system but its extention is enabled in php.ini by default in the system.

So what we did was to comment out the PDFLib extension extension=php_pdf.dll in the php.ini file. After the modifications we restarted the apache and then the examples could be run on the XAMPP environment.

How to hide Apache and PHP Versions from remote users

Sunday, November 1st, 2009

Hide Apache Information

To hide the information, add/change the following two apache directives in Apache configuration file /etc/httpd/conf/httpd.conf

ServerTokens ProductOnly
ServerSignature Off

Now you need to restart your web server using the following command

# service httpd restart

Now the output for apache header looks like below

Server: Apache

Hide PHP Version in Apache from remote user’s requests

In your php.ini (the typical path is /etc/php.ini) locate the line containing “expose_php = On” and set it to Off:

expose_php = Off

Now you need to restart your web server using the following command

# service httpd restart

After making this change PHP will no longer add its signature to the web server header. Though, this step in itself will not make your server more secure, it will prevent remote hosts to easily see that you have PHP installed on the system and what version of Apache you are running on your web server.

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...