LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Prompted to Open/Save php files (https://www.linuxquestions.org/questions/linux-server-73/prompted-to-open-save-php-files-533967/)

sharky 03-02-2007 12:12 PM

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?

bulliver 03-02-2007 03:00 PM

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?

sharky 03-02-2007 03:53 PM

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.

bulliver 03-02-2007 04:07 PM

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.

sharky 03-03-2007 12:20 AM

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.

TylerD75 03-04-2007 02:00 AM

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?


All times are GMT -5. The time now is 06:47 PM.