Probleme Apache and PHP

7 posts / 0 new
Last post
Valentin Bojin
Probleme Apache and PHP

Am Mandriva 2007 si am instalat apache(versiunea 2.2.3) si apache-mod_php (ver 5.1.6) , care au fost instalate implicit odata cu distributia.

Am copiat in /var/www/html/  un dirrector care contine un site format din fis. html si php.

Daca dau in browser: http://localhost/  - imi zice: It Works!
Daca dau : http:/localhost/nume_dir_site/  - imi intra pe index.html dar pe site mai am si fis. php. Iar daca dau pe o pagina care e .php nu mi-o recunoaste ci imi aparea fereastra de download.

Care ar fi problema?

Multumesc ???

Valentin Bojin
Raspuns: Probleme Apache and PHP

Daca dau din consola:

[root@localhost init.d]# ./httpd restart

Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
                                                                [FAILED]
:( :-[

ing. Patkos Csaba
ing. Patkos Csaba's picture
Raspuns: Probleme Apache and PHP

Interesant ...

La mine a functionat din prima.
Din eroarea prezentata de tine, as verifica intai daca nu cumva iti ruleaza deja httpd ... doua instante s-ar putea sa nu poti rula ...

La mine in consola daca dau un restart imi zice si mie treaba cu domain name, adica:

Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
                                                                [  OK  ]

Insa dupa aceea functioneaza perfect.

Aruncand o privire peste /etc/httpd/conf/httpd.conf am remarcat urmatoarele:

#
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of the default. See also the
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
#
#Listen 12.34.56.78:80
Listen 0.0.0.0:80

=============================================================

Tot in acel folder am descoperit fisierul mime.types care are referitor la php linia:

application/x-php              php php3 php4

=============================================================

inca o privire merita aruncata peste fisierul:

[root@localhost ~]# cat /etc/httpd/modules.d/70_mod_php.conf

   
        LoadModule php5_module    extramodules/mod_php5.so
   

    AddType application/x-httpd-php .php
    AddType application/x-httpd-php .phtml
    AddType application/x-httpd-php-source .phps

   
        DirectoryIndex index.php index.phtml
   

========================================================

Cam atat, nu prea imi dau seama ce ar mai putea sa fie ... la mine functionand din prima nu am oferit mare atentie setarilor apache sau php...

Informatii suplimentare am mai gasit dupa o scurta cautare pe acest FAQ:
http://www.qwesz.com/php-manual/faq.installation.ht

... vezi punctul 4)

Bafta

Csabi's BLOG

Linux registered user # 457717

Valentin Bojin
Raspuns: Probleme Apache and PHP

M-am uitat peste acele fisiere dar sunt exact ca si la tine setarile. NU este nici o diferenta!

Probabil nici la tine nu merge (Patkos Csaba) incearca sa deschizi din browser un fisier.php !!!!

ing. Patkos Csaba
ing. Patkos Csaba's picture
Raspuns: Probleme Apache and PHP

La mine sigur merge ca programez aplicatii PHP toata ziua pe acest mandriva :)

Csabi's BLOG

Linux registered user # 457717

ing. Patkos Csaba
ing. Patkos Csaba's picture
Raspuns: Probleme Apache and PHP

Din cate imi dau eu seama, toate setarile necesare PHP sun in fisierul:

/etc/httpd/modules.d/70_mod_php.conf - al carui continut l-am dat in raspunsul meu initial.

In /etc/httpd/conf/httpd.conf trebuie sa ai linia:

Include modules.d/*.conf

aceasta linie ar trebui sa citeasca fisiere de configurare din modules.d ... inclusiv cel cu php.  Eventual verifica daca utilizatorul sub care ruleaza Apache (de obicei userul apache) are acces de citire in acel folder / fisier.

Mai vezi te rog, daca nu ai cumva ceva mesaje de eroare in /var/log/messages legate de apache sau de php.

Daca astea nu te ajuta, vezi mai jos.

-------------------------------------------------------------------------------------------------------------
In FAQ-ul oficial de la php 5.1.3 scrie asa:

5.2. I installed PHP from an RPM, but Apache isn't processing the PHP pages! What's going on here?
Assuming you installed both Apache and PHP from RPM packages, you need to uncomment or add some or all of the following lines in your http.conf file:
# Extra Modules
AddModule mod_php.c
AddModule mod_php3.c
AddModule mod_perl.c
# Extra Modules
LoadModule php_module modules/mod_php.so
LoadModule php3_module modules/libphp3.so
LoadModule perl_module modules/libperl.so
And add:
AddType application/x-httpd-php3 .php3
To the global properties, or to the properties of the VirtualDomain you want to have PHP support added to.

---------------------------------------------------------------------------------------------------------

Spune-mi te rog si mie daca ai reusit.

Csabi's BLOG

Linux registered user # 457717

Valentin Bojin
Raspuns: Probleme Apache and PHP

Am tot incercat dar deocamdata nici un raspuns pozitiv.