[SOLVED] PHP code is not run but attempting to download file

noahwallach

Joined: 2005-04-26
Posts: 94
Posted: Wed, 2006-09-27 13:40


Gallery version (not just "2"): gallery2-2.1.2
PHP version (e.g. 4.3.11): php4-4.4.4
PHPInfo Link (see FAQ):
Webserver (e.g. Apache 1.3.33): apache-2.2.3
Database (e.g. MySql 4.0.11): mysql-server-4.0.27
Activated toolkits (e.g. NetPbm, GD): gd-2.0.33_4,1 netpbm-10.26.30
Operating system (e.g. Linux): FreeBSD 4.11-RELEASE-p3
Browser (e.g. Firefox 1.0): FF 1.5.0.7

I am attempting to fix a friend's installation of gallery2. When I goto the URL http://hostname/gallery/upgrade/index.php the file is wanted to be downloaded instead of being run as a php file.

what do I need to fix here?

Cheers,

noah

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2006-09-27 13:42

that's usually a symptom of a php error.

check out the apache error logs.

 
noahwallach

Joined: 2005-04-26
Posts: 94
Posted: Wed, 2006-09-27 15:36

thanks for your response.

it is a virtual host and nothing is appearing in the relevant virtual host error logs. what else can I check?

 
noahwallach

Joined: 2005-04-26
Posts: 94
Posted: Wed, 2006-09-27 16:07

just a follow up when I go to the http://domain.com/gallery page. I see the following in the access_log for the particular domain.

----- snip ------

66.IP - - [27/Sep/2006:08:46:15 -0700] "GET /gallery HTTP/1.1" 301 369 "-" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7"
66.IP - - [27/Sep/2006:08:46:15 -0700] "GET /gallery/ HTTP/1.1" 302 - "-" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7"
66.IP - - [27/Sep/2006:08:46:15 -0700] "GET /gallery/main.php HTTP/1.1" 302 - "-" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7"

---- snip ---

nothing appears in the error log
and I arrive at the URL in my browser navigator bar:

http://www.domain.com/gallery/install/

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2006-09-27 16:47

the above log shows nothing for the /gallery/upgrade/index.php

 
noahwallach

Joined: 2005-04-26
Posts: 94
Posted: Wed, 2006-09-27 17:09

yeah that is peculiar. so what does that mean? there is nothing in the relevant error log. what else could show me whats going on?

cheers,

Noah

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2006-09-27 17:30

please post a phpinfo link.
and ensure that php's memory limit is really large (e.g. 64M) and error_reporting is set to E_ALL.

 
noahwallach

Joined: 2005-04-26
Posts: 94
Posted: Wed, 2006-09-27 19:56

the phpinfo.php page wants to be downloaded and is not executable from the browser.
but looking through the /usr/local/etc/php.ini I find the following from grep:

memory_limit = 128M ; Maximum amount of memory a script may consume (8MB)
error_reporting = E_ALL

what else could I check?

Cheers,

Noah

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2006-09-27 20:45

are you sure php works on that box?

please post a link to the phpinfo file.

 
noahwallach

Joined: 2005-04-26
Posts: 94
Posted: Wed, 2006-09-27 20:54

Hi valiant,

php is working fine. gallery is working fine under other virtual hosts.

http://www.vaporvent.com/gallery/setup/phpinfo.php

cheers,

Noah

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2006-09-27 22:10

not on this one...
a phpinfo script like <?php phpinfo(); ?> is pretty much the simplest php script.
or <?php print "hello"; ?>

check with your webhost about this issue.

 
noahwallach

Joined: 2005-04-26
Posts: 94
Posted: Wed, 2006-09-27 22:33

I am the admin of the box. I will try the php script.

cheers,

Noah

 
noahwallach

Joined: 2005-04-26
Posts: 94
Posted: Thu, 2006-09-28 03:01

check the php info page out now.

http://www.vaporvent.com/gallery/phpinfo.php

but still the install/index.php wants to be downloaded.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2006-09-28 11:10

set
display_errors to On
display_startup_errors On
and notice that error_log is set to log to the syslog at the moment!

then restart apache and check again.

 
noahwallach

Joined: 2005-04-26
Posts: 94
Posted: Thu, 2006-09-28 16:42

okay done

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2006-09-28 17:13

please ensure that php logs to your apache error log or specify a log file and then check if really no errors are logged.

 
noahwallach

Joined: 2005-04-26
Posts: 94
Posted: Thu, 2006-09-28 17:35

how can I insure my php logs to my apache error log? or how do I specify a log file?

looks like they are cufrrently ending up in /var/log/messages

Cheers,

Noah

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2006-09-28 17:49

error_log in php.ini

well, as long as you know where it's logged, that's fine. is there no php error logged in /var/log/messages ?

 
noahwallach

Joined: 2005-04-26
Posts: 94
Posted: Thu, 2006-09-28 17:59

no php errors
but apache is leaving a signal 11
there is no core file in /tmp from apache.

so I dont know what is going on .

