Install Apache2, Php5 and MySql on Ubuntu 9.10

MySql, PHP, Ubuntu/Linux No Comments

Step 1. List of libraries needed for Apache2, Php5 and MySql for Ubuntu:

[html]
apt-get update
apt-get install  apache2 libapache2-mod-php5 mysql-server libapache2-mod-auth-mysql php5-mysql php5

Step 2. Turn on php module to work with Apache:

[html]
a2enmod php5

Step 3. If you have .phtml or .pl file, remember to add to the follwing line to apache configuration file (/etc/apache2/apache2.conf):

[html]
AddType application/x-httpd-php .php .phtml

Step 4. Restart apache:

[html]
/etc/init.d/apache2 restart

Useful Link:

  • http://ubuntuforums.org/showthread.php?t=277819
  • http://ubuntuforums.org/showthread.php?t=479194&page=2

Increase file upload for php in Apache

PHP, Ubuntu/Linux No Comments

When working with moodle, I always encounter file upload size problem (normally 2M). To increase file upload size, edit /etc/php5/apache2/php.ini file (in Ubuntu 9.10) for PHP 5 and Apache 2 by changing the upload maximum filesize to the size you want:

[html]
upload_max_filesize=30M

Save the file and restart apache:

[html]
sudo /etc/init.d/apache2 restart

Frustrated with Moodle

PHP No Comments

Getting frustrated with my work…. trying to solve the problem the whole day, but as I do not have access to the main data, i could not do much. it works fine in my local machine, trunk and one of the production server. I tested and try to guess what is the main problem with my code and fix them. Anyway, i have committed my code and see how it goes tomorrow after being moved to the production. Cross my finger….

Installing php gettext in Mac Leopard

Mac OS, PHP No Comments

I was trying to get phpldapadmin work in my Mac, I get this error:
undefined function _()

Search through website, I need gettext extension to be installed as php extension.

This is the useful website to get gettext work in Leopard:
Adding Gettext Extension for Mac OS X Leopard

NOTE from installation steps:

  • Even though there is php installed in Leopard (mine is version 5.2.6), just follow the instruction to install php 5.2.4 and go to ext/gettext folder to start install gettext. This will automatically install gettext in the local php.
  • If your installation is not working after following the step, try to disable extension_dir:
    [html];extension_dir="./"
  • AND remember to restart your apache:
    [html]sudo /usr/sbin/apachectl restart

Enabling Apache, PHP and MySql in Mac Leopard

PHP No Comments

Just got my first Mac yesterday and try to get PHP and Mysql to work so I can start to do my assignment. PHP is disabled by default and the value of mysql.default_socket is empty.

Let’s start with PHP:

  • Open /etc/apache2/httpd.conf using text editor with root account. e.g. sudo vi /etc/apache2/httpd.conf
  • Search for LoadModule php5_module and uncomment the line
  • If index.php is not included as default index file, search for dir_module, add index.php as Directory Index
    [html]<IfModule dir_module>
        DirectoryIndex index.html index.php
    </IfModule>
  • Save and close httpd.conf

Now MySql:

  • Get MySql package for Mac and download and install in your Mac by following the instruction
  • Move directory to /etc, current php.ini.default does nothing and for PHP to read the ini file, the file must be renamed to php.ini. But instead of renaming, just copy the file with sudo cp php.ini.default php.ini.
  • Using text editor to open php.ini as root e.g. sudo vi php.ini and look for mysql.default_socket.
  • set the value of mysql.default_socket = /tmp/mysql.sock
  • Save and Close the file

Now restart Apache using:
sudo /usr/sbin/apachectl restart