Autor Tópico: Apache funcionada com html e outros, mas o PHP5 não funciona...  (Lida 6530 vezes)

Offline Roque

  • Usuário Ubuntu
  • *
  • Mensagens: 5
    • Ver perfil
Apache funcionada com html e outros, mas o PHP5 não funciona...
« Online: 06 de Dezembro de 2007, 14:51 »
Olá Pessoa!

instalei o apache2 e o php5 com mysql, mas o PHP5 não funciona

quando abrir qualquer arquivo php, o arquivo não abre corretamente, as vezes pede para download tamb...

instalei seguindo tutorial, mas mesmo assim não funcionou...

tem como fazer uma verificação no php.ini ou em outro lugar para ver o porque que o php não funciona???

agradeço muito desde já pela ajuda...

 :)

Offline agente100gelo

  • Administrador
  • Usuário Ubuntu
  • *****
  • Mensagens: 4.369
  • @Ceará
    • Ver perfil
Re: Apache funcionada com html e outros, mas o PHP5 não funciona...
« Resposta #1 Online: 06 de Dezembro de 2007, 15:05 »
Que tutorial você usou?
Normalmente não precisa configurar nada.
Advogado e analista de sistema cearense.
Twitter: @glaydson

Offline fbduartesc

  • Usuário Ubuntu
  • *
  • Mensagens: 75
    • Ver perfil
Re: Apache funcionada com html e outros, mas o PHP5 não funciona...
« Resposta #2 Online: 30 de Janeiro de 2008, 11:04 »
Olá Roque,

posta ai o artigo que você utilizou e se você fez alguma alteração.

Qualquer coisa é só postar pra t ajudar..

Abraços...
Linux User: #444233
Ubuntu User: # 20324
Fabio Duarte de Souza
Acadêmico de Ciência da Computação - UNESC

Offline PASMartins

  • Usuário Ubuntu
  • *
  • Mensagens: 10
    • Ver perfil
Re: Apache funcionada com html e outros, mas o PHP5 não funciona...
« Resposta #3 Online: 11 de Fevereiro de 2008, 13:04 »
Ola a todos

Estou tendo o mesmo problema aqui, com html ele funciona normal, mas com php ele aparece uma tela pra vc abrir o arquivo e também quando tento restartar o apache ele me retorna o seguinte erro:

 * Forcing reload of web server (apache2)...                                                 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName

Agradeço qualquer sugestão
Paula

PS: Estou rodando no Ubuntu 7.04 Feisty, instalei o apache2 com o aptitude e não deu nenhum erro durante a instalação.

Offline agente100gelo

  • Administrador
  • Usuário Ubuntu
  • *****
  • Mensagens: 4.369
  • @Ceará
    • Ver perfil
Re: Apache funcionada com html e outros, mas o PHP5 não funciona...
« Resposta #4 Online: 11 de Fevereiro de 2008, 16:31 »
Copie o conteúdo de /etc/apache2/apache2.conf
Advogado e analista de sistema cearense.
Twitter: @glaydson

Offline felipeborges

  • Usuário Ubuntu
  • *
  • Mensagens: 651
    • Ver perfil
    • felipe@borges:~# Liberdade não tem Preço!
Re: Apache funcionada com html e outros, mas o PHP5 não funciona...
« Resposta #5 Online: 11 de Fevereiro de 2008, 19:11 »
o HTML é padrão, não é necessario o Apache para o navegador "traduzir" a linguagem, quanto ao php, quando utilizei windows eu usava separadamente o apache php e mysql, mais no ubuntu, encontrei dificuldades, então baixei o EasyPHP no superdownloads. Ele já instala os 3 de forma configurada.

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

Já alterou a porta 80 para 81 na conf do apache?
Meu blog sobre GNU/Linux
Debian Lenny e Gentoo.

Offline PASMartins

  • Usuário Ubuntu
  • *
  • Mensagens: 10
    • Ver perfil
Re: Apache funcionada com html e outros, mas o PHP5 não funciona...
« Resposta #6 Online: 12 de Fevereiro de 2008, 09:28 »
Bom dia a todos

