Jump to content

Recommended Posts

File test.php with <?php phpinfo(); ?> downloads, does not run?

 

I had Apache 2,214 and PHP 5.3.0 working fine (including above), but just installed PHP 5.3.1. Initially Apache would not start, after a lot of headaches and web searches, I found that commenting out  PHP.ini line would solve this problem:

 

[php_MSSQL]

;extension=php_mssql.dll

 

(Following further advice, I commented out all the extensions except extension=php_mysql.dll  extension=php_mysqli.dll  extension=php_openssl.dll)

 

Apache now appears to be working, most of my HTML files and PHP code appear to work, with the exception of a simple PHP script to test PHP, PHPinfo(). When I attempt to run this, (using Google Chrome), it downloads the php file, rather than running it?

 

The PHP file simply contains one line:

<?php phpinfo(); ?>

 

Why does this file now download rather than giving me my system PHP information

Link to comment
https://forums.phpfreaks.com/topic/191800-php-531-apache-2214-phpinfo-not-working/
Share on other sites

I believe I have overcome this, but dont really know what problem was. It is strange (at least to me who is  just a month into my personal PHP journey).

 

It is something to do with this specific file. If I use phpinfo() within another script it works fine. I have created a new file test2.php with the same text

 

<?php phpinfo(); ?>

 

and this works. I have even shut down PC and tried test.php again, but it still downloads. It appears to be something to do with caching of the test.php file. I even deleted test.php and then renamed test1.php to test.php, but this still downloaded.

 

I think I will just delete this file and move on. However, if someone has the answer as to why a php file would download, rather than opening (or how to investigate the reason), I would be interested.

 

FYI, PHP 3.5.0 was removed using Windows add/remove program. (I uninstalled PHP 3.5.0 as it was installed without PEAR options, which I wanted to try). I no longer had the 3.5.0 installer , so downloaded 3.5.1 (php-5.3.1-Win32-VC6-x86.msi on my XP machine). After rebooting I installed 3.5.1 with the msi installer (and also selected the optional PEAR installation). Most likely related is that when I tried running go-pear.bat from the php directory I get the Windows command line screen error..

 

phar "C:\Program Files\PHP\PEAR\go-pear.phar" does not have a signaturePress any

key to continue . . . I still have this problem to resolve.

 

Thanks

It may be your browsers cache causing the download. Try clearing your browsers cache and try test.php again.

 

For some reason go-pear.bat does not work properly only Windows. For a work a round open a command line and cd to your PHP installation folder, eg

cd C:/Program Files/PHP

 

Now run the following command

php.exe -d phar.require_hash=0 go-pear.phar

 

You should be able to setup pear now

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.