How to configure PHP under Apache web server in GENTOO Operating System? - php

is there anyone who knows how to install / configure php under apache?
I have emerge php apache both.
I wanted to use mod_php for apache in GENTOO OS.
php temp.php
command line runs fine, but http://localhost/temp.php is not executing on web server instead it shows the content of the php code.

I found a blog and I followed his instruction and it works !
I'm sharing the solution Referenced Blog
I put these lines in /etc/make.conf:
USE="apache2 mysql php pam ssl xml xml2 berkdb innodb jpeg png"
If you want to install also phpmyadmin, then you should also add pcre session unicode:
USE="apache2 mysql php pam ssl xml xml2 berkdb innodb jpeg png pcre session unicode"
I then changed the file /etc/init.d/apache2, in order to enable public_html folders for users (corresponding to the ~ directory), setting -D USERDIR:
APACHE2_OPTS="-D DEFAULT_VHOST -D PHP5 -D USERDIR
Before starting mysql, you must create (once and for all) the mysql main database, and this can be done simply by running:
/usr/bin/mysql_install_db

There appear to be a number of ways to achieve this but many seem a bit out of date or overly complicated. As of Feb 1 2010 all I did to get PHP and Apache2 working on Gentoo was to install Apache and PHP like this:
bash$ emerge apache
Followed the instructions for the particular extensions I wanted at this list at the Gentoo site
NOTE: this is the important one to get Apache and PHP working together:
bash$ echo "dev-lang/php apache2" >> /etc/portage/package.use
Another common PHP extension:
bash$ echo "dev-lang/php mysql" >> /etc/portage/package.use
And so on.
Then just run bash$ emerge dev-lang/php and restart Apache with the /etc/init.d/apache2 script. PHP should now be available.

You may find some informations in Apache 2.0 on Unix systems
Especially, the
LoadModule php5_module modules/libphp5.so
and
SetHandler application/x-httpd-php
Lines should help :-)
The corresponding lines I have in my Apache's configuration (Apache 2, PHP 5.2, Ubuntu) are :
LoadModule php5_module /usr/lib/apache2/modules/libphp-5.2.9.so
<IfModule mod_php5.c>
AddType application/x-httpd-php .php .phtml
AddType application/x-httpd-php-source .phps
</IfModule>

above link dead, try this one:
http://overlays.gentoo.org/proj/php/

Try to use official GENTOO documentation:
http://www.gentoo.org/proj/en/php/php4-php5-configuration.xml

Related

Why does phpinfo() in webpage show version 5.6, but php -v from command line shows 7.3?

Have read previous answers and understand that I must have two versions installed, but cannot locate where the 5.6 could be. I changed /etc/bin/php to point to the version 7.3 I installed using brew. I updated the /etc/apache2/httpd.conf to use php#7.3. I restarted the server to be sure it would start apache reading from the httpd.conf. Yet, when I run phpinfo from the webpage, It starts with 5.6 and does not include the http.conf info about the server administrator, yet it says it's using http.conf. For some reason sudo apachectl restart will not work saying that the port is already in use. I removed the /usr/local/php5 link ( renamed it to php5.bak ), so that it would not be used.
What other things should I look at?
When you use php -v command you use php-cli which can be diffrent version.
Also if you have multiple versions installed you may want disable apache module for old one.
sudo a2dismod php5 // disable php5.6
sudo a2enmod php7.3 // enable php7.3
There can be many different things that are causing it but I'm betting on MacOS Apache that's installed with the system. Try killing it from the startup:
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
I have found a "partial" answer. I am running Mac OS X 10.12.6 on a mac-mini as a web server. The location of the configuration file for apache is:
/Library/Server/web/config/apache2/httpd_server_app.conf
Thus all of the /etc/apache2/httpd.conf and other suggestions, while they work fine on many unix and even OS X ( non-server ) where one has used brew to install, they don't work here. I made some changes in the above file and verified that AFTER going to the Server app, selecting WebSites in the services menu, and clicking toggling the ON/OFF button to off, then back to on, the server is restarted. All of the attempts using different apache2ctl restart, etc. do not work.
I am still somewhat puzzled that I don't see the server administrator that I enter showing up in the phpinfo.php display, but some other changes did.
My next quest, and suggestions are welcome, is how to change the http_server_app.conf file so that instead of php5, it will use my php7 that is available from the command line. The attempt to change:
LoadModule php5_module libexec/apache2/libphp5.so
#LoadModule php7_module libexec/apache2/libphp7.so
did not work as libphp7.so could not be located. I'm now looking for it. At one point in the conference file, I find:
<IfModule php5_module>
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
</IfModule>
Will I need to have one like this for php7_module, once I find it and use it above?

Apache download php code instead of executing it in aws server (laravel web apps) [duplicate]

