Custom PHP configuration, Drupal, Drush, and Upload Progress all in one shot


#1

I wrote this shell script to automate the
[list]
[]Installation of a custom PHP.ini configuration
[
]Installation of Drupal
[]Installation of Drush (the command-line tool for Drupal), and
[
]The installation of the Upload Progress module that Drupal is always bugging you about
[/list]
You should be able to use it by doing the following:
[list]
[]Copy the code below and save it to a file called installthemall.sh
[
]Log in to your FTP account (I prefer using WinSCP on Windows, because it will log you in with PuTTY as well regular FTP)
[]Upload installthemall.sh to your server
[
]Open PuTTY and type sh installthemall.sh
[/list]
Note: this assumes you want to install Drupal 7.7 (which is currently the latest version). To change that, find/replace drupal-7.7 with whichever version you wish to install.

#!/bin/sh
export PATH=/usr/local/php53/bin:$PATH
wget http://pecl.php.net/get/uploadprogress -O uploadprogress-1.0.2.tgz &
wait
tar -zxvf uploadprogress-1.0.2.tgz &
wait
cd uploadprogress-1.0.2
phpize &
wait
./configure --with-php-config=/usr/local/php53/bin/php-config &
wait
make &
wait
mkdir $HOME/.php &
wait
mkdir $HOME/.php/5.3 &
wait
cp ./modules/uploadprogress.so $HOME/.php/5.3/
echo "extension = $HOME/.php/5.3/uploadprogress.so" > $HOME/.php/5.3/phprc &
wait
killall php53.cgi &
wait
mkdir $HOME/cgi-bin &
wait
cp /etc/php53/php.ini $HOME/cgi-bin/php.ini &
wait
chmod 755 $HOME/cgi-bin
cat << EOF > $HOME/cgi-bin/php-wrapper.fcgi
#!/bin/sh
exec /dh/cgi-system/php53.cgi $*
EOF
wait
chmod 755 $HOME/cgi-bin/php-wrapper.fcgi
chmod 640 $HOME/cgi-bin/php.ini
export PHP_CONFIG_FILE_PATH=$HOME/cgi-bin
cd $HOME/
wget http://ftp.drupal.org/files/projects/drupal-7.7.tar.gz &
wait
tar -xz --directory="." -f "drupal-7.7.tar.gz" &
wait
wget http://ftp.drupal.org/files/projects/drush-7.x-4.4.tar.gz &
wait
tar -xz --directory="." -f "drush-7.x-4.4.tar.gz" &
wait
ln -s $HOME/cgi-bin $HOME/drupal-7.7/cgi-bin &
wait
echo "alias drush="$HOME"/drush/drush" >> $HOME/.bashrc &
wait
rm drupal-7.7.tar.gz
rm drush-7.x-4.4.tar.gz
rm uploadprogress-1.0.2.tgz
echo '

=========================== ALMOST DONE... ====================================

One more thing to do though: add the following 4 lines to the VERY TOP 
of the file called ".htaccess":

Options +ExecCGI
AddHandler php5-cgi .php
Action php-cgi /cgi-bin/php-wrapper.fcgi
Action php5-cgi /cgi-bin/php-wrapper.fcgi

Good luck!'

#2

You’re taking an incredibly roundabout method to customize your php.ini. There’s a much simpler method described at:


#3

Yeah – that’s where I got a line or two of the code from, actually. As the post says at the top though, this script is for
[list]
[]Installation of a custom PHP.ini configuration
[
]Installation of Drupal
[]Installation of Drush (the command-line tool for Drupal), and
[*]The installation of the Upload Progress module that Drupal is always bugging you about
[/list]
[size=small][align=right]*Most significantly[/align][/size]


#4

Even for that, you don’t need to use a custom .htaccess / php-wrapper.fcgi setup for PHP 5.3. You can set up a custom PHP.ini by just dropping the configuration in $HOME/.php/5.3/php.ini — the default PHP interpreter will read a configuration from there if one is present.


#5

I cannot get this extension to work. When I switch to PHP 5.3, I can get the extension loaded(phpinfo() shows 1.0.2 enabled) but no read out(I have disabled the Extra Web Security). Under PHP 5.2.17, I can force it to read from my php.ini file($HOME/example.com/cgi-bin/php.ini) but it will not load the extension. I have extension_dir = “/home/myuser/mydomain/cgi-bin” and extension=uploadprogress.so but it never shows up in the phpinfo(). Any ideas?