Eu alterei sim a porta mas não funcionou.  o arquivo apache2.conf é extenso mas como eu não sei anexar aqui vou colar ele ai em baixo só o que esta descomentado.

Obrigada
Paula

conteudo do /etc/apache2/apache2.conf

# Do NOT add a slash at the end of the directory path.
#
ServerRoot "/etc/apache2"

# PidFile: The file in which the server should record its process
# identification number when it starts.
#
PidFile /var/run/apache2.pid

#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 15

# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_prefork_module>
    StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    MaxClients          150
    MaxRequestsPerChild   0
</IfModule>

# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_worker_module>
    StartServers          2
    MaxClients          150
    MinSpareThreads      25
    MaxSpareThreads      75
    ThreadsPerChild      25
    MaxRequestsPerChild   0
</IfModule>

User www-data
Group www-data

# AccessFileName: The name of the file to look for in each directory
# for additional configuration directives.  See also the AllowOverride
# directive.
#

AccessFileName .htaccess

#
# The following lines prevent .htaccess and .htpasswd files from being
# viewed by Web clients.
#
<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
</Files>

TypesConfig /etc/mime.types

# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain

# each client request will result in AT LEAST one lookup request to the
# nameserver.
#
HostnameLookups Off

# container, that host's errors will be logged there and not here.
#
ErrorLog /var/log/apache2/error.log

# alert, emerg.
#
LogLevel warn


