PHP Not working; PHP-HTML works and not works

Win7; 64bit; Apache/2.2.25 (Win32); PHP/5.3.28; mysql-workbench; PHPmyadmin; Drupal; Not using drupal in this case. Only HTML and PHP. Going from HTDOCS in Apache. Index.html in the HTDOCS directory does show the “IT WORKS” test. Can also do the PHPinfo.php from HTDOCs Directory. The app I am trying to run is in the HTDOCs directory inside a subdirectory, in this case, A or B.

PROBLEM: 1st case (Directory A - with only PHP and HTML web pages) PHP works in HTML when I start the app and click on an option and click on the Submit button which is strictly HTML then passes thru a complete PHP program which in turn call a HTML-PHP webpage. If I don’t do this PHP does not work and I only get the section of the code on the screen in between the HTML. If I tried to start PHP by itself I only get to see the code if it comes from HTML web page. If try to run on its own I get a blank page like when there are errors in PHP.

2nd case (Directory B - same app but different Directory with drupal stuff) is that I do not get anything but a blank page. I start the app with the HTML web page and do click over an option and click the submit button but only get a blank page like when I have errors in PHP. I believe there are no errors b/c it exactly the same code.

I been researching this for a couple of days and found and tried the following but it did not help or maybe I used them incorrectly.
A: directory - my lastest attempt was to remove everything that was neede and left the HTML and PHP web pages.

B: put an empty .htaccess file in Directory B and tried the following lines. By what I understand if the .htaccess is in the same folder than it takes priority over the original .htaccess which I do not know where it resides. Some of these I found in this forum (felgall:Stephen J Chapman).

THIS THE ORIGINAL LINE #AddType application/x-httpd-php .php .html

I tried them as other persons said to do it and then I tried them all at the same time.
#RemoveHandler .html .htm
#AddType application/x-httpd-php .php .php4 .php3 .phtml .html .htm .shtml
#AddHandler application/x-httpd-php5 .html .htm .shtml
#AddType application/x-httpd-php-source .phps
#AddType text/html .shtml
#AddHandler server-parsed .html
#AddHandler server-parsed .shtml
#AddHandler php-cgi .html .htm .php
#Options Indexes FollowSymLinks Includes

Any help will be greatly appreciated.

Hi pdrhdez, welcome to the forums

The # at the beginning of a line signifies that it is a comment - it gets ignored.

Try removing them and restarting your localhost server.

Thanks. Did without the # but still the same problem.

[s]Sorry, I just noticed you said “htaccess”
These lines should be in your “php.ini” file

The one is for the Apache server, the other for the PHP engine.[/s]

Edit:

:d’oh:

Are you trying to install an application on your computer for testing purpose? Is that a “live” server?
How did you install Apache, PHP, etc.? Manually? With Wamp? Something else?

this i test server which was intalled manually, first apache, 2nd php, 3rd mysql, 4th phpmyadmin and 5th drupal but this code is outside of drupal.

Its a good practice to separate PHP from HTML anyway, its not a bad thing that embeded PHP is not working for you. ^^

Now which lines go in the httpd.conf and php.ini. Tried a couple in httpd.conf and now the html portion that was working does no longer work and I just shows the php code.

I removed the lines to get back to where I was but it did not change back. Is there another place where the system updates?

Sorry for all this trouble.

If you’ve replaced them with your original backup files, or are certain you’ve restored them to original condition, them I’m wondering if it’s a PATH variable you messed up on.

What did you add to it?

Installing everything separately using Windows binaries is a nightmare. You cannot get an updated version of PHP to work with an updated version of Apache because nobody bothered to update the SAPI. Your version of PHP (5.3.28) is very out of date. It will no longer be supported in a few months, so you might as well get rid of it now.

Your best option is to uninstall all that stuff and download and install XAMPP or another such program that will install recent versions of all those programs for you that works pretty much right away with little configuration.

Installing a bundle might be easier.

I also have Windows 7
I prefer separate installs, but you do have a point.
The newest version I can get to work with my version of Apache (ver. 2.2) is PHP 5.4.23
So until I’m able to upgrade my Apache I’m unable to upgrade to a newer PHP version.