Sep 28 10:53:36 httpd: PHP Warning: Function registration failed - duplicate name - session_name in Unknown on line 0
Sep 28 10:53:36 httpd: PHP Warning: Function registration failed - duplicate name - session_module_name in Unknown on line 0
Sep 28 10:53:36 httpd: PHP Warning: Function registration failed - duplicate name - session_save_path in Unknown on line 0
Sep 28 10:53:36 httpd: PHP Warning: Function registration failed - duplicate name - session_id in Unknown on line 0
Sep 28 10:53:36 httpd: PHP Warning: Function registration failed - duplicate name - session_regenerate_id in Unknown on line 0
Sep 28 10:53:36 httpd: PHP Warning: Function registration failed - duplicate name - session_decode in Unknown on line 0
Sep 28 10:53:36 httpd: PHP Warning: Function registration failed - duplicate name - session_register in Unknown on line 0
Sep 28 10:53:36 httpd: PHP Warning: Function registration failed - duplicate name - session_unregister in Unknown on line 0
Sep 28 10:53:36 httpd: PHP Warning: Function registration failed - duplicate name - session_is_registered in Unknown on line 0
Sep 28 10:53:36 httpd: PHP Warning: Function registration failed - duplicate name - session_encode in Unknown on line 0
Sep 28 10:53:36 httpd: PHP Warning: Function registration failed - duplicate name - session_start in Unknown on line 0
Sep 28 10:53:36 httpd: PHP Warning: Function registration failed - duplicate name - session_destroy in Unknown on line 0
Sep 28 10:53:36 httpd: PHP Warning: Function registration failed - duplicate name - session_unset in Unknown on line 0
Sep 28 10:53:36 httpd: PHP Warning: Function registration failed - duplicate name - session_set_save_handler in Unknown on line 0
Sep 28 10:53:36 httpd: PHP Warning: Function registration failed - duplicate name - session_cache_limiter in Unknown on line 0
Sep 28 10:53:36 httpd: PHP Warning: Function registration failed - duplicate name - session_cache_expire in Unknown on line 0
Sep 28 10:53:36 httpd: PHP Warning: Function registration failed - duplicate name - session_set_cookie_params in Unknown on line 0
Sep 28 10:53:36 httpd: PHP Warning: Function registration failed - duplicate name - session_get_cookie_params in Unknown on line 0
Sep 28 10:53:36 httpd: PHP Warning: Function registration failed - duplicate name - session_write_close in Unknown on line 0
Sep 28 10:53:36 httpd: PHP Warning: Function registration failed - duplicate name - session_commit in Unknown on line 0
Sep 28 10:53:36 httpd: PHP Warning: session: Unable to register functions, unable to load in Unknown on line 0
Sep 28 10:53:55 /kernel: pid 73876 (httpd), uid 80: exited on signal 11
Sep 28 10:53:55 /kernel: pid 73868 (httpd), uid 80: exited on signal 11
Sep 28 10:57:25 /kernel: pid 73866 (httpd), uid 80: exited on signal 11
Sep 28 10:57:25 /kernel: pid 73994 (httpd), uid 80: exited on signal 11
Sep 28 10:57:46 /kernel: pid 73996 (httpd), uid 80: exited on signal 11

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2006-09-28 18:07

what about using the last stable release of apache instead of the current stable / new release?
maybe use another php version...

 
noahwallach

Joined: 2005-04-26
Posts: 94
Posted: Thu, 2006-09-28 18:15

any clues what the last stable release of apache is/was?

cehers,

Noah

 
noahwallach

Joined: 2005-04-26
Posts: 94
Posted: Thu, 2006-09-28 18:18

I upgraded to php5-5.1.6

and see the following errors:

Sep 28 11:17:33 typhoon httpd: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20050922/fileinfo.so' - Cannot open &quot;/usr/local/lib/php/20050922/fileinfo.so&quot; in Unknown on line 0
Sep 28 11:17:33 typhoon httpd: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20050922/pcre.so' - Cannot open &quot;/usr/local/lib/php/20050922/pcre.so&quot; in Unknown on line 0
Sep 28 11:17:33 typhoon httpd: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20050922/session.so' - Cannot open &quot;/usr/local/lib/php/20050922/session.so&quot; in Unknown on line 0
Sep 28 11:17:33 typhoon httpd: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20050922/mysql.so' - Cannot open &quot;/usr/local/lib/php/20050922/mysql.so&quot; in Unknown on line 0
Sep 28 11:17:33 typhoon httpd: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20050922/session.so' - Cannot open &quot;/usr/local/lib/php/20050922/session.so&quot; in Unknown on line 0
Sep 28 11:17:33 typhoon httpd: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20050922/ftp.so' - Cannot open &quot;/usr/local/lib/php/20050922/ftp.so&quot; in Unknown on line 0
Sep 28 11:17:33 typhoon httpd: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20050922/ctype.so' - Cannot open &quot;/usr/local/lib/php/20050922/ctype.so&quot; in Unknown on line 0
Sep 28 11:17:33 typhoon httpd: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20050922/ldap.so' - Cannot open &quot;/usr/local/lib/php/20050922/ldap.so&quot; in Unknown on line 0
Sep 28 11:17:33 typhoon httpd: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20050922/mbstring.so' - Cannot open &quot;/usr/local/lib/php/20050922/mbstring.so&quot; in Unknown on line 0
Sep 28 11:17:33 typhoon httpd: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20050922/iconv.so' - Cannot open &quot;/usr/local/lib/php/20050922/iconv.so&quot; in Unknown on line 0
Sep 28 11:17:33 typhoon httpd: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20050922/gettext.so' - Cannot open &quot;/usr/local/lib/php/20050922/gettext.so&quot; in Unknown on line 0

 
noahwallach

