LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-12-2006, 08:09 AM   #1
johndmann
LQ Newbie
 
Registered: Mar 2006
Location: Texas
Distribution: Debian Sarge
Posts: 16

Rep: Reputation: 0
Apache/PHP/GD Problem


I've got a system running Debian Sarge. Everything was up and running just fine yesterday, but late last night, instead of being presented with my webpage, I got the error message, "Fatal Call: Undefined function imagecreatefrompng()", which is, of course referring to GD support through PHP.

Unsure what happened, I decided the best course of action would be to reinstall the PHP GD module, so I ran apt-get to remove the current version (which was still installed!!), and then reinstalled a fresh copy, but that turned out to be an even bigger mistake.

Apache now shows HTML pages just fine, but when trying to load a PHP page, it prompts the user to download the file (and therefore revealing my source code!!). After reading up on this phenomenon on Google for a while, the only conclusion I have found is that PHP is not set up correctly in my httpd.conf, even though I never modified it from when it 'was' working. Maybe apt-get messed with it? I'm not sure.

I just need to get PHP to parse again, and then I might still have the problem with PHP not recogizing the libgd.so that is installed. (But that is another problem).

Apache 1.3.3
PHP 4

So, here's my current apache settings:

/etc/apache/httpd.conf
Code:
ServerType standalone
ServerRoot /etc/apache
LockFile /var/lock/apache.lock
PidFile /var/run/apache.pid
ScoreBoardFile /var/run/apache.scoreboard
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
MinSpareServers 5
MaxSpareServers 10
StartServers 5
MaxClients 150
MaxRequestsPerChild 100
Include /etc/apache/modules.conf
<IfModule mod_status.c>
  ExtendedStatus On
