PHP Tutorials & HowTos

PHP is an open-source server-side scripting language and one of the most popular in web development. This section includes PHP programming related syntax, questions and answers ( rss feed ).

I‘ve brand new Ubuntu Linux server (Apache + PHP5 FastCGI + Lighttpd image only server) installed for my wordpress, mediawiki and vBullietin software. I can load forntpage but user cannot edit any wiki pages or post anything and I get the following error in log file:

PHP Fatal error: Allowed Memory Size of 20971520 Bytes exhausted (tried to allocate 131072 bytes) in /usr/share/mediawiki/includes/OutputHandler.php on line 81

How do I fix this problem?

{ 2 comments }

I own a small business website. However, bots started to abusing my forms such as contact.php. How do I stop bots bots from abusing my site? How do I tell if PHP form is submitted by a person or a script?

{ 26 comments }

Can you explain usage of predefined variables called $_SERVER[‘PHP_SELF’]?

{ 4 comments }

Q. I’m trying to upgrade my PHP version from 5.2.6 to 5.2.8 using portupgrade command. But I’m getting following errors:

*** Error code 1

Stop in /usr/ports/lang/php5.
*** Error code 1

Stop in /usr/ports/lang/php5.
*** Error code 1

Stop in /usr/ports/lang/php5.
** Command failed [exit code 1]: /usr/bin/script -qa /tmp/portupgrade.42275.0 env UPGRADE_TOOL=portupgrade UPGRADE_PORT=php5-pcre-5.2.6_2 UPGRADE_PORT_VER=5.2.6_2 make reinstall
—> Restoring the old version
pkg_add: warning: package ‘php5-pcre-5.2.6_2′ requires ‘php5-5.2.8′, but ‘php5-pcre-5.2.6_2′ is installed
** Fix the installation problem and try again.
[Updating the pkgdb
in /var/db/pkg … – 62 packages found (-0 +1) . done]
** Listing the failed packages (-:ignored / *:skipped / !:failed)
! lang/php5 (php5-pcre-5.2.6_2) (install error)

How do I fix this problem and upgrade php5-pcre?

{ 1 comment }

I‘m using PHP error logging in place of error displaying on production web sites. However, I do not want to see error messages about the use of uninitialized variables. I’d like to see all critical errors, except for notices and coding standards warnings. How do I disable error messages?

{ 13 comments }

Q. How do I redirect my domain name using a php server side scripting under Apache web server?

{ 2 comments }

Q. How do I find out if a string stored in a variable contains a particular substring using PHP? How do I find out (extract) first 5 character of a particular string using Apache and PHP?

{ 0 comments }