LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-02-2007, 12:12 PM   #1
sharky
Member
 
Registered: Oct 2002
Posts: 569

Rep: Reputation: 84
Prompted to Open/Save php files


Attempting, for the first time, to setup apache2, php5 and mysql/mysqli. I can load my index.html and I can load phpinfo.php ( contains <?php phpinfo(); ?> ) and it works. I see the php info displayed in the browser ( the latest firefox ) as expected.

When I load http://localhost/phpMyAdmin/index.php I get prompted to load/save the file. For grins I saved it and gets saved as <CRYPTICNAME>.phtml - where <CRYPTICNAME> looks like some random meaningless text. It gets a different name everytime. In an editor I see that <CRYPTICNAME>.phtml just a copy of the index.php file.

Any ideas on why some php files are interpreted and others are not?
 
Old 03-02-2007, 03:00 PM   #2
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
Quote:
Any ideas on why some php files are interpreted and others are not?
If "<?php phpinfo(); ?>" works but your index.php does not, it would seem likely that is where the problem is. Can we see this file?
 
Old 03-02-2007, 03:53 PM   #3
sharky
Member
 
Registered: Oct 2002
Posts: 569

Original Poster
Rep: Reputation: 84
Quote:
Originally Posted by bulliver
If "<?php phpinfo(); ?>" works but your index.php does not, it would seem likely that is where the problem is. Can we see this file?
At work right now so can't get to the file but it's the index.php, as is, that comes with the phpMyAdmin package.
 
Old 03-02-2007, 04:07 PM   #4
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
Quote:
At work right now so can't get to the file but it's the index.php, as is, that comes with the phpMyAdmin package.
Dunno, but seems to me a file distributed with a package should work all right. Perhaps the file uses short (ie: <? ?>) or ASP-style (ie: <% %>) instead of normal long tags, and your php.ini is not set up to handle them.

Test again with both when you get home, and test with some simple php pages as well (ie: <?php echo "this shoul work"; ?>) and try to narrow down the causes of failure.
 
Old 03-03-2007, 12:20 AM   #5
sharky
Member
 
Registered: Oct 2002
Posts: 569

Original Poster
Rep: Reputation: 84
it gets weirder

I made a backup of my index.php file and then deleted everything from the original and put only <?php echo "Hello!" ?> and it prompted for a load/save. I copied a php counter script into my phpmyadmin page and it worked. I renamed it index.php and was again prompted to load/save!

I renamed my phpmyadmin directory to phpMyAdmin and it seemed to work. I got other errors;
"Fatal error: Call to undefined function PMA_getenv() in /var/www/phpMyAdmin/index.php on line 50"

I'm sure that's some normal config issues so I consider this issue resolved.

Thanks for the help.
 
Old 03-04-2007, 02:00 AM   #6
TylerD75
Member
 
Registered: Aug 2004
Location: Norway
Distribution: Gentoo
Posts: 96

Rep: Reputation: 18
My guess is that your mime-types are wrong/missing:
Have you checked if you have this file: /etc/apache2/modules.d/70_mod_phpX.conf? (or something similar)
If not try creating it, but call it 70_mod_php5.conf (if you are using php5):
Code:
<IfDefine PHP5>
  <IfModule !mod_php5.c>
     LoadModule php5_module  modules/libphp5.so
  </IfModule>

  <IfModule mod_mime.c>
     AddType application/x-httpd-php .php   # If the file is there, just make sure this is present
     AddType application/x-httpd-php .phtml 
     AddType application/x-httpd-php .php3
     AddType application/x-httpd-php .php4
     AddType application/x-httpd-php .php5
     AddType application/x-httpd-php-source .phps
  </IfModule>
  
  AddDirectoryIndex index.php index.phtml
</IfDefine>
If you're using php4, there should be a similar file, but with references to php4 instead (obviously).
There's also a possibility you might have to fill this in your httpd.conf if the modules folder isn't present.

If, on the other hand, the file is there, AND the content is the same as above then you have to make sure you've got APACHE_OPTS set with "-D PHP5" (or -D PHP4 if you're using php4). Although if OPTS is wrong, it's very strange that .html files with php content works.

Hope this helps. But if not, please post your version of Apache and PHP?

Last edited by TylerD75; 03-04-2007 at 02:07 AM.
 
  


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
windows client prompted for pw on open Samba share RedPlanet Linux - Software 1 11-07-2006 09:12 AM
can't save or open files efus Linux - Software 3 08-05-2006 10:04 AM
Can not save PHP session in MySQL tonyl Programming 3 08-03-2006 02:39 AM
Suse 10 NFS - cannot open/save files mopic Linux - Networking 3 04-15-2006 04:24 AM
php save file as ... ... Xiangbuilder Programming 1 11-25-2003 10:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:44 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