lamp technology


Published on

1 Comment
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

lamp technology

  2. 2. LAMP TECHNOLOGY <ul><li>L A M P is an acronym for a solution stack of free, open source software, originally coined from the first letters of
  3. 3. Linux (operating system),
  4. 4. Apache HTTP Server,
  5. 5. MySQL (database software) and
  6. 6. PHP. </li></ul>
  7. 7. <ul><li>Linux
  8. 8. Unix-like computer operating system ,open-source software where source code is provided with operating system, which can be edited according to specific needs.
  9. 9. Apache
  10. 10. free software/open source web server </li></ul>
  11. 11. <ul><li>MySQL
  12. 12. multithreaded, multi-user, SQL database management system
  13. 13. PHP
  14. 14. reflective programming language originally designed for producing dynamic web pages </li></ul>
  15. 15. ADVANTAGES OF LAMP <ul><li>Easy to code with PHP and MySQL.
  16. 16. Easy to deploy a PHP app. Once you’ve got MySQL running, simply upload your .php files.
  17. 17. Develop locally
  18. 18. Cheap and ubiquitous hosting </li></ul>
  19. 19. INSTALLATION OF LAMP <ul><li>Download latest version of xampp for linux.
  20. 20. Extract the downloaded archive file to /opt :
  21. 21. tar xvfz xampp-linux-1.7.3a.tar.gz -C /opt
  22. 22. start XAMPP simply calling the command :
  23. 23. /opt/lampp/lampp start
  24. 24. Test by typing in the following URL at web browser : http://localhost </li></ul>
  26. 26. WHAT IS LINUX? <ul><li>It is an operating system.
  27. 27. It is designed for to provide personal computer users a free or at very low-cost .
  28. 28. It has a reputation as a very efficient & fast performing systems.
  29. 29. Linux was developed by Linux Torvalds at the University of Helsinki in Finland. </li></ul>
  30. 30. WHY WE ARE USING LINUX? <ul><li>We dont have to buy the office system requirements separately.
  31. 31. No need to buy costly hardwares for the basic need(like RAM,Processor).
  32. 32. We are free from viruses no need to buy the antivirus softwares separately.. </li></ul>
  33. 33. WHY WE ARE USING LINUX? Continue.. <ul><li>We can update everthing on our system with just one update manager.
  34. 34. It is free from pirated software so that we can share it with others is legal.
  35. 35. It wont get slow like windows operating system.
  36. 36. It upgrades all installation automatically. </li></ul>
  37. 37. ADVANTAGES: <ul><li>Cost.
  38. 38. Security.
  39. 39. Choice(freedom).
  40. 40. Software.
  41. 41. Hardware. </li></ul>
  42. 42. DISADVANTAGES: <ul><li>Understanding.
  43. 43. Compatibility.
  44. 44. Alternative Programs. </li></ul>
  45. 45. BASIC LINUX COMMANDS: 1. Show who is logged on and what they are doing. $ w 2.Show who is logged on. $ who
  46. 46. 3.Create empty file of 0 byte $ touch 4.Remove file $ rm 5. List files. $ ls
  47. 47. 6. Create/Make a new directory. $ mkdir 7. Clear the terminal screen. $clear 8.Display information on free used memory. $ free
  48. 48. 9.Check current date and time. $ date 10.Compare two files. $ cmp file1 file2 11.To save and exit. Ctrl -d
  49. 49. 12.Short listing of directory contents $ls - <ul><li>-a list hidden files.
  50. 50. -d list the name of the current directory.
  51. 51. -F show directories with a trailing '/'
  52. 52. executable files with a trailing '*'.
  53. 53. -t sort by time modified instead of name. </li></ul>
  54. 54. Short listing of directory contents $ls- continue.. <ul><li>-g show group ownership of file in long listing
  55. 55. -i print the inode number of each file
  56. 56. -l long listing giving details about files and directories </li></ul>
  57. 57. 13.Prints a calendar for the specified month of the specified year. $cal month year 14.It will show you the full path to the directory you are currently in. $pwd ( print working directory)
  58. 58. 15.Type mv followed by the current name of a directory and the new name of the directory. $mv( change the name of a directory)
  60. 60. LINUX DIRECTORIES: < / > <ul><li>The root directory where the Linux system begins contains only subdirectories. .
  61. 61. The starting point of your directory structure.
  62. 62. Every other file and directory on system is under the root directory. </li></ul>
  63. 63. <ul>< /boot > <li>The place where Linux keeps information that it needs when booting up.
  64. 64. < /bin >
  65. 65. It contains the most important programs that the system needs to operate, such as the shells, ls, grep, and other essential things. </li></ul>
  66. 66. <ul>< /usr/bin > <li>/usr/bin in turn contains applications for the system's users.
  67. 67. < /dev >
  68. 68. The devices that are available to a Linux system. </li></ul>
  69. 69. <ul>< /etc > <li>The configuration files for the Linux system.
  70. 70. Most of these files are text files and can be edited by hand.
  71. 71. < /home >
  72. 72. This is where users keep their personal files are allowed to write files. </li></ul>
  73. 73. <ul>< /lib > <li>The shared libraries for programs that are dynamically linked.
  74. 74. < /mnt >
  75. 75. This directory is used for mount points.
  76. 76. < /sbin, /usr/sbin >
  77. 77. Most system administration programs are stored in these directories. </li></ul>
  78. 78. <ul>< /usr > <li>It contains user applications and source codes, and pictures, docs, or config files .
  79. 79. </usr/share>
  80. 80. Config files and graphics for many user apps.
  81. 81. < /usr/local >
  82. 82. This is where you install apps and other files for use on the local machine. </li></ul>
  83. 83. SOME OF THE LINUX EDITORS <ul><li>ed - Original UNIX line-based editor, useful in scripts
  84. 84. emacs - GNU editor and fully integrated user environment
  85. 85. ex - Powerful line-based editor (integrated with vi) </li></ul>
  86. 86. SOME OF THE LINUX EDITORS continue.. <ul><li>gawk - GNU awk, powerful text editor for records containing fields.
  87. 87. sed - Stream-oriented (non- interactive) line-based editor
  88. 88. vi - Classic screen-based editor for UNIX
  89. 89. vim - Vi IMproved, enhanced support for programmers </li></ul>
  90. 90. CRONTAB & CRONJOB <ul><ul><li>The term cron is derived from the word chronograph .
  91. 91. The Cron, at, batch Command is used for Scheduling Execution of Command according to requirements.
  92. 92. Cron is a system deamon that keeps sleeping most of the time. </li></ul></ul>
  93. 93. CRONTAB & CRONJOB continue.. <ul><ul><li>I t typically wakes up every one minute and checks it crontab file for any jobs to be executed during this minute.
  94. 94. The name of this crontab file will be the user's login name . </li></ul></ul>
  95. 95. CRONTAB & CRONJOB continue.. <ul><li>The Scheduled jobs will be present in the Crontab files .
  96. 96. Cron tab files will be present in the
  97. 97. /var/ spool/ cron/ crontabs directory .
  98. 98. It Should be executed periodically at a specific day, date and time . </li></ul>
  99. 99. <ul>APACHE ( HTTP SERVER ) </ul>
  100. 100. WHAT IS APACHE? <ul><li>An open source web server used mostly for Unix, Linux and Solaris platforms.
  101. 101. It is very secure, fast, and reliable.
  102. 102. The name &quot;Apache&quot; derives from the word &quot;patchy&quot; that the Apache developers used to describe early versions of their software. </li></ul>
  103. 103. <ul>IMPLEMENTATION: <li>DBM databases for authentication
  104. 104. Customized responses to errors and problems
  105. 105. Virtual Hosts
  106. 106. Multiple DirectoryIndex directives
  107. 107. It has been tested thoroughly by both developers and users. </li></ul>
  108. 108. APACHE WEB SERVER <ul><li>It provides a full range of Web server features, including CGI, SSL, and virtual domains.
  109. 109. Apache also supports plug-in modules for extensibility. </li></ul>
  110. 110. <ul><li>The Apache Web Server has
  111. 111. HTTP
  112. 112. IIS
  113. 113. SSL
  114. 114. The Apache Web server has been ported to Windows and other network operating systems (NOS). </li></ul>
  115. 115. HTTP <ul><li>HTTP is an Hypertext Transfer Protocol.
  116. 116. It provides a standard for Web browsers and servers to communicate.
  117. 117. It is a technical specification of a network protocol that software must implement.
  118. 118. HTTP is an application layer network protocol built on top of TCP. </li></ul>
  119. 119. <ul><li>HTTP clients (such as Web browsers) and servers communicate via HTTP request and response messages.
  120. 120. The three main HTTP message types are
  121. 121. GET, POST, and HEAD.
  122. 122. HTTP utilizes TCP port 80 by default. </li></ul>
  123. 123. *Though other ports such as 8080 can alternatively be used. *The HTTP also includes. ARP-(Address Resolution Protocol) <ul>DHCP-(Dynamic Host Configuration Protocol) FTP(File Transfer Protocol) </ul>
  124. 124. <ul>ARP <li>ARP converts an Internet Protocol ( IP ) address to its corresponding physical network address.
  125. 125. It is implemented in the device drivers of network operating systems .
  126. 126. It is most commonly seen on Ethernet networks, ATM, Token Ring , and other physical networks . </li></ul>
  127. 127. <ul>DHCP <li>DHCP allows a computer to join an IP -based network without having a pre-configured IP address.
  128. 128. DHCP is a protocol that assigns unique IP addresses to devices, then releases and renews these addresses as devices leave and re-join the network. </li></ul>
  129. 129. FTP <ul><li>FTP allows you to transfer files between two computers on the Internet.
  130. 130. FTP is a simple network protocol based on Internet Protocol. </li></ul>
  131. 131. SSL <ul><li>Secure Sockets Layer.
  132. 132. SSL security technology helps to improve the safety of Internet communications.
  133. 133. SSL is a standard for encrypted client/server communication between network devices.
  134. 134. A network protocol, SSL runs on top of TCP/IP. </li></ul>
  135. 135. CONFIGURATION Instead of using a point-and-click graphic user interface (GUI) or Windows Registry keys as most other modern software packages, Apache generally relies on simple text files for its configuration settings.
  136. 136. CONFIGURING FILES <ul><li>It uses a system text files for managing its configuration data.
  137. 137. These files appear in Apache's ./conf directory and are designed to be edited by system administrators:
  138. 138. httpd.conf for general settings
  139. 139. srm.conf for resource settings
  140. 140. access.conf for security settings </li></ul>
  141. 141. RUNNING APACHE <ul><li>Apache does not run from the inetd super server as many other network servers do.
  142. 142. It is configured to run standalone for better performance for incoming HTTP requests from client web browsers. </li></ul>
  143. 143. RUNNING APACHE continue.. <ul><li>A shell script wrapper is included to make starting, stopping, and restarting the server as simple as possible.
  144. 144. To start up Apache for the first time, just run:
  145. 145. # /usr/local/sbin/apachectl start </li></ul>
  146. 146. RUNNING APACHE continue.. <ul><li>You can stop the server at any time by typing:
  147. 147. # /usr/local/sbin/apachectl stop
  148. 148. After making changes to the configuration file for any reason, you will need to restart the server:
  149. 149. # /usr/local/sbin/apachectl restart </li></ul>
  150. 150. RUNNING APACHE continue.. <ul><li>To restart Apache without aborting current connections, run:
  151. 151. # /usr/local/sbin/apachectl graceful </li></ul>
  152. 152. <ul><li>The family of .conf files supports most,
  153. 153. but not all of Apache's configuration options.
  154. 154. Other important mechanisms for managing an Apache Web server include the
  155. 155. .htaccess file, the mime.types file,
  156. 156. and the family of log files . </li></ul>
  158. 158. WHAT IS MySQL? <ul><li>The most popular open source SQL database management system.
  159. 159. It is used to add,access and process data stored in a computer database.
  160. 160. It is a RDBMS store in a separate tables rather than putting all the data in one big store room.It adds speed and flexibility. </li></ul>
  161. 161. <ul><li>It is very fast,reliable and easy to use,
  162. 162. due to the connectivity,speed ,security.
  163. 163. It works in Client/Server or embedded system.
  164. 164. A large amount of contributed MySQL software is available. </li></ul>WHAT IS MySQL? continue..
  165. 165. WHAT IS MySQL? continue.. <ul>It consists of multithreaded SQL server that support: <li>Different backends,
  166. 166. Several different client programs,
  167. 167. Libraries,
  168. 168. Administration tools,
  169. 169. Wide range of API's. </li></ul>
  170. 170. WHY WE ARE USING MYSQL? <ul><li>It is free .
  171. 171. It is fast comparing to other Database system such as PostgreSQL,mSQL.
  172. 172. It is light weight yet offers a rich and highly useful function set.
  173. 173. It is supported well by users community. </li></ul>
  174. 174. BASIC QUERIES <ul><li>CREATE Command - is used to create a database/table.
  175. 175. SELECT Command - is used to retrieve data from the database.
  176. 176. DELETE Command - is used to delete data from the database. </li></ul>
  177. 177. BASIC QUERY COMMANDS IN MySQL continue.. <ul><li>INSERT Command - is used to insert data into a database.
  178. 178. UPDATE Command - is used to update the data in a table.
  179. 179. DROP Command - is used to delete or drop the database/table. </li></ul>
  180. 180. SYNTAX FOR QUERY COMMANDS 1. CREATE Command : The Create command is used to create a table by specifying the tablename, fieldnames and constraints as shown below: Syntax: $createSQL=(&quot;CREATE TABLE tblName&quot;);
  181. 181. 2. SELECT Command : It is used to select the records from a table using its field names, '*' is used to select all the fields in a table. Syntax: $selectSQL=(&quot;SELECT field_names FROM tablename&quot;);
  182. 182. 3 .DELETE Command : The Delete command is used to delete the records from a table using conditions as shown below: Syntax: $deleteSQL=(&quot;DELETE * FROM tablename WHERE condition&quot;);
  183. 183. 4. INSERT Command : The Insert command is used to insert records into a table. The values are assigned to the field names as shown below: Syntax: $insertSQL=(&quot;INSERT INTO tblname(fieldname1,fieldname2..) VALUES(value1,value2,...) &quot;);
  184. 184. 5. UPDATE Command : It is used to update the field values using conditions. This is done using 'SET' and the fieldnames to assign new values to them. Syntax: $updateSQL=(&quot;UPDATE Tblname SET (fieldname1=value1,fieldname2=value2,...) WHERE fldstudid=IdNumber&quot;);
  185. 185. 6. DROP Command: The Drop command is used to delete all the records in a table using the table name as shown below: Syntax: $dropSQL=(&quot;DROP tblName&quot;);
  186. 186. ADVANCED QUERIES <ul><li>INNER JOIN :
  187. 187. It is used to retrieve the data from all tables listed.
  188. 188. REPLACE:
  189. 189. It searches a character string and replaces characters found in search string. </li></ul>
  190. 190. <ul><li>LTRIM :
  191. 191. It removes any leading (left-hand) spaces in a character string.
  192. 192. RTRIM :
  193. 193. It works like LTRIM, but it removes trailing spaces. </li></ul>
  194. 194. <ul><li>SIGN :
  195. 195. It takes in a numeric expression and returns one of the following values based on the sign of the input number:
  196. 196. − 1 - Input number is negative.
  197. 197. 0 - Input number is zero.
  198. 198. 1 - Input number is positive.
  199. 199. Null - Input number is null. </li></ul>
  200. 200. <ul><li>SQRT :
  201. 201. It takes in a single numeric expression and returns its square root.
  202. 202. CEILING (CEIL) :
  203. 203. It rounds up to the next nearest whole number.
  204. 204. F LOOR :
  205. 205. It rounds down to the next nearest whole number. </li></ul>
  206. 206. <ul>DATE and TIME : <li>ADD_MONTHS :
  207. 207. Adds the supplied number of months to the supplied date.
  208. 208. CURRENT_DATE :
  209. 209. Returns the current date in the time zone set for the DB session. </li></ul>
  210. 210. EXTRACT : Extracts the specified date field from the supplied date. LAST_DAY : Returns of supplied date with the day shifted to the last day of the month.
  211. 211. PROCEDURES AND FUNCTIONS <ul>Subroutines and functions can be made available to a single program or many; and that, of course, is what stored procedures and stored functions are - they are procedures (or subroutines) and functions stored in the database . </ul>
  212. 212. WHY USE PROCEDURES AND FUNCTIONS? The real advantage to using stored procedures and stored functions is that they provide functionality which is platform and application independant.
  213. 213. WHY USE PROCEDURES & FUNCTIONS? continue.. For example, a team of developers may provide: a Visual Basic application on Windows <ul><li>a Gambas application on Linux
  214. 214. a PHP application on a web server </li></ul>With procedures and functions the functionality only has to be developed once.
  215. 215. CREATING MySQL PROCEDURES A stored procedure is the same as a subroutine in that it cannot directly return a result, however it can receive variables that can be modified by the procedure.
  216. 216. <ul>These variables are defined as: <li>in - the variable can only be used as an input to the procedure.
  217. 217. out - the variable can only be used as an output from the procedure.
  218. 218. inout - this is both an input to, and an output from, the procedure. </li></ul>
  219. 219. Procedures are always declared as: <ul>Define the procedure name, inputs and outputs,body of the procedure. For example: delimiter // </ul>create procedure circle_area (in r double, out a double) begin set a = r * r * pi(); end //delimiter ;
  220. 220. RUNNING MySQL PROCEDURES <ul><li>A MySQL stored procedure is run by using the call method:
  221. 221. call circle_area(22, @a) ;
  222. 222. select @a ;
  223. 223. In this example 1520.5308443375 would be displayed on the screen. </li></ul>
  224. 224. CREATING MYSQL FUNCTIONS Unlike stored procedures stored functions always return a result, they will also be one of two types : <ul><li>not deterministic - may produce different results for the same inputs .
  225. 225. deterministic - will always produce the same result for any given inputs </li></ul>
  226. 226. <ul>Like procedures, all functions are created : <li>define the function name,
  227. 227. declare any inputs,
  228. 228. define the data type to be returned by the function,
  229. 229. state whether or not the function is deterministic,
  230. 230. define the body of the function . </li></ul>
  231. 231. For example : delimiter // create function circumference (r double) returns double deterministic begin declare c double; set c = 2 * r * pi(); return c; end // delimiter ;
  232. 232. RUNNING MySQL FUNCTIONS Unlike stored procedures stored functions are used as part of a select statement: <ul><li>select circumference(22);
  233. 233. In this case (for anyone that's interested) the result would be 138.23007675795 . </li></ul>
  234. 234. IMPORT A MySQL DATABASE <ul><li>This to restore data from a backup or to import from another MySQL server.
  235. 235. Start by uploading the FILE.sql file to the server where we will be running this command. </li></ul># mysql -u username -ppassword database_name < FILE.sql
  236. 236. EXPORT A MySQL DATABASE <ul><li>Replace username, password and database_name with your MySQL username, password and database name.File FILE.sql now holds a backup of your database, download it to your computer.
  237. 237. # mysqldump -u username -ppassword database_name > FILE.sql </li></ul>
  238. 238. PHP
  239. 239. WHAT IS PHP? <ul><li>PHP : Hypertext Preprocessor
  240. 240. It is an open source software and free to download to use.
  241. 241. It is a server-side scripting language, like ASP and scripts are executed on the server.
  242. 242. It supports many databases ( MySQL, Informix, Oracle, Sybase, Solid, PostgreSQL, Generic ODBC, etc .) </li></ul>
  243. 243. <ul><li>The PHP is very simple for a beginner, but offers many advanced features for a professional script writer.
  244. 244. Three main areas where PHP scripts are used :
  245. 245. Server-side scripting
  246. 246. Command line scripting
  247. 247. Writing desktop applications </li></ul>
  248. 248. ADVANTAGES <ul><li>It Support for both structural and Oops programming.
  249. 249. It can plugin with most of the databasesand use of variables $$var.
  250. 250. It support services using protocols such as LDAP, IMAP, SNMP, NNTP, POP3, HTTP, COM (on Windows) </li></ul>
  251. 251. ADVANTAGES continue.. <ul><li>PHP has extremely useful text processing features, from the POSIX Extended or Perl regular expressions to parsing XML documents.
  252. 252. Easy deployment and cost effective hosting.
  253. 253. Power ful built in functions. </li></ul>
  254. 254. DISADVANTAGES <ul><li>Security flaws due to unknown vulnerabilities .
  255. 255. Not good to create desktop Applications. </li></ul>
  256. 256. WHY WE ARE USING PHP? <ul><li>It enables programmers to create applications that will run on just about any computer, regardless of operating system.
  257. 257. If the computer can run web server software, the PHP application is portable across operating systems and environments ... PC, Mac, Linux, Windows, Internet, Intranet, etc. </li></ul>
  258. 258. BASIC PHP SYNTAX <ul>* A PHP scripting block always starts with <?php ends with ?> * For maximum compatibility, it is recommended that to use the standard form (<?php) rather than the shorthand form. </ul>
  259. 259. <ul><li>Each code line must end with a semicolon.
  260. 260. There are two basic statements to output text with PHP:
  261. 261. echo and print
  262. 262. Note :
  263. 263. The file must have a .php extension.
  264. 264. If the file has a .html extension, the PHP code will not be executed. </li></ul>
  265. 265. PHP . ini <ul><li>It is a configuration file that is used to customize behavior of PHP at runtime.
  266. 266. The Settings in which upload directory, register global variables, display errors, log errors, max uploading size setting, maximum time to execute a script and other configurations is written in this file. </li></ul>
  267. 267. PHP .ini continue.. <ul><li>The configuration file ( php.ini ) is read when PHP starts up.
  268. 268. In order for PHP to read it, it must be named 'php.ini' .
  269. 269. The php.ini directives allows us to set configure our PHP setup. </li></ul>
  270. 270. <ul>The parse_ini_file() function parses a configuration ( ini ) file and returns the settings in it in an array. Syntax : parse_ini_file(file,process_sections) <li>file- Required. Specifies the ini file to check.
  271. 271. process_sections -Optional.Default is FALSE. </li></ul>
  272. 272. <ul><li>The following reserved words must not be used as keys for ini files:
  273. 273. null, yes, no, true, and false.
  274. 274. The following reserved characters that must not be used in the keys:
  275. 275. {}|&~![()&quot;. </li></ul>
  276. 276. CONTENTS OF &quot;test.ini&quot; [names] me = Robert you = Peter [urls] first = &quot;; second = &quot;;
  277. 277. PHP CODE: <?php print_r(parse_ini_file(&quot;test.ini&quot;)); ?> OUTPUT : ( [me] => Robert [you] => Peter [first] => [second] => )
  278. 278. THANK YOU..