вторник, 4 февраля 2014 г.

Apache + mysql + php + CentOS

Install mysql.

<?php
$host = "127.0.0.1";
$name = "admin";
$pwd = "pwd";

$connect = @mysql_connect($host,$name,$pwd);
echo "ok";
?>
Clear screen.

yum install php-mysql php-gd php-imap php-ldap php-odbc 
service httpd restart


понедельник, 3 февраля 2014 г.

Centos apache + perl + python

1. vi /etc/httpd/conf/httpd.conf

Search
     # AddHandler cgi-script
Replace on
     AddHandler cgi-script .cgi .py .pl

Search
 <Directory "/var/www/html">
# The Options directive is both complicated and important.  Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Add
     Options +ExecCGI

Then 
service httpd restart

2. cd /var/www/html/
    vi helloperl.pl 
Add 
   #!/usr/bin/perl
   print "Content-type: text/html\n\n";
   print "Perl hello";

   vi hellopython.py
Add
  #!/usr/bin/env python
  # -*- coding: UTF-8 -*-

  # enable debugging
  import cgitb
  cgitb.enable()

  print "Content-Type: text/plain;charset=utf-8"
  print

  print "Hello World!"


  Then
   chmod +x helloperl.pl
   chmod +x hellopython.pl
Go to http://mysite/helloperl.pl
Go to http://mysite/hellopython.pl