PHP5 - Apache2 - Unable to run basic php script.

Hello.

I am unable to run php script (undefined function php_info()) after fresh install from yast.

Any help is welcome.

+++++++++++++++++++++++

  • Configuration Files +
    +++++++++++++++++++++++

/etc/apache2/conf.d/php5.conf
<IfModule mod_php5.c>
AddHandler application/x-httpd-php .php4
AddHandler application/x-httpd-php .php5
AddHandler application/x-httpd-php .php
AddHandler application/x-httpd-php-source .php4s
AddHandler application/x-httpd-php-source .php5s
AddHandler application/x-httpd-php-source .phps
DirectoryIndex index.php4
DirectoryIndex index.php5
DirectoryIndex index.php
</IfModule>

/etc/apache2/sysconfig.d/LoadModule.conf



LoadModule php5_module /usr/lib64/apache2/mod_php5.so

/etc/sysconfig/apache2



APACHE_MODULES=“actions alias auth_basic authn_file authz_host authz_groupfile authz_default authz_user authn_dbm autoindex cgi dir env expires include log_config mime negotiation setenvif ssl suexec userdir php5”

/var/log/apache2/access_log



127.0.0.1 - - [03/Aug/2008:18:57:51 +0200] “GET /manual/images/up.gif HTTP/1.1” 200 57 “http://localhost/manual/logs.html” “Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.16) Gecko/20080716 SUSE/2.0.0.16-0.1 Firefox/2.0.0.16”

/var/log/apache2/error_log



[Sun Aug 03 19:45:29 2008] [error] [client 127.0.0.1] PHP Fatal error: Call to undefined function php_info() in /srv/www/htdocs/index.php on line 2

++++++++++++++++

  • Script Files +
    ++++++++++++++++

http://localhost/index.php source code (not working → blank page)
<?php
php_info();
?>

http://localhost/index.html source code (working)
<html>
<body>
<h1>
Apache Index.html works!
</h1>
</body>
</html>

+++++++++++++++++++++

  • Mode console info +
    +++++++++++++++++++++

LINUX-SRV: # uname -r
2.6.22.18-0.2-default
LINUX-SRV: #

LINUX-SRV: # rpm -qa | grep apache2
apache2-2.2.4-70.4
apache2-doc-2.2.4-70.4
apache2-devel-2.2.4-70.4
apache2-mod_auth_ntlm_winbind-0.0.0.lorikeet_svn_682-68
apache2-mod_php5-5.2.6-34.2



LINUX-SRV: #

LINUX-SRV: # rpm -qa | grep php
php5-5.2.6-34.2
php-doc-5.2.4-9
php5-devel-5.2.6-34.2
apache2-mod_php5-5.2.6-34.2
php5-mysql-5.2.6-34.2
php5-ldap-5.2.6-34.2



LINUX-SRV: #

LINUX-SRV: # httpd2 -M
Loaded Modules:
core_module (static)
mpm_prefork_module (static)
http_module (static)
so_module (static)
actions_module (shared)
alias_module (shared)
auth_basic_module (shared)
authn_file_module (shared)
authz_host_module (shared)
authz_groupfile_module (shared)
authz_default_module (shared)
authz_user_module (shared)
authn_dbm_module (shared)
autoindex_module (shared)
cgi_module (shared)
dir_module (shared)
env_module (shared)
expires_module (shared)
include_module (shared)
log_config_module (shared)
mime_module (shared)
negotiation_module (shared)
setenvif_module (shared)
ssl_module (shared)
suexec_module (shared)
userdir_module (shared)
php5_module (shared)
Syntax OK
LINUX-SRV: #

LINUX-SRV: # a2enmod php5
“php5” already present
LINUX-SRV: #

It’s phpinfo(), not php_info().

You might find these pages useful:

PHP: PHP Manual - Manual

Hi.

I wrote this phpinfo script because I couldn’t start phpldapadmin.
After correction, phpinfo() script is functionning.

But I still couldn’t start phpldapadmin (Error message on a blank page → Fatal error: Call to undefined function _() in /srv/www/htdocs/phpldapadmin-1.1.0.5/lib/functions.php on line 513 ).

By the way, when I double click on a php file, I get a message from firefox : “what should firefox do with this file ? open with / save ?”

/var/log/apache2/access_log
127.0.0.1 - - [04/Aug/2008:20:02:31 +0200] “GET /phpldapadmin-1.1.0.5/index.php HTTP/1.1” 302 - “-” “Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.16) Gecko/20080716 SUSE/2.0.0.16-0.1 Firefox/2.0.0.16”
127.0.0.1 - - [04/Aug/2008:20:02:31 +0200] “GET /phpldapadmin-1.1.0.5/htdocs/index.php HTTP/1.1” 200 115 “-” “Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.16) Gecko/20080716 SUSE/2.0.0.16-0.1 Firefox/2.0.0.16”

/var/log/apache2/erreur_log
[Mon Aug 04 20:02:31 2008] [error] [client 127.0.0.1] PHP Fatal error: Call to undefined function _() in /srv/www/htdocs/phpldapadmin-1.1.0.5/lib/functions.php on line 513

HI.

But I can run phpMyAdmin ! ! !

Why would that have anything to do with it? It’s a different software package.

It looks like a bug in phpldapadmin. I would ask about it on their forums.

If you really want to double-click on a php file, then you need to change the file association for php files.
Right-click a php file, and select "open with… " and choose a text editor (whatever you have installed, eg I use Quanta). From there you can also set this as the default application for opening php files.

I want to start directly the php file in firefox, not edit the file. I have associated php file with firefox in konkeror but it is not working.
When I double click on htlm file, it opens directky with firefox. I want the same behaviour with php file.

Why would you want to do that? Firefox can’t interpret the php tags and so will probably just display them as text on the page.
Do you want to edit the page (code) or view the final result?

PHP files can only be executed on the server, not in the browser.

Have install phpldapadmin-0.9.8.4 → running

Have reinstall phpldapadmin-1.1.0.5 → now running !!!

winning the lottery is easier than computing.

Thank you for your time.

This thread should be closed.

It’s a bit late as it looks like you got there, but if somebody else should come along and fall over this one (as I did earlier) it’s gettext that is missing from your server (or else the php5 gettext module).

Make sure you’ve got gettext and php5-gettext packages installed - if not, install them and restart apache.