Joined: 2005-04-26
Posts: 94
Posted: Thu, 2006-09-28 18:19

now when I try to go to the main page of a working gallery. I see the folllowing:

Sep 28 11:18:21 httpd: PHP Fatal error: Call to undefined function preg_match() in /a/www/data/www.domain.com/gallery/index.php on line 38

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2006-09-28 18:27

i no longer can access your phpinfo.

@preg_match:
g2 requires PHP compiled with PCRE regular expressions.

 
noahwallach

Joined: 2005-04-26
Posts: 94
Posted: Thu, 2006-09-28 18:47

now I am trying to upgrade gallery to gallery2 I am getting hte following error

Fatal error: Call to undefined function session_name() in /a/www/data/www.enabled.com/gallery/upgrade/index.php on line 74

I am runnning a portupgrade -Rr php5-5.1.6
to make sure that all dependencies are upgraded as lwel

 
noahwallach

Joined: 2005-04-26
Posts: 94
Posted: Thu, 2006-09-28 18:48

how do I ensure PHP is compiled with PCRE regular expression.

 
noahwallach

Joined: 2005-04-26
Posts: 94
Posted: Thu, 2006-09-28 18:50

here are the PHP options I chose.

lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk
x Options for php5 5.1.6 x
x lqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqk x
x x [X] CLI Build CLI version x x
x x [X] CGI Build CGI version x x
x x [X] APACHE Build Apache module x x
x x [X] DEBUG Enable debug x x
x x [ ] SUHOSIN Enable Suhosin protection system x x
x x [ ] MULTIBYTE Enable zend multibyte support x x
x x [X] IPV6 Enable ipv6 support x x
x x [X] REDIRECT Enable force-cgi-redirect support (CGI only) x x
x x [ ] DISCARD Enable discard-path support (CGI only) x x
x x [X] FASTCGI Enable fastcgi support (CGI only) x x
x x [X] PATHINFO Enable path-info-check support (CGI only) x x
x x x x
x x x x
x x x x
x x x x
tqmqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqjqu

 
noahwallach

Joined: 2005-04-26
Posts: 94
Posted: Thu, 2006-09-28 19:21

the phpinfo URL is working again

http://www.vaporvent.com/gallery/phpinfo.php

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2006-09-28 19:50

you need php with pcre, the session extension, ...

 
noahwallach

Joined: 2005-04-26
Posts: 94
Posted: Thu, 2006-09-28 20:02

okay I figured out how to do that. Iam going ot add those extentions to php5

 
noahwallach

Joined: 2005-04-26
Posts: 94
Posted: Thu, 2006-09-28 20:17

okay gallery is still complaining and not seeing that php5-session is installed.

Fatal error: Call to undefined function session_name() in /a/www/data/www.domain.com/gallery/upgrade/index.php on line 74

pkg_info

# pkg_info | grep php
php5-5.1.6 PHP Scripting Language (Apache Module and CLI)
php5-ctype-5.1.6 The ctype shared extension for php
php5-dom-5.1.6 The dom shared extension for php
php5-extensions-1.0 A "meta-port" to install PHP extensions
php5-gettext-5.1.6 The gettext shared extension for php
php5-iconv-5.1.6 The iconv shared extension for php
php5-mysql-5.1.6 The mysql shared extension for php
php5-pcre-5.1.6 The pcre shared extension for php
php5-posix-5.1.6 The posix shared extension for php
php5-session-5.1.6 The session shared extension for php
php5-simplexml-5.1.6 The simplexml shared extension for php
php5-sqlite-5.1.6 The sqlite shared extension for php
php5-tokenizer-5.1.6 The tokenizer shared extension for php
php5-xml-5.1.6 The xml shared extension for php
php5-xmlreader-5.1.6 The xmlreader shared extension for php
php5-xmlwriter-5.1.6 The xmlwriter shared extension for php
php5-zlib-5.1.6 The zlib shared extension for php

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2006-09-28 21:10

edit php.ini

these are shared extensions (.so files), you need to enable them in php.ini and then you need to restart php.

 
noahwallach

Joined: 2005-04-26
Posts: 94
Posted: Thu, 2006-09-28 22:21

okay this is working now - thank you