Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Feb 082011
 

Turn on register_globals in PHP

Answer:

When turned on, register_globals will automatically inject the PHP script with variables such as those from HTML form. The feature was DEPRECATED and turn off by default in the recent PHP distributions.

But if you still want to change it, you need to edit the php.ini

vi /etc/php.ini

Locate and set

register_globals = on;

Remember to restart web server such as Apache if needed.

Feb 062011
 

Change the PHP’s maximum allowed form post size

Answer:

The default maximum allowed form post size in PHP is only 8MB. If you want to change it, you need to edit the php.ini

vi /etc/php.ini

Locate and set (16M in the following example)

memory_limit = 16M;
post_max_size = 16M;

Try it with the number you need.

Also, remember to restart web server such as Apache if needed.

Dec 282010
 

Change the PHP's maximum upload file size

Answer:

The default maximum upload file size in PHP is only 2MB. If you want to change it, you need to edit the php.ini

vi /etc/php.ini

Locate and set (100M in the following example)

memory_limit = 100M;
post_max_size = 100M;
upload_max_filesize = 100M;

Try it with the number you need. (You might need to use a large value in post_max_size and memory_limit if you want to upload a file which is exactly 100M in size)

Also, remember to restart web server such as Apache if needed.

Dec 162010
 

What is the PHP's short_open_tag

Answer:

PHP's short_open_tag is a way to use PHP in a PHP script without the normal PHP tag, e.g.

Instead of

# <?php echo "hello world"; ?>

You can use a simplified version.

# <? echo "hello world"; ?>

Although it is not recommended, if you want to set it, you can enable it by editing the php.ini

vi /etc/php.ini

Locate and set

short_open_tag = On

Also, remember to restart web server such as Apache if needed.