Showing posts with label PHP. Show all posts
Showing posts with label PHP. Show all posts

Monday, December 16, 2013

Apache not processing php in suse

If you have php installed on your suse os, but apache is not processing php page, then the following might help solve your problem:

1. edit /etc/sysconfig/apache2, on "APACHE_MODULES=" add "mod_php5"

2. Edit /etc/apache2/sysconfig.d/loadmodule.conf

Add this line for 32 bit OS
LoadModule php5_module /usr/lib/apache2/mod_php5.so

Add this line for 64 bit OS
LoadModule php5_module /usr/lib64/apache2/mod_php5.so


3. run these command
 /etc/init.d/apache2 stop
 /etc/init.d/apache2 start



Friday, May 24, 2013

Generate text file on the fly for user to download using php

Here's the code for generating a text file on the file for user to download. 
Make sure you don't have any output before this code,
otherwise it will be shown on the downloaded file also. 
 
 
<php? //Generate text file on the fly

   header("Content-type: text/plain");
   header("Content-Disposition: attachment; filename=test.txt");

   $str="test";
   echo $str;
   
 ?>
 
 
 

Monday, March 25, 2013

PHP timezone error


Problem:

date() [<a href='function.date'>function.date</a>]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function.

Solution:

On /etc/php.ini, set date.timezone = "America/New_York" or whatever timezone you need it to be







PHP Error on PEAR install


Problem:

PHP Fatal error:  Call to undefined method PEAR::raiseErro() in /usr/share/php/PEAR/REST.php on line 165

Solution:

mkdir -p /tmp/pear/cache