My Server : Win server 2012 64bit, Apache 2.4 64bit, PHP Version 5.6.13 (x64)
After install Apache 2.4, i can start normal.
But If i add PHP to httpd.conf
PHPIniDir "C:\php"
LoadModule php5_module "C:\php\php5apache2_4.dll"
I can't start apache, it show message:
Windows could not start the Apache2.4 on Local Computer. For more information, review the System Event Log. If this is a non-Microsoft service, contact the service vendor, and refer to service-specific error code 1.
why can't start apache if add PHPIniDir Setting to httpd.conf?
I test on Win 7, it is ok.
The cause : my php using php_com_net.dll
So i have to install: MSVC11 (Visual C++ 2012)
Related
I have a server that run Centos 6. Recently I upgrade the php to 7.2 using remi repo and apache 2.4 using the sclo(httpd24).
[user#server1 ~]$ httpd -v
Server version: Apache/2.4.34 (Red Hat)
Server built: May 28 2020 08:47:33
[user#server1 ~]$ php -v
PHP 7.2.33 (cli) (built: Aug 4 2020 10:02:54) ( NTS )
My issue is if i put an phpinfo() in /var/www/html, my browser didn't show anything, and if i open the source i only see the php code.
How do i connect the apache and php together?
Thanks..
Have you made sure that inside the apache server configuration httpd.conf file you are correctly pointing to the php.so file??
You need to make sure the LoadModule php7_module /path/to/the/php#7.2/version/libphp7.so line is in your configuration. If you recently changed the PHP to 7.2 you need to modify the line so it points to the correct php version.
In my case I use the php 7.2, 7.3 and 7.4 versions for different purposes and inside my httpd.conf file i have the following lines:
#LoadModule php7_module /usr/local/opt/php#7.2/lib/httpd/modules/libphp7.so
#LoadModule php7_module /usr/local/opt/php#7.3/lib/httpd/modules/libphp7.so
LoadModule php7_module /usr/local/opt/php#7.4/lib/httpd/modules/libphp7.so
As you can see each version point to a different so file, you need to find the correct one for the 7.2 version and point to it by commenting or uncommenting them depending on the php version.
I upgrade the php to 7.2 using remi
Package in my repository are build against base httpd version 2.2.
You still can use httpd 2.4 (from SCL), but in this case you need to use FPM
Read: PHP Configuration Tips
BTW, as CentOS 6 is close to its end of life (in a few months), I heartily recommend you use a more recent version of CentOS (7 or 8 both have httpd 2.4 by default)
my machine: macOS Sierra 10.12.3
I am currently working on a project that requires some PHP v.>=5.6 features. When I start my virtual php server with XAMPP 1.8.3 and check the php info it tells me the version is 5.5.11.
I tried updating the php version following this tutorial https://jason.pureconcepts.net/2016/09/upgrade-php-mac-os-x/
upon updating my local .bash_profile path and checking php -v I get the upgraded php version PHP 7.1.1 (cli) (built: Feb 13 2017 10:05:49) ( NTS )
But when I check the phpinfo on my apache server run by xampp I still see 5.5.11 I updated the httpd.conf file and commented the old php versions out and implemented the new one, but that doesn't seem to have any effect.
<IfDefine JUSTTOMAKEAPXSHAPPY>
#LoadModule php4_module modules/libphp4.so
#LoadModule php5_module modules/libphp5.so
LoadModule php7_module /usr/local/php5/libphp7.so
</IfDefine>
Any other ideas?
Thank you for your help!
It would be easier to install a new version of XAMPP.
Another solution would be to install Apache/PHP from homebrew.
Are you sure that you update the try apache conf file? It should be in "xampp" directory. Anyway you can just download a new version xampp, e. g. from here https://www.apachefriends.org/ru/download.html
In terminal,
php -v
gives
PHP 5.3.29 (cli) (built: Sep 28 2015 06:33:13)
(with imagick installed) but, in the browser (using apache)
phpinfo();
gives
PHP Version 5.5.27
(with no imagick installed) How do I resolve this?
I don't want to mess about with php.ini and httpd.conf when I'm not entirely sure what I'm doing!
Solved it. I entered
locate libphp5.so
into terminal to find paths to the php installations. This outputted
/usr/libexec/apache2/libphp5.so
/usr/local/Cellar/php53/5.3.29_4/libexec/apache2/libphp5.so
I then edited the apache configuration file
sudo nano /private/etc/apache2/httpd.conf
and changed
LoadModule php5_module libexec/apache2/libphp5.so
to
LoadModule php5_module /usr/local/Cellar/php53/5.3.29_4/libexec/apache2/libphp5.so
NOTE : This line will be different for your local installation, copy the value outputted from the locate command above
I then restarted apache with:
sudo apachectl graceful
Credit to this solution for the command to find the php installations
This may be a help to you : Upgrade to PHP 5.4 on MAC and remove version 5.3.10
I would suggest that you work in a virtual setup instead.
like Vagrant: https://www.vagrantup.com/
Also take a look at Homestead: http://laravel.com/docs/4.2/homestead
"Laravel Homestead is an official, pre-packaged Vagrant "box" that provides you a wonderful development environment without requiring you to install PHP, HHVM, a web server, and any other server software on your local machine.
"
It will also allow you to keep your configuration if you change machine and/or operating system.
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'm on Windows 7 and I have installed Apache 2.2, PHP 5 (latest stable build) and MySQL.
I have configured PHP 5 with Apache 2.2 as a module (i.e. LoadModule and AddType statements added in httpd.conf).
Everything seems to work when I start Apache from the console (command prompt) but PHP would not work when the Apache service is started. In this configuration, the localhost/index.php ends up getting downloaded in the browser. Why is that?
My guess is that the Apache Service loads up its own version httpd.conf file. Anybody faced similar problems?
DO note:
- I know of XAMPP, WAMP etc and I don't want to use them
- I don't want to use PHP as CGI
I finally switched to XAMPP. But I feel this has to do with some of the default security settings in Windows 7. WinXP gives me no problem.