Browsing all articles tagged with source
Feb
27

Strict Standards: date() [function.date] Error

I was installing NagVis when I came across this weird message:

Strict Standards: date() [function.date]: 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. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘UTC’ for ‘GMT/0.0/no DST’ instead in /usr/local/nagios/nagvis/nagvis/includes/classes/objects/NagVisStatefulObject.php on line 360

It clearly says that I should check the timezone, which I did. But there’s nothing wrong with time or date. ntpd is running and it set the correct timezone so what could be wrong?

If you are reading this then probably you are seeing this error too. To fix this, open your php.ini using your favourite text editor (like vi) and add this line:

date.timezone=UTC

Take note that depending on how you installed php, it could be in /etc/php.ini (RedHat) or /etc/php5/apache2/php.ini (SLES) or if compiled, /usr/local/php5/php.ini.

You need to restart Apache for changes to take effect.

Jun
15

PHP JSON Module Bug Fix

If you are encountering any weird stuff with your PHP-JSON module installation, you might want to reinstall JSON using this link, this might get rid of the bug that is pestering you and your application.

First, uninstall any previous JSON installation you have so as not to conflict with the new one. To make sure you got the old JSON out, check your list of PHP modules by running:

php -m

JSON should not be listed and make sure you do not see any errors either. Doing this will prevent further headaches, trust me.

Perform the following steps to install the bug-free version of JSON from source:

1. Download the JSON source from here. You can use wget to download the source if you are using CLI

wget http://aurore.net/projects/php-json/php-json-ext-1.2.1.tar.bz2

2. Uncompress the archive and change directory.

tar jxf php-json-ext-1.2.1.tar.bz2
cd php-json-ext-1.2.1

3. Run phpize. Make sure that phpize is installed before proceeding to this step. phpize is included in the php-devel package.

phpize

4. Configure, make and make install

./configure
make
make install

JSON is now installed, but make sure that json.so is loaded in your php.ini file.

1. Open php.ini file. If you are unsure about the location of your php.ini file, run

php -i | grep php.ini

You should see something like this:

Loaded Configuration File => /etc/php.ini

2. Add this at the last line of the configuration file:

extension=json.so

3. You might want to restart Apache to make sure everything is still working.

To check if JSON is loaded as module, run php -m again, make sure JSON is in the list.

Now, to test JSON, open an editor and copy these lines:

< ?php
$input = '{ "test" : 12121211212121 }';
$val = json_decode($input, true);
print $val["test"];
?>

Save the file (json-test.php is the filename in this case).

Execute the file by running php json-test.php

The result should be 12121211212121

Feb
17

Basic Apache and PHP Install from Source Part 1

Ok, I may not be a guru when it comes to installing and configuring Apache and PHP but here is a sample of how I install Apache and PHP on Fedora or Red Hat boxes fresh from source. Pardon my newbie-sh technique but here it goes:

Installing Apache:

# cd /usr/src

- Download the http package

# wget http://www.apache.org/dist/httpd/httpd-2.2.8.tar.gz (change this to a mirror available to you)

- Extract the contents of the package

# tar zxf httpd-2.2.8.tar.gz

# cd httpd-2.2.8

- Configure the source depending on your requirements. At this point, configure may fail because of unsatisfied dependencies. Check what the error is and you can download the required package using yum or up2date. If you do not need SSL module for secure page (https), you can leave out the –enable-ssl part.

# ./configure –prefix=/usr/local/apache –with-mpm=prefork –enable-ssl –with-ssl=/usr/local/ssl –enable-log_config=static –enable-vhost_alias=static –enable-includes=static –enable-dir=static –enable-access=static –enable-mime=static –enable-mime_magic=static –enable-mods-shared=most –enable-cache=shared –enable-disk_cache=shared –enable-file_cache=shared –enable-mem_cache=shared

Tip: To check what these directives mean, you can issue ./configure –help .

# make

- If everything goes well, your fresh http will be installed in /usr/local/apache with the following command:

# make install

Installing PHP:

# cd /usr/src

# wget http://www.php.net/get/php-5.2.5.tar.gz/from/us.php.net/mirror (change this to a mirror available to you)

# tar zxf php-5.2.5.tar.gz

# cd php-5.2.5

- Same with http. The configure part will depend on your requirement.

# ./configure –with-config-file-path=/usr/local/apache/conf –with-apxs2=/usr/local/apache/bin/apxs –enable-calendar –enable-ftp –without-pgsql –with-zlib –with-openssl=/usr/local/ssl –with-mysql –with-mhash –with-mcrypt –with-curl –disable-cgi –enable-mbstring –enable-soap –with-bz2 –enable-sockets –enable-zip (If configure fails, read the error why the it failed and install first the dependencies then run again the configure.)

# make

# make test

# make install

To start the httpd service, execute

# /usr/local/apache/bin/apachectl start

You can create a symlink to your /etc/init.d so you can start apache by typing /etc/init.d/httpd start

# ln -s /usr/local/apache/bin/apachectl /etc/init.d/httpd

There you have it. You have successfully installed Apache with PHP on your webserver. I will continue this little howto with how to configure your webserver.

Powered by 1and1.comGlobat Webhosting Earn with Your BlogAdvertise @ PinoyTux

Search PinoyTux

Subscribe to Email Feeds

Enter Email Address:

Blog Lounge

Popular Posts

Recent Posts

Drop your Card Here

Recent Comments

Site Stats