</IfModule>
Port 80
User www-data
Group www-data
ServerAdmin webmaster@localhost
ServerName www(dot)mydotcom(dot)com (LQ won't let me use the dots)
DocumentRoot /var/www
<Directory /var/www>
    DirectoryIndex index.html index.php index.htm
    Options Indexes Includes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>
<IfModule mod_dir.c>
    DirectoryIndex index.html index.htm index.shtml index.cgi index.php
</IfModule>
AccessFileName .htaccess
UseCanonicalName Off
TypesConfig /etc/mime.types
DefaultType text/plain
<IfModule mod_mime_magic.c>
    MIMEMagicFile /usr/share/misc/file/magic.mime
</IfModule>
HostnameLookups Off
ErrorLog /var/log/apache/error.log
LogLevel warn
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"%{forensic-id}n\" %T %v" full
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"%{forensic-id}n\" %P %T" debug
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"%{forensic-id}n\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{forensic-id}n\"" forensic
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog /var/log/apache/access.log combined
<IfModule mod_backtrace.c>
 EnableExceptionHook On
</IfModule>
ServerSignature On
<IfModule mod_alias.c>
    Alias /icons/ /usr/share/apache/icons/
    <Directory /usr/share/apache/icons>
         Options Indexes MultiViews
         AllowOverride None
         Order allow,deny
         Allow from all
    </Directory>
    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory /usr/lib/cgi-bin/>
        AllowOverride None
        Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    </Directory>
</IfModule>
<IfModule mod_autoindex.c>
    IndexOptions FancyIndexing NameWidth=*
    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/deb.gif .deb
    AddIcon /icons/back.gif ..
    AddIcon /icons/hand.right.gif README
    AddIcon /icons/folder.gif ^^DIRECTORY^^
    AddIcon /icons/blank.gif ^^BLANKICON^^
    DefaultIcon /icons/unknown.gif
    ReadmeName README.html
    HeaderName HEADER.html
    IndexIgnore .??* *~ *# HEADER.html HEADER.txt RCS CVS *,v *,t
</IfModule>
<IfModule mod_mime.c>
    AddEncoding x-compress Z
    AddEncoding x-gzip gz tgz
    AddLanguage en .en
    <IfModule mod_negotiation.c>
        LanguagePriority en da nl et fr de el it ja pl pt pt-br lb ca es sv
    </IfModule>
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
    AddType application/x-tar .tgz
    AddType image/bmp .bmp
    AddType text/x-hdml .hdml
    <IfModule mod_include.c>
     AddType text/html .shtml
     AddHandler server-parsed .shtml
    </IfModule>
</IfModule>
AddDefaultCharset on
<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
</IfModule>
<IfModule mod_perl.c>
  <IfModule mod_alias.c>
   Alias /perl/ /var/www/perl/
  </IfModule>
  <Location /perl>
    SetHandler perl-script
    PerlHandler Apache::Registry
    Options +ExecCGI
  </Location>
</IfModule>
<IfModule mod_alias.c>
 Alias /doc/ /usr/share/doc/
</IfModule>
<Location /doc>
  order deny,allow
  deny from all
  allow from 127.0.0.0/255.0.0.0
  Options Indexes FollowSymLinks MultiViews
</Location>

NameVirtualHost *:80
<VirtualHost *:80>
   DocumentRoot /var/www
   ServerName www(dot)mydotcom(dot)com
   ServerAlias *(dot)mydotcom(dot)com     (LQ won't let me use the dots)
</VirtualHost>
<VirtualHost *:80>
   DocumentRoot /var/www
   ServerName mydotcom(dot)com
</VirtualHost>

Include /etc/apache/conf.d
(/etc/apache/conf.d is an empty directory)

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

/etc/apcahe/modules.conf
Code:
# Autogenerated file - do not edit!
# This file is maintained by the apache package.
# To update it, run the command:
#    /usr/sbin/apache-modconf apache
ClearModuleList
AddModule mod_so.c
AddModule mod_macro.c
LoadModule php4_module /usr/lib/apache/1.3/libphp4.so
LoadModule vhost_alias_module /usr/lib/apache/1.3/mod_vhost_alias.so
LoadModule env_module /usr/lib/apache/1.3/mod_env.so
LoadModule config_log_module /usr/lib/apache/1.3/mod_log_config.so
LoadModule agent_log_module /usr/lib/apache/1.3/mod_log_agent.so
LoadModule referer_log_module /usr/lib/apache/1.3/mod_log_referer.so
LoadModule log_forensic_module /usr/lib/apache/1.3/mod_log_forensic.so
LoadModule mime_magic_module /usr/lib/apache/1.3/mod_mime_magic.so
LoadModule mime_module /usr/lib/apache/1.3/mod_mime.so
LoadModule negotiation_module /usr/lib/apache/1.3/mod_negotiation.so
LoadModule status_module /usr/lib/apache/1.3/mod_status.so
LoadModule info_module /usr/lib/apache/1.3/mod_info.so
LoadModule includes_module /usr/lib/apache/1.3/mod_include.so
LoadModule autoindex_module /usr/lib/apache/1.3/mod_autoindex.so
LoadModule dir_module /usr/lib/apache/1.3/mod_dir.so
LoadModule cgi_module /usr/lib/apache/1.3/mod_cgi.so
LoadModule asis_module /usr/lib/apache/1.3/mod_asis.so
LoadModule imap_module /usr/lib/apache/1.3/mod_imap.so
LoadModule action_module /usr/lib/apache/1.3/mod_actions.so
LoadModule speling_module /usr/lib/apache/1.3/mod_speling.so
LoadModule userdir_module /usr/lib/apache/1.3/mod_userdir.so
LoadModule alias_module /usr/lib/apache/1.3/mod_alias.so
LoadModule rewrite_module /usr/lib/apache/1.3/mod_rewrite.so
LoadModule access_module /usr/lib/apache/1.3/mod_access.so
LoadModule auth_module /usr/lib/apache/1.3/mod_auth.so
LoadModule anon_auth_module /usr/lib/apache/1.3/mod_auth_anon.so
LoadModule dbm_auth_module /usr/lib/apache/1.3/mod_auth_dbm.so
LoadModule db_auth_module /usr/lib/apache/1.3/mod_auth_db.so
LoadModule proxy_module /usr/lib/apache/1.3/libproxy.so
LoadModule expires_module /usr/lib/apache/1.3/mod_expires.so
LoadModule headers_module /usr/lib/apache/1.3/mod_headers.so
LoadModule setenvif_module /usr/lib/apache/1.3/mod_setenvif.so
LoadModule put_module /usr/lib/apache/1.3/mod_put.so
LoadModule cache_module /usr/lib/apache/1.3/libcache.so
LoadModule session_module /usr/lib/apache/1.3/mod_session.so
---------------------------------------

/etc/apache/mime.types
Code:
###############################################################################
#
#  MIME-TYPES and the extensions that represent them
#
#  This file is part of the "mime-support" package.  Please send email (not a
#  bug report) to mime-support@packages.debian.org if you would like new types
#  and/or extensions to be added.
#
#  Users can add their own types if they wish by creating a ".mime.types"
#  file in their home directory.  Definitions included there will take
#  precedence over those listed here.
#
#  Note: Compression schemes like "gzip", "bzip", and "compress" are not
#  actually "mime-types".  They are "encodings" and hence must _not_ have
#  entries in this file to map their extensions.  The "mime-type" of an
#  encoded file refers to the type of data that has been encoded, not the
#  type of the encoding.
#
###############################################################################
<---CODE SNIPPED FROM HERE--->
application/x-hdf                               hdf
application/x-httpd-php                         phtml pht php
application/x-httpd-php-source                  phps
application/x-httpd-php3                        php3
application/x-httpd-php3-preprocessed           php3p
application/x-httpd-php4                        php4
application/x-ica                               ica
<---CODE SNIPPED FROM HERE--->
If you need my php.ini, I'll post it

Last edited by johndmann; 03-12-2006 at 08:10 AM.
 
Old 03-13-2006, 02:51 AM   #2
byteclock
LQ Newbie
 
Registered: Sep 2005
Posts: 9

Rep: Reputation: 0
you better check if php is installed..rpm -q php ? well it seems yo ugot debian..check it with aptitude then.

Last edited by byteclock; 03-13-2006 at 02:58 AM.
 
Old 03-15-2006, 11:04 AM   #3
johndmann
LQ Newbie
 
Registered: Mar 2006
Location: Texas
Distribution: Debian Sarge
Posts: 16

Original Poster
Rep: Reputation: 0
PHP was installed correctly, as was apache... But there was something else wrong with the setup. I did a data backup of files and my database, reinstalled Debian, and did a fresh apache/php/mysql install. Everything worked fine after that. I'm not sure what the problem was, but reinstalling Debian seemed to be a quicker route to getting it fixed than to try and debug what went wrong.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
php in apache problem hack124x768 Linux - Networking 6 02-17-2005 04:56 PM
Help with PHP and Apache problem. Phantisy Linux - Software 7 08-16-2004 07:53 AM
Help w/ a PHP/Apache problem ming0 Linux - Software 10 04-14-2004 09:12 AM
Apache 2 PHP Problem jon1591 Linux - Newbie 1 02-07-2004 01:54 PM
Apache php index.php problem neurotic Linux - Software 3 11-18-2003 06:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:26 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration