php port not updating

I have been using FreeBSD 7.0 on an old computer that is getting noisy. I decided to move the maintenance programming I have been doing on that computer to a newer one running FreeBSD 8.1. I have been using the FreeBSD 8.1 computer for maintenance programming of a different web application. Both application are programmed primarily in php.

The program from the FreeBSD computer failed on the new computer with an error that function session_start() could not be found.

After backing up the system to an external disk I ran freebsd-update to update the system to 8.2. I then did a postsnap to update my ports. Did a make rmconfig in the php port directory, then ran portupgrade -a. While I saw quite a few configuration screens I did not see one for php.

After the portupgrade completed the computer rebooted. When I tried running the web application again, I still got the function session_start() could not be found error.

After I re-booted again, When I try to run any php program I see the source, the php does not run.

I hate to restore the system and start over in trying to fix the original problem!

Thanks for any suggestions,

Edwin

Below is more information.

Code:
Running "/usr/ports/lang/php5-extensions]# portupgrade -Cv --force  php5-extensions" returns:
--->  Session started at: Tue, 04 Oct 2011 11:08:16 -0600
** None has been installed or upgraded.
--->  Session ended at: Tue, 04 Oct 2011 11:08:16 -0600 (consumed 00:00:00)
 [root@cedric2 /usr/ports/lang/php5-extensions]# portupgrade -Cv --force  php5-extensions
--->  Session started at: Tue, 04 Oct 2011 11:08:16 -0600
** None has been installed or upgraded.
--->  Session ended at: Tue, 04 Oct 2011 11:08:16 -0600 (consumed 00:00:00)

Running cd /usr/ports/lang/php5-extensions && make showconfig returns:
Code:
 /usr/ports/lang/php5-extensions]# make showconfig
===> The following configuration options are available for php5-extensions-1.5:
     BCMATH=on "bc style precision math functions"
     BZ2=off "bzip2 library support"
     CALENDAR=on "calendar conversion support"
     CTYPE=on "ctype functions"
     CURL=on "CURL support"
     DBA=on "dba support"
     DOM=on "DOM support"
     EXIF=off "EXIF support"
     FILEINFO=off "fileinfo support"
     FILTER=on "input filter support"
     FRIBIDI=off "FriBidi support"
     FTP=off "FTP support"
     GD=on "GD library support"
     GETTEXT=off "gettext library support"
     GMP=off "GNU MP support"
     HASH=on "HASH Message Digest Framework"
     ICONV=on "iconv support"
     IMAP=off "IMAP support"
     INTERBASE=off "Interbase 6 database support (Firebird)"
     JSON=on "JavaScript Object Serialization support"
     LDAP=off "OpenLDAP support"
     MBSTRING=off "multibyte string support"
     MCRYPT=off "Encryption support"
     MSSQL=off "MS-SQL database support"
     MYSQL=on "MySQL database support"
     MYSQLI=on "MySQLi database support"
     ODBC=on "ODBC support"
     OPENSSL=off "OpenSSL support"
     PCNTL=off "pcntl support (CLI only)"
     PDF=off "PDFlib support (implies GD)"
     PDO=on "PHP Data Objects Interface (PDO)"
     PDO_SQLITE=on "PDO sqlite driver"
     PGSQL=off "PostgreSQL database support"
     POSIX=on "POSIX-like functions"
     PSPELL=off "pspell support"
     READLINE=off "readline support (CLI only)"
     RECODE=off "recode support"
     SESSION=on "session support"
     SHMOP=off "shmop support"
     SIMPLEXML=on "simplexml support"
     SNMP=off "SNMP support"
     SOAP=off "SOAP support"
     SOCKETS=off "sockets support"
     SQLITE=on "sqlite support"
     SQLITE3=on "sqlite3 support"
     SYBASE_CT=off "Sybase database support"
     SYSVMSG=off "System V message support"
     SYSVSEM=off "System V semaphore support"
     SYSVSHM=off "System V shared memory support"
     TIDY=off "TIDY support"
     TOKENIZER=on "tokenizer support"
     WDDX=off "WDDX support (implies XML)"
     XML=on "XML support"
     XMLREADER=on "XMLReader support"
     XMLRPC=off "XMLRPC-EPI support"
     XMLWRITER=on "XMLWriter support"
     XSL=off "XSL support (Implies DOM)"
     YAZ=off "YAZ support (ANSI/NISO Z39.50)"
     ZIP=off "ZIP support"
     ZLIB=on "ZLIB support"
===> Use 'make config' to modify these settings

Running cd /usr/ports/lang/php5 && make showconfig RETURNS:
Code:
/usr/ports/lang/php5]# make showconfig
===> The following configuration options are available for php5-5.3.8:
     CLI=on "Build CLI version"
     CGI=on "Build CGI version"
     FPM=off "Build FPM version (experimental)"
     APACHE=on "Build Apache module"
     AP2FILTER=on " Use Apache 2.x filter interface (experimental)"
     DEBUG=on "Enable debug"
     SUHOSIN=on "Enable Suhosin protection system"
     MULTIBYTE=on "Enable zend multibyte support"
     IPV6=on "Enable ipv6 support"
     MAILHEAD=off "Enable mail header patch"
     LINKTHR=on "Link thread lib (for threaded extensions)"
===> Use 'make config' to modify these settings

The pertinent parts of httpd.conf are as follows:
Code:
LoadModule authn_file_module libexec/apache22/mod_authn_file.so
LoadModule authn_dbm_module libexec/apache22/mod_authn_dbm.so
LoadModule authn_anon_module libexec/apache22/mod_authn_anon.so
LoadModule authn_default_module libexec/apache22/mod_authn_default.so
LoadModule authn_alias_module libexec/apache22/mod_authn_alias.so
LoadModule authz_host_module libexec/apache22/mod_authz_host.so
LoadModule authz_groupfile_module libexec/apache22/mod_authz_groupfile.so
LoadModule authz_user_module libexec/apache22/mod_authz_user.so
LoadModule authz_dbm_module libexec/apache22/mod_authz_dbm.so
LoadModule authz_owner_module libexec/apache22/mod_authz_owner.so
LoadModule authz_default_module libexec/apache22/mod_authz_default.so
LoadModule auth_basic_module libexec/apache22/mod_auth_basic.so
LoadModule auth_digest_module libexec/apache22/mod_auth_digest.so
LoadModule file_cache_module libexec/apache22/mod_file_cache.so
LoadModule cache_module libexec/apache22/mod_cache.so
LoadModule disk_cache_module libexec/apache22/mod_disk_cache.so
LoadModule dumpio_module libexec/apache22/mod_dumpio.so
LoadModule reqtimeout_module libexec/apache22/mod_reqtimeout.so
LoadModule include_module libexec/apache22/mod_include.so
LoadModule filter_module libexec/apache22/mod_filter.so
LoadModule charset_lite_module libexec/apache22/mod_charset_lite.so
LoadModule deflate_module libexec/apache22/mod_deflate.so
LoadModule log_config_module libexec/apache22/mod_log_config.so
LoadModule logio_module libexec/apache22/mod_logio.so
LoadModule env_module libexec/apache22/mod_env.so
LoadModule mime_magic_module libexec/apache22/mod_mime_magic.so
LoadModule cern_meta_module libexec/apache22/mod_cern_meta.so
LoadModule expires_module libexec/apache22/mod_expires.so
LoadModule headers_module libexec/apache22/mod_headers.so
LoadModule usertrack_module libexec/apache22/mod_usertrack.so
LoadModule unique_id_module libexec/apache22/mod_unique_id.so
LoadModule setenvif_module libexec/apache22/mod_setenvif.so
LoadModule version_module libexec/apache22/mod_version.so
LoadModule ssl_module libexec/apache22/mod_ssl.so
LoadModule mime_module libexec/apache22/mod_mime.so
LoadModule dav_module libexec/apache22/mod_dav.so
LoadModule status_module libexec/apache22/mod_status.so
LoadModule autoindex_module libexec/apache22/mod_autoindex.so
LoadModule asis_module libexec/apache22/mod_asis.so
LoadModule info_module libexec/apache22/mod_info.so
LoadModule cgi_module libexec/apache22/mod_cgi.so
LoadModule dav_fs_module libexec/apache22/mod_dav_fs.so
LoadModule vhost_alias_module libexec/apache22/mod_vhost_alias.so
LoadModule negotiation_module libexec/apache22/mod_negotiation.so
LoadModule dir_module libexec/apache22/mod_dir.so
LoadModule imagemap_module libexec/apache22/mod_imagemap.so
LoadModule actions_module libexec/apache22/mod_actions.so
LoadModule speling_module libexec/apache22/mod_speling.so
LoadModule userdir_module libexec/apache22/mod_userdir.so
LoadModule alias_module libexec/apache22/mod_alias.so
LoadModule rewrite_module libexec/apache22/mod_rewrite.so
LoadModule php5_module        libexec/apache22/libphp5.so

<IfModule dir_module>
    DirectoryIndex index.html index.php index.php4 index.shtml
</IfModule>

<IfModule mod_php5.c>
	AddType application/x-httpd-php .php .php4 .php5
	AddType application/x-httpd-php-source .phps
    </IfModule>

Here is what is returned from trying to run phpinfo.php:

Code:
<html>
<head>
<title>PHP info</title>
</head>

<STYLE TYPE="text/css">
    body { font-family: "Arial"; font-size: 11pt; color: black; background: white; }
    table { font-family: "Arial"; font-size: 10pt; border: 1; cellpadding: 2; }
</STYLE>

<body>
<?
phpinfo();
?>
</body>
</html>
 
still no php output

I installed the php5-extensions with [cmd=]portupgrade -NCv php5-extensions[/cmd] Not having it installed was most likely why I got the
Code:
session_start() could not be found
error.

I still get the php source instead of the php output even if I try a program where I use the full <?PHP ?> tags.
 
Apache's httpd.conf has to be modified to interpret PHP. See /usr/ports/lang/php5/pkg-message.mod. There might be more than that.
 
still no php output

I did a post upgrade of Apache and have checked that libphp5.so has read permission for www.
I still do not get any PHP programs to execute, instead the source is displayed. There must be something missing, but I do not see what it is. Is there some other file I need to check for permission or existence?

I can execute cgi-bin perl program successfully.

I have attached 3 files in tar format. httpd.conf.tar, httpd-vhosts.conf.tar, and phpinfoCLI.tar. phpinfoCLI.tar is a tar of the results returned by a CLI output of phpinfo.php

Any ideas?

Thanks
 
I compared your httpd.conf with my working one, and the only really essential difference is the following extra <IfModule ...> block in your httpd.conf:
Code:
<IfModule mod_php5.c>
	AddType application/x-httpd-php .php .php4 .php5
	AddType application/x-httpd-php-source .phps
    </IfModule>

In my httpd.conf, the PHP related AddType definitions are part of the <IfModule mime_module> block below the DefaultType setting (Note: I don't say that this is perfect, however, it has the big advantage that it works).

Code:
#
# DefaultType: the default MIME type the server will use for a document
# if it cannot otherwise determine one, such as from filename extensions.
# If your server contains mostly text or HTML documents, "text/plain" is
# a good value.  If most of your content is binary, such as applications
# or images, you may want to use "application/octet-stream" instead to
# keep browsers from trying to display binary files as though they are
# text.
#
DefaultType text/plain

<IfModule mime_module>
    #
    # TypesConfig points to the file containing the list of mappings from
    # filename extension to MIME-type.
    #
    TypesConfig etc/apache22/mime.types

    #
    # AddType allows you to add to or override the MIME configuration
    # file specified in TypesConfig for specific file types.
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
    #
    #AddType application/x-gzip .tgz
    #
    # AddEncoding allows you to have certain browsers uncompress
    # information on the fly. Note: Not all browsers support this.
    #
    #AddEncoding x-compress .Z
    #AddEncoding x-gzip .gz .tgz
    #
    # 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

    #
    # AddHandler allows you to map certain file extensions to "handlers":
    # actions unrelated to filetype. These can be either built into the server
    # or added with the Action directive (see below)
    #
    # To use CGI scripts outside of ScriptAliased directories:
    # (You will also need to add "ExecCGI" to the "Options" directive.)
    #
    #AddHandler cgi-script .cgi

    # For type maps (negotiated resources):
    #AddHandler type-map var

    #
    # Filters allow you to process content before it is sent to the client.
    #
    # 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>

I would suggest that you try the following:
  1. Rewrite your <IfModule mod_php5.c> to <IfModule php5_module>, i.e. without the ".c".
  2. If this doesn't help, then move your <IfModule php5_module> block below the <IfModule mime_module> block.
  3. If this doesn't help, then completely remove it, and throw the PHP-AddType definitions into the <IfModule mime_module> block.
 
Back
Top