I'm using a stand alone server (Not connected to the internet) which contains Apache server (httpd service) and php version 5.5 (installed with ./configure, make & make install).
This 2 applications were installed separately.
How can I config my Apache server to work with that php?
Unfortunately I can't use yum.
Thanks.
You have apache and php already installed on your server. So you just need to configure apache to work with PHP.
Configure Apache to run PHP as a Module
Add the following line in httpd.conf file if it's not already there,
LoadModule php5_module modules/libphp5.so
Tell Apache to parse certain extensions as PHP
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
And restart apache (httpd) server,
service httpd restart
refer php.net for more details.
Related
In order to download PHPMyAdmin, I have to download its Prerequisites i.e apache & for apache Microsoft Visual Studio C++ 2019 than MySQL than PHP, and right after installing apache I run 'httpd' in cmd, http.exe file couldn't be opened but when I tried to open a browser and type localhost on address bar I received msg "it works!" and then when I start installing PHP I edit below lines in httpd.conf
index.php right after index.html &
LoadModule php7_module C:/php/php7apache2_4.dll
<IfModule php7_module>
AddHandler application/x-httpd-php .php
PHPIniDir "C:/php"
</IfModule>
and than i tried to start apache HTTP server from windows service but its showing the below error and then to resolve it I somehow got to know about XAMPP further I download XAMPP too with a little changes in ports it also starts apache 2.4 and MySQL but still not the APACHE HTTP SERVER
I've been running a development site with Apache 2.2, PHP5.2 and MySql using, in part, software obfuscated with ZendGuard (version unknown). The actual online hosting sight is discontinuing PHP5.2 forcing an upgrade to PHP5.4. I've ended up uninstalling Apache and PHP. I can get Apache 2.4 running; however, if I understand right ZendGuard requires a non thread safe version of PHP5.4. I can not figure out how to install PHP5.4 nts on my Windows pc to work with Apache2.4.
Here's the link to the non thread safe windows pre-compiled version of PHP
For Apache on Windows, it's recommended to use the VC11 Apache lounge build: here
You'll need to add the following lines in Apache's httpd.conf:
LoadModule php5_module "c:/php/php5apache2_2.dll" #or wherever you put it
AddHandler application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir "C:/php" #your path
I'm not too familiar with ZendGuard, but once you have the Apache server configured for php I'm sure it will just be a case of trivial configuration.
I am setting up a test server before upgrading an elderly version of mediawiki on a production server. I am trying to duplicate what will be on the production server - apache2.4 and php5.3.
When I try to access any php file, the server displays it as text rather than running it.
This is all running on Ubuntu 12.04 LTS. The apache package available is version 2.2, so I can't simply apt-get.
I have built apache 2.4 from source, and it correctly serves an index.html from my designated DocumentRoot.
In httpd.conf, I have added:
DocumentRoot = /var/www
AddType application/x-httpd-php .php
<filesMatch>"\.php$:"
SetHandler application/x-httpd-php .php
</filesMatch>
I have installed php5.3, and it is working - I can run phpinfo.php from a command line.
In /etc/php5/apache2/php.ini I have (error displays are for testing only):
engine = On
display_errors = On
display_startup_errors = On
doc_root = /var/www
I am not able to find a reference to a mod_php of any sort either in the httpd.conf or in the directory in which httpd is installed (/usr/local/apache2).
Some of the references on the web mention "modules-available" and "modules-enabled" but these appear to be a convenience added by Debian, and are not part of the apache source build.
What am I missing? I'm sure it's something simple.
After searching and using packages from several repositories for both apache and php, and trying to build either or both from source, I determined that there did not seem to be a libphp5.so that was compatible with apache 2.4. In any case, I didn't find it.
I reconfigured everything to use php as cgi rather than as a module, and got things working that way, which was enough for my intended purpose.
You need to load php module in httpd.conf:
On my Linux Slackware I have this in /etc/httpd/mod_php.conf
LoadModule php5_module lib/httpd/modules/libphp5.so
# Tell Apache to feed all *.php files through PHP. If you'd like to
# parse PHP embedded in files with different extensions, comment out
# these lines and see the example below.
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
And in /etc/httpd/httpd.conf:
# php
Include /etc/httpd/mod_php.conf
I run a Windows 7 x64 machine with apache 2.2 and PHP 5.2.17
Whenever I try to add the PHP dll to the httpd.conf file, apache will not start.
this is how it is being put into httpd.conf
LoadModule php5_module "C:/php/php5apache2_2.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:/php"
I have successfully managed to setup and run a Apache server with PHP before, so I'm not new to this, but I'm fairly certain that this is right.
If everything that's being output on launch is the DNS error, Apache is launching just fine. FQDN resolution is a warning, not an error.
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