intitle:"index of" +"last modified" +"parent directory" +description +.mp3
This will look for MP3 files. Try here.
You want to play with Linux + Apache + MySQL + PHP. How to install all the necessary stuff easily?
There is a tool called tasksel that can install multiple related packages as a co-ordinated “task”. Launch
tasksel as root and choose the task you need. There is an option called LAMP server. The packages
mysql-admin are not part of this collection, you need to install them separately.
sudo apt-get install tasksel sudo tasksel sudo apt-get install phpmyadmin sudo apt-get install mysql-admin
Enabling user directories
My home directory is located at
/home/jabba. Here I want to create a directory called
public_html and I want to play with PHP in this folder. The contents of this directory is accessible via http://localhost/~jabba. However, by default it’s not enabled.
Steps to follow:
First, create the directory
$HOME/public_html. Then enable user directories:
cd /etc/apache2/mods-enabled sudo ln -s ../mods-available/userdir.conf userdir.conf sudo ln -s ../mods-available/userdir.load userdir.load
Update (20110107): There is a script called
a2enmod to create and manage these symlinks. Its opposite is
a2dismod, which disables Apache modules. See
man a2enmod. (credits go to Jesse)
And restart Apache2:
sudo /etc/init.d/apache2 restart
This tip is from here. Now HTML files are enabled in the user directory, but PHP files are still disabled!
Open the file
/etc/apache2/mods-enabled/php5.conf and locate these lines:
# To re-enable php in user directories comment the following lines # (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it # prevents .htaccess files from disabling it. <IfModule mod_userdir.c> <Directory /home/*/public_html> php_admin_value engine Off </Directory> </IfModule>
As the comments suggest, you need to put those five lines in comments. Then restart the web server again:
sudo /etc/init.d/apache2 restart
This tip is from here. Now it should work. If it doesn’t work, you will have to delete the browser cache! Now it should really work :)
If you get the error message “You don’t have permission to access … on this server“, then it means there is a problem with file permissions. Directories (from
public_html inwards) must have have permission 755, files 644. Make sure that
user is your user name) are also accessible! Check out this script, it sets rights correctly in your
PHP: no error messages, just a blank page
By default, PHP is configured for production, thus error messages are disabled. This is not good for development, so you will have to modify your
php.ini file a bit (located at
/etc/php5/apache2/php.ini). Find these variables and change their values:
error_reporting = E_ALL & ~E_NOTICE | E_STRICT display_errors = On
Restart Apache and you are done. This tip is from here. It is also possible to change these values from a .php file (see the code below), but it didn’t work for me on PHP5.
This line had no effect in my case:
Update: as pointed out here in a comment, this line doesn’t catch any parsing errors “because the entire script is parsed before any of it is executed”. So the best solution is to modify
php.ini. However, the following line should work from a script:
Fatal error: Maximum execution time of 30 seconds exceeded
By default, your PHP scripts shouldn’t run longer than 30 seconds, otherwise the scripts will be terminated and you get this error message. This time limit can be increased in
php.ini. Modify this variable:
; Maximum execution time of each script, in seconds ; http://php.net/max-execution-time ; Note: This directive is hardcoded to 0 for the CLI SAPI #max_execution_time = 30 # setting 3 minutes for instance: max_execution_time = 180
After this modification, don’t forget to restart Apache.
This tip is from here.
Requirements for Symfony
If you want to use Symfony, you should install these packages too (otherwise Symfony will complain):
sudo apt-get install php5-xsl sudo apt-get install php-apc
Restart Apache. Then edit
/etc/php5/apache2/php.ini and perform this modification:
# set it to "Off" value short_open_tag = Off
Symfony provides a PHP script that checks all these requirements. It can be run from the web browser and from the command line. However, the command line version uses a different
php.ini file (in my case the CLI version is located at
/etc/php5/cli/php.ini). So run
check.php in the command-line and in the browser too.
Requirements for Yii
For Yii you might need to install these packages to pass all the tests:
sudo apt-get install php5-sqlite sudo apt-get install php5-memcache sudo apt-get install php5-pgsql