Posts Tagged ‘Apache’

Flash assets like an FLV­Play­back skin will typ­i­cally be located in your pub­lic folder. How­ever, accord­ing to, “in a load­ing sce­nario, the skin SWF for the FLV­Play­back com­po­nent must be rel­a­tive to the load­ing HTML file con­tain­ing the par­ent SWF on the server, not to the loca­tion of the loaded SWF.” This is bad, since when you load a page, the URL will typ­i­cally be /:controller/:action, which means the FLV­Play­back skin URL will be /:controller/myskin.swf even if your par­ent SWF is in /public. You can ver­ify this in Fire­bug on the Net tab. The prob­lem will man­i­fest itself with a loaded Flash movie with no con­trols. You can fix this by cre­at­ing a rewrite rule in your .htac­cess file.

RewriteRule ^.*/myskin.swf$ /pathto/myskin.swf

Any request end­ing in myskin.swf will be redi­rected to /pathto/myskin.swf under the pub­lic folder.

I helped deploy a Magento store today, but the client did not have all the prod­ucts entered in the data­base, and won’t be ready to launch that part of the site for another month. So they wanted a “Com­ing Soon!” splash page to be at the sub­di­rec­tory where the store is and pass­word pro­tect every­thing else. To do that I had to recon­fig­ure the .htac­cess file.


On Ubuntu 8.10, I ran into a bit of prob­lem. The Apache web server was work­ing fine, but the fol­low­ing commands:

sudo apt-get install php5 libapache-mod-php5
sudo /etc/init.d/apache2 restart

failed to work after cre­at­ing a phpinfo.php file in the /var/www/ root folder. Fire­fox com­plained, “You have cho­sen to open phpinfo.php which is a: PHP file.” Apache was not using the PHP pre­proces­sor for some rea­son. A bunch of forum posts and blogs said to edit either /etc/apache2/httpd.conf or /etc/apache2/apache2.conf in order to asso­ciate the PHP mime type with the file exten­sion. That wouldn’t work because I had also installed php­myad­min which has an apache.conf file that already has an AddType direc­tive. So, after some dig­ging around, it turns out the mod­ule wasn’t even being loaded, even though that’s what you’d expect the pack­age man­ager to han­dle when you tell it to install the mod­ule. Any how, to fix the prob­lem, just cre­ate sym­bolic links to the php5.load and php5.conf files in the /etc/apache2/mods-enabled/ folder.

sudo ln -s /etc/apache2/mods-available/php5.load /etc/apache2/mods-enabled/php5.load
sudo ln -s /etc/apache2/mods-available/php5.conf /etc/apache2/mods-enabled/php5.conf
sudo /etc/init.d/apache2 restart

Update: Debian-based installs of Apache2 have some handy com­mand line utils for man­ag­ing the web server. So to enable a mod, which auto­mates the above, do this instead:

sudo a2enmod php5

a2dismod is the com­mand for dis­abling a mod. For sites, there is also a2ensite and a2dissite.