EDIT
I see XAMPP has

v1.8.3-3

Updated PHP to 5.5.9
Updated MySQL to 5.6.16
Updated phpMyAdmin to 4.1.6
Updated Apache to 2.4.7
Fixed Mercury issue with queue folder
Fixed issue with intl on Windows
Fixed InnoDB issue with hard drives greater than 2TB
Fixed XAMPP new security concept rules
Fixed XSS issues in XAMPP web application

I don’t use phpMyAdmin, but I see my MySQL is also a bit dated. Time for me to get at it.

I used to prefer separate installs. Last September or around that point in time I was setting up a development server on my Win7 computer. I downloaded the most recent binaries available for Windows. PHP would not work with Apache because the SAPI was not current. It took me hours to figure that out. I could not find anything current available. I could use out-of-date Windows installation binaries or go with XAMPP. Before installing XAMPP, I read about compiling everything to work on Windows using Visual Studio. That’s an even bigger nightmare. The people at Apache Friends do it all for us and they know what they are doing. They seem to be pretty good at keeping current with new releases, with a lag of no more than a few weeks.

I am currently researching virtualizing a Linux distribution within Windows 7 so I can use memcache(d). That’s not available on Windows, not even using XAMPP from what I can see.

The line I added was
#AddType application/x-httpd-php .php .html

After seeing all the comments, it is better to uninstall apache, php, mysql, phpmyadmin and drupal and install XAMP?

I don’t know if it’s better, but it would be easier. Seeing as the version compatibilty issues are resolved for you I’m guessing it is better as well.

When you install them seperately you need to add the PATH to your system variables so they can find each other.
Using a bundle would save you from needing to do that.

I don’t know what you meant by only a quote?

But I have to make a big apology. I was totally wrong about php.ini, those lines do indeed belong in htaccess http://httpd.apache.org/docs/current/mod/mod_mime.html#addtype I don’t know where my brain was at :blush:
“Handlers” https://httpd.apache.org/docs/2.2/mod/mod_mime.html#addhandler

Anyway, I’ll try to roughly translate the directives
#RemoveHandler .html .htm
– If a Handler was previously Added (eg. in a higher level htaccess file) it’s Removed from these file types

#AddType application/x-httpd-php .php .php4 .php3 .phtml .html .htm .shtml
#AddHandler application/x-httpd-php5 .html .htm .shtml
– parse the files as PHP files

#AddType application/x-httpd-php-source .phps
– parse the files as PHP-source files

#AddType text/html .shtml
– parse the files as HTML files

#AddHandler server-parsed .html
#AddHandler server-parsed .shtml
#AddHandler php-cgi .html .htm .php
– I have no idea what “server-parsed” is and the “php-cgi” doesn’t look right to me.

In any case. I think this might do better in the Server Configuration, Apache & URL Rewriting forum for the time being so I’m moving it there

aerver-parsed means HTML that uses limited server side processing such as include statements eg. <!–#include file=“footer.html” –>

http://en.wikipedia.org/wiki/Server_Side_Includes lists all the available commands you can add to the HTML.

Again thank for your help but have started the removal. Have downloaded xampp. Ran into another problem, how do you uninstall phpmyadmin? Saw the unistall for mysql and its other components, for php and apache but not for phpmyadmin. Did research but only found sftwr to remove it. Any suggestions?

You should just be able to delete the phpMyAdmin files as it does not install as far as I can remember.

When you install XAMPP, it will suggest installing in a /xampp folder on your C: drive. Let it install there. After it is installed, you should ensure that XAMPP runs “as administrator” by right-clicking on the icon in the start menu and selecting “run as administrator”. When the XAMPP control panel starts, it checks to see if it is running with administrator privileges and will note that with a line: “Running with Administrator rights - good!”

Other than that, if you have any problems make sure your firewall software allows connections (from localhost) to ports 80 and 443. Getting a development server up and running with current versions of Apache, MySQL, phpMyAdmin, and PHP should be effortless.