OS and server information:
CentOS 6.4 (Final)
Apache 2.2.15
PHP 5.5.1
I previously had php 5.3.x installed but decided to upgrade. I first uninstalled the php 5.3.x and then installed php 5.5.1 but after the installation completed apache did not parse the php files it just downloaded them. I have checked similar questions here in stackoverflow but none of them have helped me so far.
For the record I have the following lines in my httpd.conf and php.conf that should make php work but don't:
AddHandler application/x-httpd-php .php5 .php4 .php .php3 .php2 .phtml
AddType application/x-httpd-php .php5 .php4 .php .php3 .php2 .phtml
AddType application/x-httpd-php-source .phps
AddHandler php5-script .php
I would really appreciate any help.
Thank you.
EDIT:
I have these lines in the php.conf
<IfModule !worker.c>
LoadModule php5_module modules/libphp5.so
</IfModule>
<IfModule worker.c>
LoadModule php5_module modules/libphp5-zts.so
</IfModule>
EDIT:
By removing the
AddType application/x-httpd-php .php5 .php4 .php .php3 .php2 .phtml
apache no longer downloads the file. Now apache is showing the source code, but not all of it just part. I added
AddType text/html .php
but no luck.
The correct AddType for php is application/x-httpd-php
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
Also make sure your php module is loaded
LoadModule php5_module modules/mod_php55.so
When you're configuring apache then try to view the page from another browser - I've had days when chrome stubbornly caches the result and it keeps downloading the source code while in another browser it's just fine.
I came across this issue today and none of the solutions described worked for me. So here is another possible cause:
If you have something like
AddHandler x-mapp-php6 .php3 .php4 .php .phtml
in a .htaccess file of your web content folder, it can cause your PHP scripts to stop working. In my case the server did not know the x-mapp-php6 type, since that .htaccess file was something I imported from a different web host when I transferred the website content.
Just removing the AddHandler line from the .htaccess file solved it for me.
After struggling a lot I finally solved the problem.
If you are prompted to download a .php file instead of executing it, then here is the perfect solution: I assume that you have installed PHP5 already and still getting this error.
$ sudo su
$ a2enmod php5
This is it.
But If you are still getting the error :
Config file php5.conf not properly enabled: /etc/apache2/mods-enabled/php5.conf is a real file, not touching it
then do the following:
Turns out files shouldn't be stored in mods-enabled, but should rather be stored in mods-available. A symlink should then be created in mods-enabled pointing to the file stored in mods-available.
First remove the original:
$ mv /etc/apache2/mods-enabled/php5.conf /etc/apache2/mods-available/
Then create the symbolic link:
$ ln -s /etc/apache2/mods-available/php5.conf /etc/apache2/mods-enabled/php5.conf
I hope your problem is solved.
Please take a look at your addtype directives.
It looks to me like Apache is telling the browser that it's sending a document type of application/php for scripts with extensions like .php5. In fact Apache is supposed to tell the browser that the script is outputting text/html.
Please try this:
AddType text/html .php
Regarding the suggestion above that you should tell the browser that you are outputting a PHP script: It seemed like an unusual idea to me. I googled it and found that there is quite a bit of discussion about it on the web. Apparently there are cases where you might want to say that you are sending a PHP script (even though Apache is supposed to execute the script and emit text/html,) and there are also cases where the browser simply doesn't recognize that specific Mime Type.
Clearing your browser cache is always a good idea.
In case it's helpful here's a copy of my /etc/httpd/conf.d/php.conf file from a server running CentOS 5.9:
#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#
<IfModule prefork.c>
LoadModule php5_module modules/libphp5.so
</IfModule>
<IfModule worker.c>
LoadModule php5_module modules/libphp5-zts.so
</IfModule>
#
# Cause the PHP interpreter to handle files with a .php extension.
#
AddHandler php5-script .php
AddType text/html .php
#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php
#
# Uncomment the following line to allow PHP to pretty-print .phps
# files as PHP source code:
#
#AddType application/x-httpd-php-source .phps
If Your .htaccess have anything like this ...
AddHandler application/x-httpd-php53 .php .php5 .php4 .php3
then comment it and try again refreshing this worked for me...
This might be happening due to the missing modules required for your php.
Assuming you have php7 installed, search available php7 modules using
sudo apt-cache search php7-*
Above command will list all available PHP7 modules for installation.
You can begin installation of modules like,
sudo apt-get install libapache2-mod-php7.0 php7.0-mysql php7.0-curl php7.0-json
I have the same problem. Apache doesn't load php files from a certain website, just downloaded it. I read this post and the answers and I have seen I've got this line into the last place of the .htaccess file:
AddHandler x-mapp-php5.5 .php
I have commented it and everything works fine.
Thanks to all !!!
After updating PHP to 7.3, PHP scripts where run with www-data instead of $USER like before.
I needed to reinstall and activate PHP-FPM :
sudo apt-get install php-fpm
sudo a2enmod proxy_fcgi setenvif
sudo service apache2 restart
sudo a2enconf php7.3-fpm
sudo service apache2 restart
To ensure everything was ok for Virtualmin, i used the Re-Check Configuration wizard /virtual-server/check.cgi, under Vitualmin/System Settings.
After that, Apache/PHP was downloading php files instead of running them. So i needed to edit /etc/apache2/mods-available/php7.3.conf to comment the row SetHandler application/x-httpd-php like below :
<FilesMatch ".+\.ph(ar|p|tml)$">
# SetHandler application/x-httpd-php
</FilesMatch>
After restarting Apache, it solved my issue, hope this help.
Take care of browser cache too.
My system :
Ubuntu 16.04.6 LTS
Webmin version 1.932
Usermin version 1.780
Virtualmin version 6.08
Apache version 2.4.41
PHP versions 7.3.12
PHP-FPM 7.3.12 Server
I previously has a similar issue, after upgrading from 5.3 to 5.4. But my setup looks a little bit different as that I'm running Debian and using fcgid to server the PHP pages, and not the PHP5 apache/cgi module.
So after I upgraded, it also installed php5_cgi, which collided with my fcgid setup, and would not execute PHP files anymore.
I had to disable the Apache Module and restart Apache
a2dismod php5_cgi
/etc/init.d/apache2 restart
Once the php5_cgi module was out of the way, fcgid was able to serve PHP pages again.
I had similar symptoms, yet another solution:
in /etc/apache2/mods-enabled/php5.conf there was a helpful advice in the comment, which I followed:
# To re-enable php in user directories comment the following lines
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
I spent two days tracking this and found out that I was putting my PHP scripts in the wrong directory.
On my standard Ubuntu installation, I was putting the scripts in /var/www. They should have been in /var/www/html.
I just started PHP work, so I don't know if my solution relates to the version change you went through.
In case someone is using php7 under a Linux environment
Make sure you enable php7
sudo a2enmod php7
Restart the mysql service and Apache
sudo systemctl restart mysql
sudo systemctl restart apache2
Ok... I know that there are 1.000.000 answers to this questions already, - but I have spent at least 6 effective hours, figuring this one out; and I have googled it hundreds of times and not found a single post about it. So I figured that I would add the solution to my problem here.
The conclusion
If I commented these two lines out in my .conf-files in the /etc/apache2/[[SERVER-NAME].conf-file:
php_admin_value engine Off
IPCComTimeout 31
I have no idea what they do or how they got there, - but it is in every one of my .conf-files. And if I remove those lines and ensure that there is a symlink in /etc/apache2/sites-enabled/-folder, then it doesn't download the index.php - and every works as it should.
The entire story
I have VirtualMin installed on an Ubuntu 16.04 VPS. I upgraded to PHP version 7.2. Shortly after that, I updated the Ubuntu-version and struck a 'Kernel Offset: Disabled'-error. So I had to go delete the latest Ubuntu-version, - and when my OS booted up again: BOOM! I got the error that his post talks about: For every site on my VPS, it simply downloaded the index.php instead of showing it.
I tried all kinds of stuff:
Removed PHP7.2 and installed PHP5.6 (I know now, that the PHP-version has nothing to do with it; it's the apache-configuration that needs work).
Tried enabling and disabling apache modules, on the existing installation, but without luck.
Then I removed apache completely and installed it again, where-after the problem was still there!
Tried playing around with the Virutal Server setup in VirtualMin ( Webmin >> Servers >> Apache Webserver ).
Checked the configuration on a single Virtual-server ( Virtualmin >> System Settings >> Re-Check Configuration )... This step was pretty nice, since it told which module in Apache was missing; where-after I could enable it with a2enmod [MODULE_NAME]. And I found the module name by Googling around. I had to active about 6-8 modules, before I got past that step in the validation - and it took a couple of minutes before the cache ran out, - so doing this was a tedious step.
And lastly, I figured out above-written conclusion - together with the symlinks, - and then I got it to work. I had to go through it for every site on my VPS, though.
this solved the problem for me (I have php7 installed):
sudo apt-get install libapache2-mod-php7.0
sudo service apache2 restart
I had this problem. It turned out that I had both nginx and apache installed and automatically starting on boot. The problem was that nginx was binding to the http port first which prevented apache from starting.
It's also possible that you have nginx running but your php is set up to run with apache. To verify, run service nginx status and service apache2 status to see which is running. In the case that nginx is running and apache is not, just run sudo service nginx stop; sudo service apache2 start and your server will now serve php files as expected.
I had this problem and if you actually never played with your server configuration settings, then your problem is 90% in your .htaccess file
You either modify .htaccess file LOCALLY, ore delete it (LOCALLY)
If you have virtualmin try to comment out these lines
in your apache configuration in /etc/apache2/sites-available
#RemoveHandler .php
#RemoveHandler .php7.0
#php_admin_value engine Off
I had a similar problem to the OP when upgrading php5 from an older version, to 5.5.9, which is the version installed with Mint 17.
I'm running a LAMP setup on a machine on my local network, which I use to preview changes to websites before I upload those changes to the actual live server. So I maintain a perfect local mirror of the actual site.
After the upgrade, files which run and display perfectly on the actual site would not display, or would only display html on the local machine. PHP was not parsed. The phpinfo() command worked, so I knew php was otherwise working. The log generated no errors. Viewing the page source showed me the actual php code.
I had constructed a test.php page that contained the following code:
<?php
phpinfo();
?>
This worked. Then I discovered when I changed <?php to <? the command no longer worked. All my php sites use <? instead of <?php which might not be ideal, but it's the reality. I fixed the problem by going to /etc/php5/apache2 , searching for "short_open_tag" and changing the value from Off to On.
If none of the above works,
try commenting out the line
SetHandler ....
and restart apache using
/etc/init.d/httpd restart
It should work!
PHP56
vim /etc/httpd/conf/httpd.conf
LoadModule php5_module libexec/apache/libphp5.so
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
I got this kind of problem. This is how I solve it.
After installed Apache then I installed PHP using this command.
sudo apt-get install php libapache2-mod-php
it executes correctly but I request .php file from Apache, it gives without executing the PHP script.
Then I check PHP is enabled.
$ cd /etc/apache2
$ ls -l mods-*/*php*
but it didn't show any results. I check installed PHP packages.
$ dpkg -l | grep php| awk '{print $2}' |tr "\n" " "
Different type of PHP versions installed to my computer. Then I remove some PHP packages from my previous list, using apt-get purge.
sudo apt-get purge libapache2-mod-php7.0 php7.0 php7.0-cli php7.0-common php7.0-json
I reinstall PHP
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql
Verify that the PHP module is loaded
$ a2query -m php7.0
if not enabled with:
$ sudo a2enmod php7.0
Restart Apache server
$ sudo systemctl restart apache2
Finally, I check PHP process on Apache
create an empty file
sudo vim /var/www/html/info.php
Add this content to info.php & save.
<?php
phpinfo();
?>
Check on browser:
http://localhost/info.php
it shows correctly.I think this will help anyone.
For people who have found this post from Google almost 6 years in the future (and beyond!), you may run into this problem with Apache 2 and PHP 7 while also using the UserDir module.
Another possible cause of this problem could be that you are trying to run the script in a "user directory" from the the UserDir module. Running PHP scripts in user directories is disabled by default. You will run into this problem if the script is in the public_html directory in your home folder and you are trying to access it from http://localhost/~your_username.
To fix this, open up /etc/apache2/mods-enabled/php7.2.conf. You must comment or delete the tag block at the bottom that reads
<IfModule mod_userdir.c>
<Directory /home/*/public_html>
php_admin_flag engine Off
</Directory>
</IfModule>
I had the same problem after using zypper rm php* to uninstall PHP and installing it again with zypper in php7 php7-gd php7-gettext php7-mbstring php7-mysql php7-pear
I solved it by enabling the apache2 module and restarting the webserver:
a2enmod php7 && service apache2 restart
When i upgraded from PHP 7.2 to PHP 7.4, i also got same issue. Worked by doing following:-
In [domain].conf file, commented following:
php_admin_value engine Off
And Added:
AddType application/x-httpd-php-source .phps
AddType text/html .php
Disable mod 7.2 and enable 7.4 by following:
a2dismod php7.2
a2enmod php7.4
In /etc/apache2/mods-enabled/php7.4.conf file, comment following:
SetHandler application/x-httpd-php
php_admin_flag engine Off
If Your .htaccess have anything like this
AddType application/x-httpd-ea-php56 .php .php5 .phtm .html .htm
Had numerous attempts fixing my problem realizing the exact same behavior was fixed somehow by clearing my browsers cache. Give it a go.

PHP File is downloaded instead of being executed [duplicate]

OS and server information:
CentOS 6.4 (Final)
Apache 2.2.15
PHP 5.5.1
I previously had php 5.3.x installed but decided to upgrade. I first uninstalled the php 5.3.x and then installed php 5.5.1 but after the installation completed apache did not parse the php files it just downloaded them. I have checked similar questions here in stackoverflow but none of them have helped me so far.
For the record I have the following lines in my httpd.conf and php.conf that should make php work but don't:
AddHandler application/x-httpd-php .php5 .php4 .php .php3 .php2 .phtml
AddType application/x-httpd-php .php5 .php4 .php .php3 .php2 .phtml
AddType application/x-httpd-php-source .phps
AddHandler php5-script .php
I would really appreciate any help.
Thank you.
EDIT:
I have these lines in the php.conf
<IfModule !worker.c>
LoadModule php5_module modules/libphp5.so
</IfModule>
<IfModule worker.c>
LoadModule php5_module modules/libphp5-zts.so
</IfModule>
EDIT:
By removing the
AddType application/x-httpd-php .php5 .php4 .php .php3 .php2 .phtml
apache no longer downloads the file. Now apache is showing the source code, but not all of it just part. I added
AddType text/html .php
but no luck.
The correct AddType for php is application/x-httpd-php
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
Also make sure your php module is loaded
LoadModule php5_module modules/mod_php55.so
When you're configuring apache then try to view the page from another browser - I've had days when chrome stubbornly caches the result and it keeps downloading the source code while in another browser it's just fine.
I came across this issue today and none of the solutions described worked for me. So here is another possible cause:
If you have something like
AddHandler x-mapp-php6 .php3 .php4 .php .phtml
in a .htaccess file of your web content folder, it can cause your PHP scripts to stop working. In my case the server did not know the x-mapp-php6 type, since that .htaccess file was something I imported from a different web host when I transferred the website content.
Just removing the AddHandler line from the .htaccess file solved it for me.
After struggling a lot I finally solved the problem.
If you are prompted to download a .php file instead of executing it, then here is the perfect solution: I assume that you have installed PHP5 already and still getting this error.
$ sudo su
$ a2enmod php5
This is it.
But If you are still getting the error :
Config file php5.conf not properly enabled: /etc/apache2/mods-enabled/php5.conf is a real file, not touching it
then do the following:
Turns out files shouldn't be stored in mods-enabled, but should rather be stored in mods-available. A symlink should then be created in mods-enabled pointing to the file stored in mods-available.
First remove the original:
$ mv /etc/apache2/mods-enabled/php5.conf /etc/apache2/mods-available/
Then create the symbolic link:
$ ln -s /etc/apache2/mods-available/php5.conf /etc/apache2/mods-enabled/php5.conf
I hope your problem is solved.
Please take a look at your addtype directives.
It looks to me like Apache is telling the browser that it's sending a document type of application/php for scripts with extensions like .php5. In fact Apache is supposed to tell the browser that the script is outputting text/html.
Please try this:
AddType text/html .php
Regarding the suggestion above that you should tell the browser that you are outputting a PHP script: It seemed like an unusual idea to me. I googled it and found that there is quite a bit of discussion about it on the web. Apparently there are cases where you might want to say that you are sending a PHP script (even though Apache is supposed to execute the script and emit text/html,) and there are also cases where the browser simply doesn't recognize that specific Mime Type.
Clearing your browser cache is always a good idea.
In case it's helpful here's a copy of my /etc/httpd/conf.d/php.conf file from a server running CentOS 5.9:
#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#
<IfModule prefork.c>
LoadModule php5_module modules/libphp5.so
</IfModule>
<IfModule worker.c>
LoadModule php5_module modules/libphp5-zts.so
</IfModule>
#
# Cause the PHP interpreter to handle files with a .php extension.
#
AddHandler php5-script .php
AddType text/html .php
#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php
#
# Uncomment the following line to allow PHP to pretty-print .phps
# files as PHP source code:
#
#AddType application/x-httpd-php-source .phps
If Your .htaccess have anything like this ...
AddHandler application/x-httpd-php53 .php .php5 .php4 .php3
then comment it and try again refreshing this worked for me...
This might be happening due to the missing modules required for your php.
Assuming you have php7 installed, search available php7 modules using
sudo apt-cache search php7-*
Above command will list all available PHP7 modules for installation.
You can begin installation of modules like,
sudo apt-get install libapache2-mod-php7.0 php7.0-mysql php7.0-curl php7.0-json
I have the same problem. Apache doesn't load php files from a certain website, just downloaded it. I read this post and the answers and I have seen I've got this line into the last place of the .htaccess file:
AddHandler x-mapp-php5.5 .php
I have commented it and everything works fine.
Thanks to all !!!
After updating PHP to 7.3, PHP scripts where run with www-data instead of $USER like before.
I needed to reinstall and activate PHP-FPM :
sudo apt-get install php-fpm
sudo a2enmod proxy_fcgi setenvif
sudo service apache2 restart
sudo a2enconf php7.3-fpm
sudo service apache2 restart
To ensure everything was ok for Virtualmin, i used the Re-Check Configuration wizard /virtual-server/check.cgi, under Vitualmin/System Settings.
After that, Apache/PHP was downloading php files instead of running them. So i needed to edit /etc/apache2/mods-available/php7.3.conf to comment the row SetHandler application/x-httpd-php like below :
<FilesMatch ".+\.ph(ar|p|tml)$">
# SetHandler application/x-httpd-php
</FilesMatch>
After restarting Apache, it solved my issue, hope this help.
Take care of browser cache too.
My system :
Ubuntu 16.04.6 LTS
Webmin version 1.932
Usermin version 1.780
Virtualmin version 6.08
Apache version 2.4.41
PHP versions 7.3.12
PHP-FPM 7.3.12 Server
I previously has a similar issue, after upgrading from 5.3 to 5.4. But my setup looks a little bit different as that I'm running Debian and using fcgid to server the PHP pages, and not the PHP5 apache/cgi module.
So after I upgraded, it also installed php5_cgi, which collided with my fcgid setup, and would not execute PHP files anymore.
I had to disable the Apache Module and restart Apache
a2dismod php5_cgi
/etc/init.d/apache2 restart
Once the php5_cgi module was out of the way, fcgid was able to serve PHP pages again.
I had similar symptoms, yet another solution:
in /etc/apache2/mods-enabled/php5.conf there was a helpful advice in the comment, which I followed:
# To re-enable php in user directories comment the following lines
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
I spent two days tracking this and found out that I was putting my PHP scripts in the wrong directory.
On my standard Ubuntu installation, I was putting the scripts in /var/www. They should have been in /var/www/html.
I just started PHP work, so I don't know if my solution relates to the version change you went through.
In case someone is using php7 under a Linux environment
Make sure you enable php7
sudo a2enmod php7
Restart the mysql service and Apache
sudo systemctl restart mysql
sudo systemctl restart apache2
Ok... I know that there are 1.000.000 answers to this questions already, - but I have spent at least 6 effective hours, figuring this one out; and I have googled it hundreds of times and not found a single post about it. So I figured that I would add the solution to my problem here.
The conclusion
If I commented these two lines out in my .conf-files in the /etc/apache2/[[SERVER-NAME].conf-file:
php_admin_value engine Off
IPCComTimeout 31
I have no idea what they do or how they got there, - but it is in every one of my .conf-files. And if I remove those lines and ensure that there is a symlink in /etc/apache2/sites-enabled/-folder, then it doesn't download the index.php - and every works as it should.
The entire story
I have VirtualMin installed on an Ubuntu 16.04 VPS. I upgraded to PHP version 7.2. Shortly after that, I updated the Ubuntu-version and struck a 'Kernel Offset: Disabled'-error. So I had to go delete the latest Ubuntu-version, - and when my OS booted up again: BOOM! I got the error that his post talks about: For every site on my VPS, it simply downloaded the index.php instead of showing it.
I tried all kinds of stuff:
Removed PHP7.2 and installed PHP5.6 (I know now, that the PHP-version has nothing to do with it; it's the apache-configuration that needs work).
Tried enabling and disabling apache modules, on the existing installation, but without luck.
Then I removed apache completely and installed it again, where-after the problem was still there!
Tried playing around with the Virutal Server setup in VirtualMin ( Webmin >> Servers >> Apache Webserver ).
Checked the configuration on a single Virtual-server ( Virtualmin >> System Settings >> Re-Check Configuration )... This step was pretty nice, since it told which module in Apache was missing; where-after I could enable it with a2enmod [MODULE_NAME]. And I found the module name by Googling around. I had to active about 6-8 modules, before I got past that step in the validation - and it took a couple of minutes before the cache ran out, - so doing this was a tedious step.
And lastly, I figured out above-written conclusion - together with the symlinks, - and then I got it to work. I had to go through it for every site on my VPS, though.
this solved the problem for me (I have php7 installed):
sudo apt-get install libapache2-mod-php7.0
sudo service apache2 restart
I had this problem. It turned out that I had both nginx and apache installed and automatically starting on boot. The problem was that nginx was binding to the http port first which prevented apache from starting.
It's also possible that you have nginx running but your php is set up to run with apache. To verify, run service nginx status and service apache2 status to see which is running. In the case that nginx is running and apache is not, just run sudo service nginx stop; sudo service apache2 start and your server will now serve php files as expected.
I had this problem and if you actually never played with your server configuration settings, then your problem is 90% in your .htaccess file
You either modify .htaccess file LOCALLY, ore delete it (LOCALLY)
If you have virtualmin try to comment out these lines
in your apache configuration in /etc/apache2/sites-available
#RemoveHandler .php
#RemoveHandler .php7.0
#php_admin_value engine Off
I had a similar problem to the OP when upgrading php5 from an older version, to 5.5.9, which is the version installed with Mint 17.
I'm running a LAMP setup on a machine on my local network, which I use to preview changes to websites before I upload those changes to the actual live server. So I maintain a perfect local mirror of the actual site.
After the upgrade, files which run and display perfectly on the actual site would not display, or would only display html on the local machine. PHP was not parsed. The phpinfo() command worked, so I knew php was otherwise working. The log generated no errors. Viewing the page source showed me the actual php code.
I had constructed a test.php page that contained the following code:
<?php
phpinfo();
?>
This worked. Then I discovered when I changed <?php to <? the command no longer worked. All my php sites use <? instead of <?php which might not be ideal, but it's the reality. I fixed the problem by going to /etc/php5/apache2 , searching for "short_open_tag" and changing the value from Off to On.
If none of the above works,
try commenting out the line
SetHandler ....
and restart apache using
/etc/init.d/httpd restart
It should work!
PHP56
vim /etc/httpd/conf/httpd.conf
LoadModule php5_module libexec/apache/libphp5.so
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
I got this kind of problem. This is how I solve it.
After installed Apache then I installed PHP using this command.
sudo apt-get install php libapache2-mod-php
it executes correctly but I request .php file from Apache, it gives without executing the PHP script.
Then I check PHP is enabled.
$ cd /etc/apache2
$ ls -l mods-*/*php*
but it didn't show any results. I check installed PHP packages.
$ dpkg -l | grep php| awk '{print $2}' |tr "\n" " "
Different type of PHP versions installed to my computer. Then I remove some PHP packages from my previous list, using apt-get purge.
sudo apt-get purge libapache2-mod-php7.0 php7.0 php7.0-cli php7.0-common php7.0-json
I reinstall PHP
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql
Verify that the PHP module is loaded
$ a2query -m php7.0
if not enabled with:
$ sudo a2enmod php7.0
Restart Apache server
$ sudo systemctl restart apache2
Finally, I check PHP process on Apache
create an empty file
sudo vim /var/www/html/info.php
Add this content to info.php & save.
<?php
phpinfo();
?>
Check on browser:
http://localhost/info.php
it shows correctly.I think this will help anyone.
For people who have found this post from Google almost 6 years in the future (and beyond!), you may run into this problem with Apache 2 and PHP 7 while also using the UserDir module.
Another possible cause of this problem could be that you are trying to run the script in a "user directory" from the the UserDir module. Running PHP scripts in user directories is disabled by default. You will run into this problem if the script is in the public_html directory in your home folder and you are trying to access it from http://localhost/~your_username.
To fix this, open up /etc/apache2/mods-enabled/php7.2.conf. You must comment or delete the tag block at the bottom that reads
<IfModule mod_userdir.c>
<Directory /home/*/public_html>
php_admin_flag engine Off
</Directory>
</IfModule>
I had the same problem after using zypper rm php* to uninstall PHP and installing it again with zypper in php7 php7-gd php7-gettext php7-mbstring php7-mysql php7-pear
I solved it by enabling the apache2 module and restarting the webserver:
a2enmod php7 && service apache2 restart
When i upgraded from PHP 7.2 to PHP 7.4, i also got same issue. Worked by doing following:-
In [domain].conf file, commented following:
php_admin_value engine Off
And Added:
AddType application/x-httpd-php-source .phps
AddType text/html .php
Disable mod 7.2 and enable 7.4 by following:
a2dismod php7.2
a2enmod php7.4
In /etc/apache2/mods-enabled/php7.4.conf file, comment following:
SetHandler application/x-httpd-php
php_admin_flag engine Off
If Your .htaccess have anything like this
AddType application/x-httpd-ea-php56 .php .php5 .phtm .html .htm
Had numerous attempts fixing my problem realizing the exact same behavior was fixed somehow by clearing my browsers cache. Give it a go.

PHP files are downloaded instead of being executed [duplicate]

OS and server information:
CentOS 6.4 (Final)
Apache 2.2.15
PHP 5.5.1
I previously had php 5.3.x installed but decided to upgrade. I first uninstalled the php 5.3.x and then installed php 5.5.1 but after the installation completed apache did not parse the php files it just downloaded them. I have checked similar questions here in stackoverflow but none of them have helped me so far.
For the record I have the following lines in my httpd.conf and php.conf that should make php work but don't:
AddHandler application/x-httpd-php .php5 .php4 .php .php3 .php2 .phtml
AddType application/x-httpd-php .php5 .php4 .php .php3 .php2 .phtml
AddType application/x-httpd-php-source .phps
AddHandler php5-script .php
I would really appreciate any help.
Thank you.
EDIT:
I have these lines in the php.conf
<IfModule !worker.c>
LoadModule php5_module modules/libphp5.so
</IfModule>
<IfModule worker.c>
LoadModule php5_module modules/libphp5-zts.so
</IfModule>
EDIT:
By removing the
AddType application/x-httpd-php .php5 .php4 .php .php3 .php2 .phtml
apache no longer downloads the file. Now apache is showing the source code, but not all of it just part. I added
AddType text/html .php
but no luck.
The correct AddType for php is application/x-httpd-php
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
Also make sure your php module is loaded
LoadModule php5_module modules/mod_php55.so
When you're configuring apache then try to view the page from another browser - I've had days when chrome stubbornly caches the result and it keeps downloading the source code while in another browser it's just fine.
I came across this issue today and none of the solutions described worked for me. So here is another possible cause:
If you have something like
AddHandler x-mapp-php6 .php3 .php4 .php .phtml
in a .htaccess file of your web content folder, it can cause your PHP scripts to stop working. In my case the server did not know the x-mapp-php6 type, since that .htaccess file was something I imported from a different web host when I transferred the website content.
Just removing the AddHandler line from the .htaccess file solved it for me.
After struggling a lot I finally solved the problem.
If you are prompted to download a .php file instead of executing it, then here is the perfect solution: I assume that you have installed PHP5 already and still getting this error.
$ sudo su
$ a2enmod php5
This is it.
But If you are still getting the error :
Config file php5.conf not properly enabled: /etc/apache2/mods-enabled/php5.conf is a real file, not touching it
then do the following:
Turns out files shouldn't be stored in mods-enabled, but should rather be stored in mods-available. A symlink should then be created in mods-enabled pointing to the file stored in mods-available.
First remove the original:
$ mv /etc/apache2/mods-enabled/php5.conf /etc/apache2/mods-available/
Then create the symbolic link:
$ ln -s /etc/apache2/mods-available/php5.conf /etc/apache2/mods-enabled/php5.conf
I hope your problem is solved.
Please take a look at your addtype directives.
It looks to me like Apache is telling the browser that it's sending a document type of application/php for scripts with extensions like .php5. In fact Apache is supposed to tell the browser that the script is outputting text/html.
Please try this:
AddType text/html .php
Regarding the suggestion above that you should tell the browser that you are outputting a PHP script: It seemed like an unusual idea to me. I googled it and found that there is quite a bit of discussion about it on the web. Apparently there are cases where you might want to say that you are sending a PHP script (even though Apache is supposed to execute the script and emit text/html,) and there are also cases where the browser simply doesn't recognize that specific Mime Type.
Clearing your browser cache is always a good idea.
In case it's helpful here's a copy of my /etc/httpd/conf.d/php.conf file from a server running CentOS 5.9:
#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#
<IfModule prefork.c>
LoadModule php5_module modules/libphp5.so
</IfModule>
<IfModule worker.c>
LoadModule php5_module modules/libphp5-zts.so
</IfModule>
#
# Cause the PHP interpreter to handle files with a .php extension.
#
AddHandler php5-script .php
AddType text/html .php
#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php
#
# Uncomment the following line to allow PHP to pretty-print .phps
# files as PHP source code:
#
#AddType application/x-httpd-php-source .phps
If Your .htaccess have anything like this ...
AddHandler application/x-httpd-php53 .php .php5 .php4 .php3
then comment it and try again refreshing this worked for me...
This might be happening due to the missing modules required for your php.
Assuming you have php7 installed, search available php7 modules using
sudo apt-cache search php7-*
Above command will list all available PHP7 modules for installation.
You can begin installation of modules like,
sudo apt-get install libapache2-mod-php7.0 php7.0-mysql php7.0-curl php7.0-json
I have the same problem. Apache doesn't load php files from a certain website, just downloaded it. I read this post and the answers and I have seen I've got this line into the last place of the .htaccess file:
AddHandler x-mapp-php5.5 .php
I have commented it and everything works fine.
Thanks to all !!!
After updating PHP to 7.3, PHP scripts where run with www-data instead of $USER like before.
I needed to reinstall and activate PHP-FPM :
sudo apt-get install php-fpm
sudo a2enmod proxy_fcgi setenvif
sudo service apache2 restart
sudo a2enconf php7.3-fpm
sudo service apache2 restart
To ensure everything was ok for Virtualmin, i used the Re-Check Configuration wizard /virtual-server/check.cgi, under Vitualmin/System Settings.
After that, Apache/PHP was downloading php files instead of running them. So i needed to edit /etc/apache2/mods-available/php7.3.conf to comment the row SetHandler application/x-httpd-php like below :
<FilesMatch ".+\.ph(ar|p|tml)$">
# SetHandler application/x-httpd-php
</FilesMatch>
After restarting Apache, it solved my issue, hope this help.
Take care of browser cache too.
My system :
Ubuntu 16.04.6 LTS
Webmin version 1.932
Usermin version 1.780
Virtualmin version 6.08
Apache version 2.4.41
PHP versions 7.3.12
PHP-FPM 7.3.12 Server
I previously has a similar issue, after upgrading from 5.3 to 5.4. But my setup looks a little bit different as that I'm running Debian and using fcgid to server the PHP pages, and not the PHP5 apache/cgi module.
So after I upgraded, it also installed php5_cgi, which collided with my fcgid setup, and would not execute PHP files anymore.
I had to disable the Apache Module and restart Apache
a2dismod php5_cgi
/etc/init.d/apache2 restart
Once the php5_cgi module was out of the way, fcgid was able to serve PHP pages again.
I had similar symptoms, yet another solution:
in /etc/apache2/mods-enabled/php5.conf there was a helpful advice in the comment, which I followed:
# To re-enable php in user directories comment the following lines
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
I spent two days tracking this and found out that I was putting my PHP scripts in the wrong directory.
On my standard Ubuntu installation, I was putting the scripts in /var/www. They should have been in /var/www/html.
I just started PHP work, so I don't know if my solution relates to the version change you went through.
In case someone is using php7 under a Linux environment
Make sure you enable php7
sudo a2enmod php7
Restart the mysql service and Apache
sudo systemctl restart mysql
sudo systemctl restart apache2
Ok... I know that there are 1.000.000 answers to this questions already, - but I have spent at least 6 effective hours, figuring this one out; and I have googled it hundreds of times and not found a single post about it. So I figured that I would add the solution to my problem here.
The conclusion
If I commented these two lines out in my .conf-files in the /etc/apache2/[[SERVER-NAME].conf-file:
php_admin_value engine Off
IPCComTimeout 31
I have no idea what they do or how they got there, - but it is in every one of my .conf-files. And if I remove those lines and ensure that there is a symlink in /etc/apache2/sites-enabled/-folder, then it doesn't download the index.php - and every works as it should.
The entire story
I have VirtualMin installed on an Ubuntu 16.04 VPS. I upgraded to PHP version 7.2. Shortly after that, I updated the Ubuntu-version and struck a 'Kernel Offset: Disabled'-error. So I had to go delete the latest Ubuntu-version, - and when my OS booted up again: BOOM! I got the error that his post talks about: For every site on my VPS, it simply downloaded the index.php instead of showing it.
I tried all kinds of stuff:
Removed PHP7.2 and installed PHP5.6 (I know now, that the PHP-version has nothing to do with it; it's the apache-configuration that needs work).
Tried enabling and disabling apache modules, on the existing installation, but without luck.
Then I removed apache completely and installed it again, where-after the problem was still there!
Tried playing around with the Virutal Server setup in VirtualMin ( Webmin >> Servers >> Apache Webserver ).
Checked the configuration on a single Virtual-server ( Virtualmin >> System Settings >> Re-Check Configuration )... This step was pretty nice, since it told which module in Apache was missing; where-after I could enable it with a2enmod [MODULE_NAME]. And I found the module name by Googling around. I had to active about 6-8 modules, before I got past that step in the validation - and it took a couple of minutes before the cache ran out, - so doing this was a tedious step.
And lastly, I figured out above-written conclusion - together with the symlinks, - and then I got it to work. I had to go through it for every site on my VPS, though.
this solved the problem for me (I have php7 installed):
sudo apt-get install libapache2-mod-php7.0
sudo service apache2 restart
I had this problem. It turned out that I had both nginx and apache installed and automatically starting on boot. The problem was that nginx was binding to the http port first which prevented apache from starting.
It's also possible that you have nginx running but your php is set up to run with apache. To verify, run service nginx status and service apache2 status to see which is running. In the case that nginx is running and apache is not, just run sudo service nginx stop; sudo service apache2 start and your server will now serve php files as expected.
I had this problem and if you actually never played with your server configuration settings, then your problem is 90% in your .htaccess file
You either modify .htaccess file LOCALLY, ore delete it (LOCALLY)
If you have virtualmin try to comment out these lines
in your apache configuration in /etc/apache2/sites-available
#RemoveHandler .php
#RemoveHandler .php7.0
#php_admin_value engine Off
I had a similar problem to the OP when upgrading php5 from an older version, to 5.5.9, which is the version installed with Mint 17.
I'm running a LAMP setup on a machine on my local network, which I use to preview changes to websites before I upload those changes to the actual live server. So I maintain a perfect local mirror of the actual site.
After the upgrade, files which run and display perfectly on the actual site would not display, or would only display html on the local machine. PHP was not parsed. The phpinfo() command worked, so I knew php was otherwise working. The log generated no errors. Viewing the page source showed me the actual php code.
I had constructed a test.php page that contained the following code:
<?php
phpinfo();
?>
This worked. Then I discovered when I changed <?php to <? the command no longer worked. All my php sites use <? instead of <?php which might not be ideal, but it's the reality. I fixed the problem by going to /etc/php5/apache2 , searching for "short_open_tag" and changing the value from Off to On.
If none of the above works,
try commenting out the line
SetHandler ....
and restart apache using
/etc/init.d/httpd restart
It should work!
PHP56
vim /etc/httpd/conf/httpd.conf
LoadModule php5_module libexec/apache/libphp5.so
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
I got this kind of problem. This is how I solve it.
After installed Apache then I installed PHP using this command.
sudo apt-get install php libapache2-mod-php
it executes correctly but I request .php file from Apache, it gives without executing the PHP script.
Then I check PHP is enabled.
$ cd /etc/apache2
$ ls -l mods-*/*php*
but it didn't show any results. I check installed PHP packages.
$ dpkg -l | grep php| awk '{print $2}' |tr "\n" " "
Different type of PHP versions installed to my computer. Then I remove some PHP packages from my previous list, using apt-get purge.
sudo apt-get purge libapache2-mod-php7.0 php7.0 php7.0-cli php7.0-common php7.0-json
I reinstall PHP
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql
Verify that the PHP module is loaded
$ a2query -m php7.0
if not enabled with:
$ sudo a2enmod php7.0
Restart Apache server
$ sudo systemctl restart apache2
Finally, I check PHP process on Apache
create an empty file
sudo vim /var/www/html/info.php
Add this content to info.php & save.
<?php
phpinfo();
?>
Check on browser:
http://localhost/info.php
it shows correctly.I think this will help anyone.
For people who have found this post from Google almost 6 years in the future (and beyond!), you may run into this problem with Apache 2 and PHP 7 while also using the UserDir module.
Another possible cause of this problem could be that you are trying to run the script in a "user directory" from the the UserDir module. Running PHP scripts in user directories is disabled by default. You will run into this problem if the script is in the public_html directory in your home folder and you are trying to access it from http://localhost/~your_username.
To fix this, open up /etc/apache2/mods-enabled/php7.2.conf. You must comment or delete the tag block at the bottom that reads
<IfModule mod_userdir.c>
<Directory /home/*/public_html>
php_admin_flag engine Off
</Directory>
</IfModule>
I had the same problem after using zypper rm php* to uninstall PHP and installing it again with zypper in php7 php7-gd php7-gettext php7-mbstring php7-mysql php7-pear
I solved it by enabling the apache2 module and restarting the webserver:
a2enmod php7 && service apache2 restart
When i upgraded from PHP 7.2 to PHP 7.4, i also got same issue. Worked by doing following:-
In [domain].conf file, commented following:
php_admin_value engine Off
And Added:
AddType application/x-httpd-php-source .phps
AddType text/html .php
Disable mod 7.2 and enable 7.4 by following:
a2dismod php7.2
a2enmod php7.4
In /etc/apache2/mods-enabled/php7.4.conf file, comment following:
SetHandler application/x-httpd-php
php_admin_flag engine Off
If Your .htaccess have anything like this
AddType application/x-httpd-ea-php56 .php .php5 .phtm .html .htm
Had numerous attempts fixing my problem realizing the exact same behavior was fixed somehow by clearing my browsers cache. Give it a go.

Apache/PHP on Windows 8

I'm having trouble with Apache/PHP on Windows 8. I have previously been using them on XP (along with MySQL) with no problems. I never used Windows 7.
Apache installs without issues. Everything works OK, including all my virtual servers.
PHP installs OK, the installation puts entries into httpd.conf without giving errors.
However, when I try to load Apache after installing PHP, Apache won't load.
I'm confused by the error that Apache returns when the PHP entries are included in httpd.conf:
Syntax error on line 1029 of C:/Program Files/Apache Group/Apache2/conf/httpd.conf:
Cannot load C:/Program Files/PHP/php5apache2_2.dll into server: The specified module could not be found.
The lines are:
#BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
PHPIniDir "C:\Program Files\PHP\"
LoadModule php5_module "C:\Program Files\PHP\php5apache2_2.dll"
#END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
(line 1029 is the LoadModule line).
That location for the dll is definitely correct. The syntax of the line is as inserted by PHP. I have compared the syntax to previous versions of httpd.conf that I have and it appears correct. I think the syntax error is a red herring.
I have tried:
Switching backslashes to slashes in the dll location.
Adding PHP to the path.
Installing Apache and PHP in both sequences.
Checking the permissions to the PHP folder and the individual files
to ensure that SYSTEM has read/execute.
Comment out the PHP lines and Apache loads fine. If I comment out the LoadModule line and and just leave the PHPIniDir line, it still fails. Apache seems to be behaving as though it can't see the PHP directory, but I can't work out why.
There is nothing on the Windows event log. Latest versions of PHP and Apache. I'm at a bit of a loss what to try next. Any suggestions please?
Download and follow instructions from this link:
http://www.apachelounge.com/download/
The latest download (2.4) works on Windows 8 and Server 2012.
I downloaded and tested with the following on Windows 8:
Each zip has a readme.txt or install.txt with instructions.
Apache 2.4
http://www.apachelounge.com/download/win32/binaries/httpd-2.4.3-win32.zip
PHP 5.4.8
http://windows.php.net/downloads/releases/php-5.4.8-Win32-VC9-x86.zip
PHP 5.4.8 handler for Apache
http://www.apachelounge.com/download/win32/modules-2.4/php5apache2_4.dll-php-5.4-win32.zip
My httpd.conf lines that were added/modified were:
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule php5_module "C:/Apache24/php-5.4.8/php5apache2_4.dll"
LoadFile "C:/Apache24/php-5.4.8/php5ts.dll"
PHPIniDir "C:/Apache24/php-5.4.8"
<IfModule php5_module>
<Location />
AddType text/html .php
AddHandler application/x-httpd-php .php
#AddHandler application/x-httpd-php-source .phps
</Location>
</IfModule>
Its mentioned in the Readme.txt file packed with the dll's at ApacheLounge, but not anywhere else on the download page or in the filename (as all other versions):
"Runs with PHP 5.4 Thread Safe (TS), and only with Apache 2.4 Win32 VC9 or VC10"
The dlls are only for the TS version, so if you've downloaded the other one, you are basically screwed. TS php binaries fixed it for me.
GL.
Presuming this is your development, not deployment environment, why don't you just download xampp from apache friends? It should come preconfigured, and you will deploy in other setup anyway.
I ran into the similar issue when reinstalling Apache and PHP on Win 8 (I am more Linux user though). And similar to the original post, no matter what I tried to do in httpd.conf and php.ini Apache simply either did not start or did not see the PHP. After spending unreasonable amount of time, I decided to download the PHP 5.3 (5.3.27)-VC9 x86 Thread Safe (2013-Jul-10 21:56:58) Installer [45.86MB] instead of the non-tread safe version which I have been using before. There is a difference in the .msi installers. The one for the thread-safe version actually contains the required files and if you follow the installer prompts it will actually asks you if the php installation should be "linked" to Apache server. Then you just provide the hhtpd.conf directory and all works fine. Thats my 2c on this :)
I think the problem is in the blank "Program Files".

Categories