Home arrow PHP arrow Page 4 - Executing Microsoft SQL Server Stored Procedure from PHP on Linux
PHP

Executing Microsoft SQL Server Stored Procedure from PHP on Linux


Learn how to setup, install and configure Apache and PHP on a Linux box to execute MS SQL stored procedures. This extensive article takes you through an in-depth look on how to achieve your ideal environment.

Author Info:
By: Jack Zhang
Rating: 4 stars4 stars4 stars4 stars4 stars / 32
October 20, 2003
TABLE OF CONTENTS:
  1. · Executing Microsoft SQL Server Stored Procedure from PHP on Linux
  2. · Preparation
  3. · Installing the Apache Web Server
  4. · Installing the Apache Web Server, Cont'd
  5. · Installing FreeTDS
  6. · Modify the PHP Source Code
  7. · Modify the PHP Source Code, Cont'd
  8. · Executing MS SQL Server Procedures from PHP
  9. · Conclusion

print this article
SEARCH DEVARTICLES

Executing Microsoft SQL Server Stored Procedure from PHP on Linux - Installing the Apache Web Server, Cont'd
(Page 4 of 9 )

In a real production environment, we would like Apache running as a service, meaning that whenever our machine starts-up, these services will startup automatically.  Copy and paste the following script and save it as httpd in the /etc/init.d folder.

#!/bin/bash
#
# Startup script for the Apache Web Server
#
# chkconfig: - 85 15
# description: Apache is a World Wide Web server.  It is used to serve \
#        HTML files and CGI.
# processname: httpd
# pidfile: /var/run/httpd.pid
# config: /usr/local/apache2/conf/httpd.conf

# Source function library.
. /etc/rc.d/init.d/functions


# This will prevent initlog from swallowing up a pass-phrase prompt if
# mod_ssl needs a pass-phrase from the user.
INITLOG_ARGS=""

# Path to the Apachectl script, server binary, and short-form for messages.
apachectl=/usr/local/apache2/bin/apachectl
httpd=/usr/local/apache2/bin/httpd
prog=httpd
RETVAL=0


# The semantics of these two functions differ from the way Apachectl does
# things -- attempting to start while running is a failure, and shutdown
# when not running is also a failure.  So we just do it the way init scripts
# are expected to behave here.
start() {
        echo -n $"Starting $prog: "
        daemon $httpd $OPTIONS
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && touch /var/lock/subsys/httpd
        return $RETVAL
}
stop() {
 echo -n $"Stopping $prog: "
 killproc $httpd
 RETVAL=$?
 echo
 [ $RETVAL = 0 ] && rm -f /var/lock/subsys/httpd /var/run/httpd.pid
}
reload() {
 echo -n $"Reloading $prog: "
 check13 || exit 1
 killproc $httpd -HUP
 RETVAL=$?
 echo
}

# See how we were called.
case "$1" in
  start)
 start
 ;;
  stop)
 stop
 ;;
  status)
        status $httpd
 RETVAL=$?
 ;;
  restart)
 stop
 start
 ;;
  condrestart)
 if [ -f /var/run/httpd.pid ] ; then
  stop
  start
 fi
 ;;
  reload)
        reload
 ;;
  graceful|help|configtest|fullstatus)
 $Apachectl $@
 RETVAL=$?
 ;;
  *)
 echo $"Usage: $prog {start | stop | restart | condrestart | reload | status | fullstatus | graceful | help | configtest}"
 exit 1
esac

exit $RETVAL

Then issue the following command:

chkconfig httpd --level 345 on

This will set Apache to start on Linux level 3 4 and 5 automatically   (by default, Red Hat is running on level 5 with X windows, most production machines will choose level 3, without GUI).

Reboot the machine; you can test it in the browser, now Apache web server starts up automatically with the machine reboot.


blog comments powered by Disqus
PHP ARTICLES

- Removing Singletons in PHP
- Singletons in PHP
- Implement Facebook Javascript SDK with PHP
- Making Usage Statistics in PHP
- Installing PHP under Windows: Further Config...
- File Version Management in PHP
- Statistical View of Data in a Clustered Bar ...
- Creating a Multi-File Upload Script in PHP
- Executing Microsoft SQL Server Stored Proced...
- Code 10x More Efficiently Using Data Access ...
- A Few Tips for Speeding Up PHP Code
- The Modular Web Page
- Quick E-Commerce with PHP and PayPal
- Regression Testing With JMeter
- Building an Iterator with PHP

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials