≡ Menu

PHP

Increase PHP memory limit in WordPress

The question - I have a WordPress blog and in wp-admin, I see an error that allowed memory size of n bytes exhausted. How do I fix this? There is a simple solution to this problem - increase the memory limit in wp-config.php! The file wp-config.php is located in the root directory of the wordpress [...]

{ 0 comments }

How to temporarily set memory limit to unlimited in PHP?

The question - I have a PHP script that I run on the command prompt. As I am parsing very large HTML files, I need to set the memory limit to unlimited for that script only. I do not want to change the global options. How to do that? PHP scripts have an option to [...]

{ 0 comments }

The question - I want to disable exec, system and shell_exec commands in PHP. Is there a PHP directive that can disable these commands? I am not running PHP in safe mode. The exec, shell_exec and system commands are used to run shell commands from PHP. These commands pose a very strong security risk. For [...]

{ 0 comments }

Check if a TCP port, like HTTP port 80, is open using PHP

The question - I need to check if a particular port is open on a web site using PHP. I also need the latency between my client and the web server. Is there a way to check if HTTP port 80 is open on a remote server? You can use the fsockopen function in PHP [...]

{ 0 comments }

How to get Google Page Rank from PHP?

The question - I want to get Google page rank from my PHP script. Is there an API to do this? Yes, there is a fast PHP API script to do this. First, a little bit about Google page rank: Google's page rank is a number between 0 and 10 (inclusive) which represents the importance [...]

{ 0 comments }

The question - I get this error when I try to run one of my PHP scripts on my Linux box. How to fix this? PHP Fatal error: Call to undefined function mb_internal_encoding() The problem might be that you don't have a necessary package on your PHP installation. This package provides support for multi-byte strings [...]

{ 0 comments }

How to use the free geoip database from MaxMind in PHP?

Question - I need to convert IP addresses to locations (city, state, country) for a large list of IP addresses. Is there a free geo ip database available that can help me do this in PHP? There is a free geoip database from MaxMind. This article will serve as a tutorial with examples on how [...]

{ 0 comments }

PHP script to get Alexa rank for free

The question - Is there a way to get the Alexa rank of a website from a PHP script, through an API, for free? Alexa rank is a number given by Amazon's company Alexa which represents the amount of traffic that a site receives. This is calculated using the Alexa toolbar. The lower the traffic [...]

{ 0 comments }

How to fix: phpize command not found?

I am trying to install xCache from source and one of the steps of the installation is the phpize command. I am getting a command not found error when I try to fun phpize on my command prompt. How to solve this problem? What is phpize? The command phpize prepares PHP extensions for configuration and [...]

{ 0 comments }

How to install the PHP opcode cacher xCache?

The PHP opcode cacher xCache is used to speed up your PHP applications by caching the opcode of the compiled PHP scripts and using that instead of compiling your scripts on each request. So for very frequently used PHP scripts, this will significantly improve your PHP web sites' performance. By storing the PHP opcode in [...]

{ 0 comments }