# Include module configuration:
Include /etc/apache2/mods-enabled/*.load
Include /etc/apache2/mods-enabled/*.conf

# Include all the user configurations:
Include /etc/apache2/httpd.conf

# Include ports listing
Include /etc/apache2/ports.conf

# Include generic snippets of statements
Include /etc/apache2/conf.d/

#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
#
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

# where Full conveys the most information, and Prod the least.
#
ServerTokens Full

# Set to one of:  On | Off | EMail
#
ServerSignature On

<IfModule alias_module>
    # We include the /icons/ alias for FancyIndexed directory listings.  If
    # you do not use FancyIndexing, you may comment this out.
    #
    Alias /icons/ "/usr/share/apache2/icons/"

    <Directory "/usr/share/apache2/icons">
        Options Indexes MultiViews
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>

</IfModule>

<IfModule mod_autoindex.c>

    IndexOptions FancyIndexing VersionSort HTMLTable NameWidth=*

    #
    # AddIcon* directives tell the server which icon to show for different
    # files or filename extensions.  These are only displayed for
    # FancyIndexed directories.
    #
    AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip

    AddIconByType (TXT,/icons/text.gif) text/*
    AddIconByType (IMG,/icons/image2.gif) image/*
    AddIconByType (SND,/icons/sound2.gif) audio/*
    AddIconByType (VID,/icons/movie.gif) video/*

    AddIcon /icons/binary.gif .bin .exe
    AddIcon /icons/binhex.gif .hqx
    AddIcon /icons/tar.gif .tar
    AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
    AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
    AddIcon /icons/a.gif .ps .ai .eps
    AddIcon /icons/layout.gif .html .shtml .htm .pdf
    AddIcon /icons/text.gif .txt
    AddIcon /icons/c.gif .c
    AddIcon /icons/p.gif .pl .py
    AddIcon /icons/f.gif .for
    AddIcon /icons/dvi.gif .dvi
    AddIcon /icons/uuencoded.gif .uu
    AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
    AddIcon /icons/tex.gif .tex
    AddIcon /icons/bomb.gif core

    AddIcon /icons/back.gif ..
    AddIcon /icons/hand.right.gif README
    AddIcon /icons/folder.gif ^^DIRECTORY^^
    AddIcon /icons/blank.gif ^^BLANKICON^^

    #
    # DefaultIcon is which icon to show for files which do not have an icon
    # explicitly set.
    #
    DefaultIcon /icons/unknown.gif

    # HeaderName is the name of a file which should be prepended to
    # directory indexes.
    ReadmeName README.html
    HeaderName HEADER.html

    # IndexIgnore is a set of filenames which directory indexing should ignore
    # and not include in the listing.  Shell-style wildcarding is permitted.
    #
    IndexIgnore .??* *~ *# RCS CVS *,v *,t
</IfModule>

<IfModule mod_mime.c>

    # If the AddEncoding directives above are commented-out, then you
    # probably should define those extensions to indicate media types:
    #
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz

    AddLanguage ca .ca
    AddLanguage cs .cz .cs
    AddLanguage da .dk
    AddLanguage de .de
    AddLanguage el .el
    AddLanguage en .en
    AddLanguage eo .eo
    AddLanguage es .es
    AddLanguage et .et
    AddLanguage fr .fr
    AddLanguage he .he
    AddLanguage hr .hr
    AddLanguage it .it
    AddLanguage ja .ja
    AddLanguage ko .ko
    AddLanguage ltz .ltz
    AddLanguage nl .nl
    AddLanguage nn .nn
    AddLanguage no .no
    AddLanguage pl .po
    AddLanguage pt .pt
    AddLanguage pt-BR .pt-br
    AddLanguage ru .ru
    AddLanguage sv .sv
    AddLanguage zh-CN .zh-cn
    AddLanguage zh-TW .zh-tw
</IfModule>

<IfModule mod_negotiation.c>
    LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW

    ForceLanguagePriority Prefer Fallback
</IfModule>

<IfModule mod_mime.c>
    AddCharset us-ascii    .ascii .us-ascii
    AddCharset ISO-8859-1  .iso8859-1  .latin1
    AddCharset ISO-8859-2  .iso8859-2  .latin2 .cen
    AddCharset ISO-8859-3  .iso8859-3  .latin3
    AddCharset ISO-8859-4  .iso8859-4  .latin4
    AddCharset ISO-8859-5  .iso8859-5  .cyr .iso-ru
    AddCharset ISO-8859-6  .iso8859-6  .arb .arabic
    AddCharset ISO-8859-7  .iso8859-7  .grk .greek
    AddCharset ISO-8859-8  .iso8859-8  .heb .hebrew
    AddCharset ISO-8859-9  .iso8859-9  .latin5 .trk
    AddCharset ISO-8859-10  .iso8859-10  .latin6
    AddCharset ISO-8859-13  .iso8859-13
    AddCharset ISO-8859-14  .iso8859-14  .latin8
    AddCharset ISO-8859-15  .iso8859-15  .latin9
    AddCharset ISO-8859-16  .iso8859-16  .latin10
    AddCharset ISO-2022-JP .iso2022-jp .jis
    AddCharset ISO-2022-cara .iso2022-cara .kis
    AddCharset ISO-2022-CN .iso2022-cn .cis
    AddCharset Big5        .Big5       .big5 .b5
    AddCharset cn-Big5     .cn-big5
    # For russian, more than one charset is used (depends on client, mostly):
    AddCharset WINDOWS-1251 .cp-1251   .win-1251
    AddCharset CP866       .cp866
    AddCharset KOI8      .koi8
    AddCharset KOI8-E      .koi8-e
    AddCharset KOI8-r      .koi8-r .koi8-ru
    AddCharset KOI8-U      .koi8-u
    AddCharset KOI8-ru     .koi8-uk .ua
    AddCharset ISO-10646-UCS-2 .ucs2
    AddCharset ISO-10646-UCS-4 .ucs4
    AddCharset UTF-7       .utf7
    AddCharset UTF-8       .utf8
    AddCharset UTF-16      .utf16
    AddCharset UTF-16BE    .utf16be
    AddCharset UTF-16LE    .utf16le
    AddCharset UTF-32      .utf32
    AddCharset UTF-32BE    .utf32be
    AddCharset UTF-32LE    .utf32le
    AddCharset euc-cn      .euc-cn
    AddCharset euc-gb      .euc-gb
    AddCharset euc-jp      .euc-jp
    AddCharset euc-cara      .euc-cara
    #Not sure how euc-tw got in - IANA doesn't list it???
    AddCharset EUC-TW      .euc-tw
    AddCharset gb2312      .gb2312 .gb
    AddCharset iso-10646-ucs-2 .ucs-2 .iso-10646-ucs-2
    AddCharset iso-10646-ucs-4 .ucs-4 .iso-10646-ucs-4
    AddCharset shift_jis   .shift_jis .sjis

    # For type maps (negotiated resources):
    # (This is enabled by default to allow the Apache "It Worked" page
    #  to be distributed in multiple languages.)
    #
    AddHandler type-map var

    # To parse .shtml files for server-side includes (SSI):
    # (You will also need to add "Includes" to the "Options" directive.)
    #
    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml
</IfModule>

<IfModule mod_setenvif.c>
    BrowserMatch "Mozilla/2" nokeepalive
    BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
    BrowserMatch "RealPlayer 4\.0" force-response-1.0
    BrowserMatch "Java/1\.0" force-response-1.0
    BrowserMatch "JDK/1\.0" force-response-1.0

    BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
    BrowserMatch "MS FrontPage" redirect-carefully
    BrowserMatch "^WebDrive" redirect-carefully
    BrowserMatch "^WebDAVFS/1.[012]" redirect-carefully
    BrowserMatch "^gnome-vfs/1.0" redirect-carefully
    BrowserMatch "^XML Spy" redirect-carefully
    BrowserMatch "^Dreamweaver-WebDAV-SCM1" redirect-carefully
</IfModule>


Offline agente100gelo

  • Administrador
  • Usuário Ubuntu
  • *****
  • Mensagens: 4.369
  • @Ceará
    • Ver perfil
Re: Apache funcionada com html e outros, mas o PHP5 não funciona...
« Resposta #7 Online: 13 de Fevereiro de 2008, 17:19 »
Adicione no final do arquivo apache2.conf

Código: [Selecionar]
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps

Reinicie o Apache.
Advogado e analista de sistema cearense.
Twitter: @glaydson

Comunista

  • Visitante
Re: Apache funcionada com html e outros, mas o PHP5 não funciona...
« Resposta #8 Online: 13 de Fevereiro de 2008, 17:34 »
Ola a todos

Estou tendo o mesmo problema aqui, com html ele funciona normal, mas com php ele aparece uma tela pra vc abrir o arquivo e também quando tento restartar o apache ele me retorna o seguinte erro:

 * Forcing reload of web server (apache2)...                                                 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName

Agradeço qualquer sugestão
Paula

PS: Estou rodando no Ubuntu 7.04 Feisty, instalei o apache2 com o aptitude e não deu nenhum erro durante a instalação.


Esse problema eu resolvi inserindo localhosts dois do ip 127.0.0.1 no arquivo /etc/hosts

ficou assim

127.0.0.1     localhost



Quanto ao problema de o apache oferecer o .php para download verifique se este arquivo está com permissão de execução....


Para retirar a permissão de execução digite

#chmod -x nomedoarquivo.php

Offline rafasnn

  • Usuário Ubuntu
  • *
  • Mensagens: 611
    • Ver perfil
Re: Apache funcionada com html e outros, mas o PHP5 não funciona...
« Resposta #9 Online: 25 de Abril de 2008, 10:03 »
Ola a todos

Estou tendo o mesmo problema aqui, com html ele funciona normal, mas com php ele aparece uma tela pra vc abrir o arquivo e também quando tento restartar o apache ele me retorna o seguinte erro:

 * Forcing reload of web server (apache2)...                                                 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName

Agradeço qualquer sugestão
Paula

PS: Estou rodando no Ubuntu 7.04 Feisty, instalei o apache2 com o aptitude e não deu nenhum erro durante a instalação.

pessoal,

estou com um problema parecido com o da paula, mas com algumas diferenças, o que poderia ser?

Código: [Selecionar]
* starting web server apache2
apache2: could not reliably determine the serverś fully qualified domain name
using 192.168.1.3 for server name

vlw
Macbook Pro 2,33 4GB 250GB
iPhone 8GB