Jump to content

[SOLVED] Not sure PHP is working correctly


Recommended Posts

Okay, I am a complete newb to php (well, I worked with it SOME to get SugarCRM up and running, which I was able to to easily).

 

However, now I am trying to simply set up a clean installation of Apache2.2, MySQL, and PHP 5.

 

I am kicking myself in the butt here because I am trying to test to see if PHP is working correctly by creating the phpinfo.php file.

 

(Basically, a doc created in notepad with <? phpinfo(); ?>, saved as phpinfo.php).

 

I also added the following to the php.ini file:

 

ScriptAlias /php "c:/server/php/"

AddType application/x-httpd-php .php

Action application/x-httpd-php "/php/php-cgi.exe"

 

So when I open my browser and go to http://localhost/phpinfo.php  (by the way, the phpinfo.php file is in my htdocs folder - I do not get the screen listing all of my info with the PHP logo and whatnot at the top. When I open it in Explorer, I get promted to download the file or open it in Notepad. If I try in firefox, it simply displays the code I typed in the document.

 

So I am guessing that Apache is not handling the php files or something correctly, but I have NO idea what. Any suggestions? Thanks.

 

Mike

Link to comment
Share on other sites

Hey thanks for the response. Unfortunately, that still does not make it work. I actually already tried that and then set the short-tags option to yes in my php.ini file and tried the short way too. I am sure this is just a way that apache is handling php files, but I thought I added the correct handling instructions, or so I thought. I do not know what the issue is, but I am willing to bet I am missing something in the php.ini file - I am just not sure what. I will comb it over to check and see - this may not be fruitful as I am still learning what all of the php code is and what it is doing. It is just strange that it is prompting me to download it.

 

Is there more than one place I need to add anything in the php.ini file for the previous 3 additions that I mentioned?

 

By the way, I think I left out that this is on a Windows Machine (running Vista Ultimate).

 

Mike

 

EDIT - Actually, I mispoke, those three lines I added in the httpd.conf file, not php.ini - sorry.

Link to comment
Share on other sites

Load PHP as an Apache Module instead (remove any lines you added).

Use the following lines in Apaches configuration file (httpd.conf)

 

LoadModule php5_module "C:/server/php/php5apache2_2.dll"
PHPIniDir "C:/Server/php"

AddType application/x-httpd-php .php 

Thats it. Save the httpd.conf and restart Apache.

 

You must go to http://localhost to run your php scripts. You cannot simply open them up in your web browser, using 'open with' or 'file open'

 

Also never use short tags in your php scripts.

Link to comment
Share on other sites

Hey, thanks for that. Actually, I solved THAT problem by simply using my httpd.conf.bak file, readded all the appropriate lines, saved as httpd.conf and I am in business, but with new errors! I noticed that some of the lines that I added were already added by default at the bottom of the page, not sure why - therefore, I had a couple of lines that were on there twice. Probably my problem.

 

Yeah, I was calling the from http://localhost, but was still getting prompted to download. I just didn't have the php files being handled correctly. (Oh, I also changed PATH under Environment Variables, or added rather, C:\Server\PHP\ - not sure if that had anything to do with it or not).

 

Now I am getting two more errors that are driving me crazy, because as I see it everything is right. When I load phpmyadmin and log in, I am getting:

 

"The mbstring PHP extension was not found and you seem to be using a multibyte charset. Without the mbstring extension phpMyAdmin is unable to split strings correctly and it may result in unexpected results."

 

-and-

 

"Cannot load mcrypt extension. Please check your PHP configuration."

 

 

The latter also shows up at the log in screen.

 

I have both extension=php_mbstring.dll and extension=php_mcrypt.dll uncommented in my php.ini file. I also have the correct extension path set to C:\Server\PHP\ext   

 

Both dll's are actually in the ext file and libmcrypt.dll is in my System32 folder.

 

This is all I can find to do via an extensive internet search.

 

I realize I made a no no by posting this in this thread, since it is unrelated, so I will post it as it's own topic in a minute.

 

I am using this on Windows Vista Ultimate x86 and wondering if permissions have something to do with it, but I doubt it - I checked those too.

 

Any suggestions on that?

 

Mike

 

 

Link to comment
Share on other sites

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.