HostOnNet.com Forum Index HostOnNet.com
Private Label Reseller Plan
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Debian GNU/Linux installation

 
Post new topic   Reply to topic    HostOnNet.com Forum Index -> Dedicated Servers
View previous topic :: View next topic  
Author Message
admin
Site Admin


Joined: 23 Jan 2003
Posts: 256
Location: India

PostPosted: Tue Oct 25, 2005 9:05 pm    Post subject: Debian GNU/Linux installation Reply with quote

Using APT

While you can just download the PHP source and compile it yourself, using Debian's packaging system is the simplest and cleanest method of installing PHP. If you are not familiar with building software on Linux, this is the way to go.

The first decision you need to make is whether you want to install Apache 1.3.x or Apache 2.x. The corresponding PHP packages are respectively named libapache-mod-php* and libapache2-mod-php*. The steps given below will use Apache 1.3.x. Please note that, as of this writing, there is no official Debian packages of PHP 5. Then the steps given below will install PHP 4.

PHP is available in Debian as CGI or CLI flavour too, named respectively php4-cgi and php4-cli. If you need them, you'll just have to reproduce the following steps with the good package names. Another special package you'd want to install is php4-pear. It contains a minimal PEAR installation and the pear commandline utility.

If you need more recent packages of PHP than the Debian's stable ones or if some PHP modules lacks the Debian official repository, perhaps you should take a look at http://www.apt-get.org/. One of the results found should be Dotdeb. This unofficial repository is maintained by Guillaume Plessis and contains Debian packages of the most recent versions of PHP 4 and PHP 5. To use it, just add the to following two lines to your /etc/apt/sources.lists and run apt-get update :
The two Dotdeb related lines

Quote:
deb http://packages.dotdeb.org stable all
deb-src http://packages.dotdeb.org stable all


The last thing to consider is whether your list of packages is up to date. If you have not updated it recently, you need to run apt-get update before anything else. This way, you will be using the most recent stable version of the Apache and PHP packages.

Now that everything is in place, you can use the following example to install Apache and PHP:

Debian Install Example with Apache 1.3

Quote:
# apt-get install libapache-mod-php4


APT will automatically install the PHP 4 module for Apache 1.3, and all its dependencies and then activate it. If you're not asked to restart Apache during the install process, you'll have to do it manually :
Stopping and starting Apache once PHP 4 is installed

Quote:
# /etc/init.d/apache stop
# /etc/init.d/apache start


Better control on configuration

In the last section, PHP was installed with only core modules. This may not be what you want and you will soon discover that you need more activated modules, like MySQL, cURL, GD, etc.

When you compile PHP from source yourself, you need to activate modules via the configure command. With APT, you just have to install additional packages. They're all named 'php4-*' (or 'php5-*' if you installed PHP 5 from a third party repository).
Getting the list of PHP additional packages

Quote:
# dpkg -l 'php4-*'


As you can see from the last output, there's a lot of PHP modules that you can install (excluding the php4-cgi, php4-cli or php4-pear special packages). Look at them closely and choose what you need. If you choose a module and you do not have the proper libraries, APT will automatically install all the dependencies for you.

If you choose to add the MySQL, cURL and GD support to PHP the command will look something like this:
Install PHP with MySQL, cURL and GD

Quote:
# apt-get install php4-mysql php4-curl php4-gd


APT will automatically add the appropriate lines to your different php.ini (/etc/php4/apache/php.ini, /etc/php4/cgi/php.ini, etc).
These lines activate MySQL, cURL and GD into PHP

Quote:
extension=mysql.so
extension=curl.so
extension=gd.so


You'll only have to stop/start Apache as previously to activate the modules.

Common Problems

If you see the PHP source instead of the result the script should produce, APT has probably not included /etc/apache/conf.d/php4 in your Apache 1.3 configuration. Please ensure that the following line is present in your /etc/apache/httpd.conf file then stop/start Apache:
This line activates PHP 4 into Apache

Quote:
# Include /etc/apache/conf.d/


If you installed an additional module and if its functions are not available in your scripts, please ensure that the appropriate line is present in your php.ini, as seen before. APT may fail during the installation of the additional module, due to a confusing debconf configuration.
_________________
HostOnNet.com - Reseller Hosting
Free Ads Forum, Promote your site
NetFreeHost.com - Free Web Hosting, phpBB Hosting
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
snapple



Joined: 10 Feb 2006
Posts: 1

PostPosted: Fri Feb 10, 2006 2:37 am    Post subject: how to configure websites on server to use php.cgi Reply with quote

This article was very interesting to me but didn't quite go as far as I needed it to go in order to answer my own questions about setting up and using php4-cgi, so I will elaborate.

My current setup:
- Debian 3.1
- Apache 1.3 running Php 4.4.2-1 with Zend Engine v1.3.0
- Default user/group for Apache is www-data
- Server currently hosting about 30 websites

My big concern in that my system is currently using the php module loaded by apache to maintain php calls used by all the websites on server right now as www-data. In other words, any request made by any website on the server to php right now is received and processed as www-data and when files need to be written back to the server because it's in the script it's being saved as the wrong user.

Here's a look at the current way I've setup an entry in the httpd.conf file:
Code:
<VirtualHost 66.154.97.195:80>
        ServerAdmin info@travelagentsoftware.com
        DocumentRoot /var/www/travelagentsoftware.com/www
        ServerName travelagentsoftware.com
        ServerAlias www.travelagentsoftware.com
       
        User modus
        Group migroup

        ErrorLog /var/www/travelagentsoftware.com/_logs/www/error.log
        CustomLog /var/www/travelagentsoftware.com/_logs/www/access.log full

        <Directory /var/www/travelagentsoftware.com/www>
                Options IncludesNOEXEC MultiViews FollowSymLinks
                AllowOverride None AuthConfig FileInfo Limit

                <Limit GET POST OPTIONS PROPFIND>
                        Order allow,deny
                        Allow from all
                </Limit>
                <Limit PUT DELETE PATCH PROPPATCH MKCOL COPY MOVE LOCK UNLOCK>
                        Order deny,allow
                        Deny from all
                </Limit>
        </Directory>
        <Directory /var/www/travelagentsoftware.com/www/cgi-bin>
                AllowOverride None
                Options ExecCGI
                Order allow,deny
                Allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /var/www/travelagentsoftware.com/www/cgi-bin/

        RewriteEngine On
        RewriteCond %{HTTP_HOST} !^travelagentsoftware\.com$ [NC]
        RewriteCond %{HTTP_HOST} !^www\.travelagentsoftware\.com$ [NC]
        RewriteRule ^(.*) http://travelagentsoftware\.com$1 [R=301,L]
        RewriteRule ^/admin/(.*) https://secure.travelagentsoftware.com/admin/ [R,L]
</VirtualHost>


So my questions are:
- How do I configure my virtual host statement to use a copy of the php.ini and php.cgi I have stored in the websites cgi-bin?
- Should the php.cgi be set up as a symlink instead to a common php.cgi that only has to be updated once to bring all sites on the server up to date at the same time or would this be a bad move potentially?
- What should the ownership and privileges be set to?
- Is this something that has to be done for the whole machine at the same time or can I set this up for individual sites, testing it while the other sites continue to work the way they are?

Thanks for any help you can give me.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    HostOnNet.com Forum Index -> Dedicated Servers All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group. Hosted by phpBB.BizHat.com


For Support - http://forums.BizHat.com

Free Web Hosting | Free Forum Hosting | FlashWebHost.com | Image Hosting | Photo Gallery | FreeMarriage.com

Powered by PhpBBweb.com, setup your forum now!