Changing Plesk Fast CGI to Apache PHP with ZF
So recently I’ve had to change the php mode from Fast CGI to Apache Module in plesk due to the http authenticate functions in php not working. This caused my Zend Framework website to produce a 500 error, in my case it was something to do with:
Fatal error: Uncaught exception 'Zend_Session_Exception' with message 'session has already been started by session.auto-start or session_start()
The reason for the error is that the session already existed from my first visit and CGI was the owner, when I changed it to Apache module apache did not have permission to change the session data. The solution, shut down your browser (or start a privacy mode) and then try and view your website. Everything should work fine afterwards.
How to Enable SSL on Xampp with Vhosts
If you need to enable SSL on Xampp whilst stilling using vhosts, follow the next few steps. It assumes that you already have vhosts enabled.
Open xampp/apache/conf/extra/httpd-vhosts.conf
Around line 19 you should see “NameVirtualHost *:80″, below this line add “NameVirtualHost *:443″ (without quotes)
Then add a new vhost site just like a normal one but with *443 instead on *80 and the following lines:
SSLEngine on SSLCertificateFile conf/ssl.crt/server.crt SSLCertificateKeyFile conf/ssl.key/server.key
An example of this is:
DocumentRoot "C:/xampp/htdocs/myproject/public" ServerName mysite.local ServerAlias mysite.local SSLEngine on SSLCertificateFile conf/ssl.crt/server.crt SSLCertificateKeyFile conf/ssl.key/server.key
Restart Xampp apache and everything should work fine.
Installing LAMP on Ubuntu
So I been getting rather annoyed with CentOs recently, mainly due to the lack of PHP support above 5.1.6, especially with all the cool features of 5.3. Also I always seem to have massive trouble installing anything like Mcypt or Memcache.
So I thought I’d give Ubuntu a go and I’m now a convert! Everything went smoothly, not one issue or problem. The support forums are brilliant and almost all questions have already been answered. I dont know whether I’ve just got lucky (I guess only time will tell) but Ubuntu is now my first port of call when setting up a new server.
Below is a line by line tutorial on how I got setup with Ubuntu 10.04 Lucid. I don’t go into too much details on how to edit the files using nano or vi but you can have a look on my previous posts or online, otherwise you can sftp in using root and change the files that way, (my preferred method).
Install Lamp on Ubuntu
sudo tasksel install lamp-server You will need to enter a root mysql password for mysql
Change Apache Default Web Location on Ubuntu
If you need to change the default root location from /var/www to something else you can do so in the following file location. This is useful for using frameworks such as Zend Framework.
/etc/apache2/sites-available/default
Create file and add Fully Qualified Domain Name to Apache config (auto adds all in conf.d)
Create a new file call fqdn in:
/etc/apache2/conf.d/
In the top of the file write the following where mydomain.com is the domain name pointing to this server.
servername mydomain.com
Enable mod_rewrite on Ubuntu
a2enmod rewrite
Edit “AllowOverride None” for default site (usually the first 2 found on line 4 and line 10). Change to the following
AllowOverride All
Found in:
/etc/apache2/sites-available/default
Disable Directory Listing on Ubuntu
Inside: /etc/apache2/sites-available/default Add "-" before the word IndexesOptions -Indexes
Restart Apache on Ubuntu
sudo /etc/init.d/apache2 restart
Install Memcached on Ubuntu
apt-get install memcached apt-get install php5-memcache
Install Mcrypt on Ubuntu
sudo apt-get install php5-mcrypt
Install APC on Ubuntu
apt-get install php-apc /etc/init.d/apache2 restart
When you get erros you need to type
apt-get install re2c apt-get install gawk
Restart Apache
sudo /etc/init.d/apache2 restart
Other Useful Info on Ubuntu
PHP.ini Location in Ubuntu
/etc/php5/apache2/php.ini
Enable mod_rewrite in xampp
For some reason my install of XAMPP didn’t have mod_rewrite automatically enabled? Not really sure why but basically below are the instructions on how to enable .htaccess mod_rewrite in xampp.
1. Go to the directory of installation <C:\xampp>\apache\conf
2. Open and edit httpd.conf in a text editor
3. Find the line which contains
#LoadModule rewrite_module modules/mod_rewrite.so
and (uncomment) change to
LoadModule rewrite_module modules/mod_rewrite.so
4. Find all occurrences of
AllowOverride None
and change to
AllowOverride All
I think it appears 2 or 3 times on the configuration file.
5. Restart xampp
That’s it you should be good to go.
How to edit php.ini from ssh
Type:
1. “cd /etc”
2. “ls”
Check that there is the php.ini listed if not you will have to ask your hosting provider where it is.
3. “vi php.ini”
Find the bit in php.ini you would like to edit.
4. “i” – This enables you to edit the php.ini file
5. After changing the file, please Esc.
6: “:wq” – (w = saves the file, q = quit)
7. reboot your server and your done.
Recent Posts
- How to get environment in Symfony2
- How to make a Symfony2 Twig Extension
- How to ipconfig/flush dns on Mac OSX
- Diary of a Startup: Create a startup for £14
- Sendmail on Ubuntu
- Adobe Air with Netbeans
- Best Firefox Plugins for SEO aka Addons
- Setup Ubuntu as a Web Server
- Changing Plesk Fast CGI to Apache PHP with ZF
- How to Access PUT data in Zend Framework
My External Links
Twitter Updates
- What I do when my mum calls me for help using her computer xkcd.com/627/ via @neil_pie 1 day ago
- Fancy this? @bwaine @WillBooth Hackathon London #hackldn - An Event for developers and Startups hackathonlondon.com via @hackathonldn 1 day ago
- New Kings Cross, much much better @ Kings Cross St Pancras New Departures Hall instagr.am/p/KAi6iNs_-6/ 2 days ago
- Cine: Ed and Rob cinemagr.am/show/5227880 #cinemagraph #gif 3 days ago
- The 8 Signs That You Have an Extraordinary Boss inc.com/geoffrey-james… 4 days ago
- How Social Media Is Taking Over the News Industry [INFOGRAPHIC] mashable.com/2012/04/18/soc… via @mashable 1 week ago
- UK's largest water feature. Cost £24.4m in Bradford @ City Park instagr.am/p/JuaRBxs_yK/ 1 week ago
- RT @lucywardleeds: Hilarious! Newcastle got our score wrong and have reported winning the title nufc.co.uk/articles/20120… @ed_liddell 1 week ago
- Zombie google maps fastcodesign.com/1669550/zombie… 1 week ago
- The worst names for variables in code petdance.com/2012/04/the-wo… 1 week ago
Archives
- April 2012
- March 2012
- January 2012
- December 2011
- November 2011
- September 2011
- August 2011
- June 2011
- May 2011
- March 2011
- February 2011
- December 2010
- November 2010
- October 2010
- September 2010
- August 2010
- July 2010
- June 2010
- March 2010
- February 2010
- January 2010
- November 2008
- September 2007
- June 2007
- May 2007
- April 2007




