PHP Debian 5

How to install PHP on Debian 5

  1. Install PHP
    apt-get -y install php5 php5-cli php5-curl php5-dev php5-gd php5-mcrypt php5-mysql php-pear

How to configure PHP on Debian 5

  1. PHP Apache configuration
    1. Open the PHP configuration file
      gedit /etc/php5/apache2/php.ini
    2. Increase PHP script max execution time
      Replace max_execution_time = 30 with max_execution_time = 120
    3. Increase PHP script max upload size
      Replace upload_max_filesize = 2M with upload_max_filesize = 64M
      Replace post_max_size = 8M with post_max_size = 64M
    4. Save and Close the file.
    5. Restart the Apache Server
      /etc/init.d/apache2 restart
  2. PHP CLI configuration
    1. Open the PHP configuration file:
      gedit /etc/php5/cli/php.ini
    2. Increase PHP script max execution time:
      Replace max_execution_time = 30 with max_execution_time = 120
    3. Increase PHP memory limit
      Replace memory_limit = 32M with memory_limit = 64M
    4. Increase PHP script max upload size:
      Replace upload_max_filesize = 2M with upload_max_filesize = 64M
      Replace post_max_size = 8M with post_max_size = 64M
    5. Save and Close the file.

How to test PHP on Debian 5

  1. Create a localhost phpinfo testing website.
    1. Create the phpinfo project folder:
      mkdir /usr/share/phpinfo
    2. Create the /usr/share/phpinfo/index.php server file with the following text:
      <?php
         phpinfo();
      ?>
    3. Create the phpinfo settings folder:
      mkdir /etc/phpinfo
    4. Create the /etc/phpinfo/apache.conf Apache configuration file with the following text:
      # phpinfo Apache configuration

      Alias /phpinfo /usr/share/phpinfo

      <Directory /usr/share/phpmyadmin>
        Options Indexes FollowSymLinks
        DirectoryIndex index.php
      </Directory>
    5. Link the phpinfo configuration file into the apache configuration directory:
      ln -s /etc/phpinfo/apache.conf /etc/apache2/conf.d/phpinfo.conf
  2. Restart the Apache Server:
    /etc/init.d/apache2 restart
  3. Visit localhost/phpinfo in your web browser.
    Note: You should see the phpinfo output.

Open Source Software: