Sie sind auf Seite 1von 3

Prepare Apache and PHP

STEP 1: Enable PHP in /etc/httpd/httpd.conf: Add 'index.php' to directory index: <IfModule dir_module> DirectoryIndex index.html index.php </IfModule> and enable the P P module by uncommentin!: "#ncomment the follo$in! line to enable P P: " Include /etc/httpd/mod_php.conf %ou don't need to edit /etc/httpd/mod_php.conf &ince it ha& mod_php already enabled for all file& endin! $ith .php.

Prepare Apache and PHP


A& the root u&er' open the '/etc/httpd/httpd.conf' Apache confi!uration file $ith your preferred text editor. (hen' find the follo$in! line and uncomment it )delete the '"' character at the &tart of the line*: Include /etc/httpd/mod_php.conf +o$ your Apache $ill include the P P module $hen it &tart&. ,et a &er-er name )if your machine'& IP doe&n't re&ol-e to a name*. .dit the '/etc/httpd/httpd.conf' and uncomment the follo$in! line: ,er-er+ame $$$.example.com:/0 <11chan!e $$$.example.com to an IP or your machine'& name Server ame !!!.iulian.com:"# P.23.4(555 6ptionally )but recommended*' you can confi!ure Apache to u&e an 'index.php' file a& your directory index. %ou 7u&t ha-e to &earch the follo$in! line8: 6ptionally 9' if you u&e Perl for $eb &cript&' you may $ant to add 'index.pl' al&o. <IfModule dir_module> DirectoryIndex index.html </IfModule> 8 and chan!e it to: <IfModule dir_module> DirectoryIndex index.html index.php </IfModule> Plea&e note the 'index.php' part added. %ou can no$ save and clo&e your '/etc/httpd/httpd.conf' file. STEP $:Ad%u&t &ettin' in /etc/httpd/php.ini 4hec: the maximum execution time and increa&e if nece&&ary dependin! on your &y&tem'& performance 1 a hi!her -alue doe&n't really harm: max_execution_time ; <0 4hec: the time=one &ettin!& and &et time=one to your local time=one' e.!. date.time=one ; >.urope/?erlin> 3ix php time =one )many app& $ill complain about thi& if you don't do it*. .dit '/etc/httpd/php.ini' and find the follo$in! line and uncomment it: date.time=one ; America/4hica!o <11chan!e to correct time =one 4hec: the memory limit and &et it to at lea&t @9/M: memory_limit ; @9/M (he maximum &i=e of a file to upload i& too lo$ by default. ,et it to at lea&t @0 M?: upload_max_file&i=e ; @0M STEP $: PHP Exten&ion& Accordin! to the late&t I+,(AAA.txt the belo$ P P exten&ion& &hould be a-ailable: curl' filter' !d )-er&ion 9 compatible*' ha&h' 7&on' mb&trin!' my&Bl' open&&l' pcre' &e&&ion' &oap' &pl'

&tandard' xml Cith ,lac:$are @D.@ all of the&e &hould be enabled. %ou can chec: $ith php -i, e.!. for 7&on &upport: " php (i ) 'rep (i (! *%&on 7&on 7&on &upport ;> enabled 7&on -er&ion ;> @.9.@ STEP +:Start the !eb &erver (hi& can be done by executin! the &tart &cript in the /etc/rc.d directory: " &h /etc/rc.d/rc.httpd &tart 2e&tart your Apache &er-er in order to ha-e your modification& applied. A& root' execute: apachectl re&tart 2e&tart the httpd &er-er. /etc/rc.d/rc.httpd re&tart

Enable httpd at boot(time


A& al$ay& $ith ,lac:$are thi& ha& to be done by &ettin! the executable bit on the &tart &cript: " chmod Ex /etc/rc.d/rc.httpd If you $ant your Apache &er-er to &tart automatically $hen you &tart your box' you can chan!e the permi&&ion& of the '/etc/rc.d/rc.httpd' file. .xecute the follo$in! command a& root: F chmod GHH /etc/rc.d/rc.httpd +o$ your Apache &er-er $ill &tart automatically $hen your &y&tem boot&.

,erificare:
In 3irefix tipare&te adre&a: @9G.0.0.@ &au http://localho&t/ ,i ai me&a7ul: It !or-&.

P.23.4(555
Te&tare functonare: +ormally you $ould $ant to te&t your recent chan!e& in order to :no$ if they ha-e $or:ed. After re&tartin! Apache' create a 'index.php' file on your '/-ar/$$$/htdoc&/' directory $ith the follo$in!: <Iphp phpinfo)*J I> (o te&t that php i& functionin! correctly' create index.php $ith the follo$in! line in it: cd /-ar/$$$/htdoc& cat > index.php <Iphp phpinfo)*J I> KD Ma:e the P P pa!e info: vi /var/!!!/htdoc&/index.php and add: <Iphp phpinfo)* I>

6pen up a $eb bro$&er and point it to: /http://localho&t/index.php/ It &hould di&play detailed information from phpinfo)*. 6nce confirmed' it'& a !ood idea to delete phpinfo)* from the file for &ecurity rea&on&.