I'm trying to upgrade to PHP7 on Apache 2.4 with Centos 6.7
First, I used yum to install php70w which installs PHP7 with Apache 2.2.
Then I upgraded to Apache 2.4 using yum. This was successful.
I then copied the php7.so files to the Apache 2.4 modules directory and then configured the httpd.conf file to include them.
When I restart httpd24 it produces the following error:
Starting httpd: httpd: Syntax error on line 56 of /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf:
Syntax error on line 1 of /opt/rh/httpd24/root/etc/httpd/conf.modules.d/00-php.conf:
Cannot load modules/libphp7.so into server: /opt/rh/httpd24/root/etc/httpd/modules/libphp7.so:
undefined symbol: unixd_config
I've learned that this is because Apache has changed the name of there API see here. So the php.so files are trying to call the API through the old name.
Is there a way to edit the php.so files? Or is there a location to download updated files?
Or is there a different way I should be going about this update?
You need mod_php specifically built against Apache 2.4. No Apache module works w/o being at least recompiled against 2.2 and 2.4 by design.
Might be wise to take this opportunity to bail on mod_php and configure PHP via fastcgi. The world has really moved on from mod_php.
Related
Just got on a Windows 10 and after I configured my php.ini and http.conf I went on the command line httpd.exe and got this error message:
httpd.exe: Syntax error on line 530 of C:/Apache/conf/httpd.conf: Cannot load C:/php/php7apache2_4.dll into server: The specified module could not be found.
I KNOW this file is in that folder. I've installed both 64 bits version of PHP and Apache and I don't know what's going on.
Check whether you have installed Thread safe version of PHP. Non Thread safe version will cause this error.
You can download thread safe version of PHP here
while you downloading PHP u should select ThreadSafe pack, Apache not supporting nonThreadSafe...
As the others said, the NON Thread safe (nts) does not support apache and u have to install thread safe versions
Which VC compiled version of Apache do you use?
On php.net they recommend to use the apache server from apachelounge.com combined with the threadsafe php files.
Also make sure that you have installed the C++ Redistributable Visual Studio 2015.
If it still fails with that error make sure the user who is starting the process has access to the filesystem.
I was able to overcome this error by uninstalling my previous version of wampserver , then installing the latest version (3.2.0), closer to the php7.4.9 target.
As I previous had php 7.2 with an earlier version of wampserver (can't remember which), none of the above tricks would work for me. I was still getting the error of this topic title. Now working ok.
Reminder: to integrate an external version of php into wamp, rename php.ini-development in folder php7.4.9 into phpForApache.ini
I'm not sure if this is the same problem, but I had an issue that the Apache httpd service would not start when I tried to add the php module to an apache server (httpd.conf). The service would not start. When I looked at the Event Viewer I found an application error event indicating that the service terminate unexpectedly, and it indicated that the problem occurred in Apache24\bin\libapr-1.dll.
The problem was with the LoadModule statement that I added at the end of my httpd.conf file. Here's what I orginally had:
LoadModule php7_module "C:\PHP7\php7apache2_4.dll"
Here's what I changed it to:
LoadModule php7_module C:\PHP7\php7apache2_4.dll
Low and behold, the apache service started, any I was able to execute the phpinfo.php sample script that I added to the Root Document directory. (By the way, forward or backward slashes both work.)
The difference is that I removed the quotes. The quotes were there because I had just copied and pasted from a web page that said how to install PHP.
I had a similar issue and when i looked in the apache24 error log it said something about PHP Warning: 'vcruntime140.dll' 14.0 is not compatible with this PHP build linked with 14.16 in Unknown etc. I had installed a version of vcredist but obviously it needed a more upto date version and found solution here: vcruntime140.dll 14.0 not compatible with PHP build
I've installed PHP with yum install php, after that I've added the following lines in httpd.conf
LoadModule php5_module modules/libphp5.so
....
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
And after that I've copied libphp5.so to /var/apache2/modules. Then I said /etc/apache2/bin/apachectl -k stop and got the following error.
httpd: Syntax error on line 57 of /etc/apache2/conf/httpd.conf: Cannot
load /etc/apache2/modules/libphp5.so into server:
/etc/apache2/modules/libphp5.so: undefined symbol: ap_unixd_config
Installed PHP version is 5.4.41. OS is CentOS Linux release 7.1.1503.
Can someone tell me where the problem is?
UPD Apache version is 2.4.6 (64-bit), line 57 of httpd.conf is LoadModule php5_module modules/libphp5.so
What's odd about this is that you installed PHP using yum and then went to add php.so to Apache. The RPM should do that for you (that's the whole idea behind package managers). In CentOS 7 the .so file is loaded in /etc/httpd/conf.modules.d (you should have a file called something like 10-php.conf). There should also be a /etc/httpd/conf.d/php.conf file where your FilesMatch directive is added. If you are defining these twice you could be causing issues.
I would also suggest that you use a later version of PHP than 5.4 (this version will go into End Of Life when PHP 7.0 is released later this year). If you're not using the Remi repo then I would set that up and you can get 5.5 or 5.6. I am using this myself and have not any of the issues you mention. It could also be that the version of PHP you installed is not compiled for CentOS 7 (this issue is unique to Apache 2.4). Remi does have a CentOS 7 repo.
I know this is my fault. What I did was upgrade my php 5.3 to the latest php5.5. But due to some important reason I need to roll back to my previous php version which is 5.3.10. Upgrading to the latest php5 gave me no sweat but when I roll back it gave me this error:
$ sudo service apache2 start
* Starting web server apache2 apache2: Syntax error on line 210 of /etc/apache2/apache2.conf: Syntax error on line 2 of /etc/apache2/mods-enabled/access_compat.load:
Cannot load /usr/lib/apache2/modules/mod_access_compat.so into server: /usr/lib/apache2/modules/mod_access_compat.so: cannot open shared object file: No such file or directory
Action 'start' failed.
The Apache error log may have more information.
Please help anyone.
Comment line 2 in /etc/apache2/mods-enabled/access_compat.load and all other include problems, 3 for me
I had this problem when downgraded apache from 2.4 to 2.2, so i had to disable the modules there enabled in the 2.4 installation.
a2dismod <module-name>
A fresh download and install of WAMP Server works successfully (Apache 2.4.4 PHP 5.4.12).
However as soon as I install a different version of Apache, in this case 2.4 to 2.0 (so I can run PHP 5.2 & 5.4), WAMP goes offline with an orange icon.
If I try to switch BACK to the original Apache version I get this show-stopping error:
Sorry,
This Apache version doesn't seem to be compatible with your actual PHP Version.
Switch cancelled.
Press ENTER to continue...
This doesn't make any sense, as this is a fresh install so both the Apache + PHP versions are the defaults.
Here's what the UI is telling me:
The WAMP icon is now orange
the Apache/Version/2.4.4 icon has a red warning icon next to it
the Apache/Version/2.0.63 icon has a tick next to it
I've tried installing other versions of Apache too, but the issue seems to be with the base 2.4 WAMP installed options.
Extra info: port 80 is free, and I used to use WS 2.0e all the time without these kinds of issues.
Thanks,
Dave
Go To \wamp\bin\php\phpX.Y.Z\wampmanager.conf.
Edit wampmanager.conf via Notepad++
Add This Codes.. And Save wampmanager.conf
$phpConf['apache']['2.4']['LoadModuleName'] = 'php5_module';
$phpConf['apache']['2.4']['LoadModuleFile'] = 'php5apache2_4.dll';
$phpConf['apache']['2.4']['AddModule'] = '';
Restart Wamp Manager..
just had a similar problem - was upgrading WAMP from Apache 2.2 / PHP 5.3 to Apache 2.4 / PHP 5.4
This is what worked for me:
Stop apache service
Remove the unwanted version's apache service using WAMP manager's 'Remove service' option. (check in Windows services if really removed)
Manually edit the 'wampmanager.conf' in the WAMP's installation directory to use Apache and PHP versions you want to use (sections: 'php', 'phpCli' and 'apache' / properties 'xVersion' and 'xLastKnown')
Shutdown WAMP manager
(Re)Start WAMP manager
(Re)Install the wanted version's apache service using WAMP manager's 'Install service' option. (check in Windows services if really installed)
(Re)Start apache service
NOTE: Always run WAMP manager as admin
... After this phpinfo() shows new Apache and PHP versions and seems to work fine.
Hope it helps.
The problem is WAMP version 2.4. I don't know why but v2.4 is not compatible with addons. Then I tried 2.2E. It was fine with addons.
By the way, addons compiled for 32bit. So do not install 64bit Wamp if you think that you would use addons.
When updating WAMP from 2.2 to 2.4 or switching from Apache 2.2.22/PHP 5.3.13 to Apache 2.4.4/PHP 5.4.12, WAMP installs new service as Apache/2.4.4 (Win64) PHP/5.3.13 to make it use PHP 5.4.12
1) Uninstall apache service
2) Modify
C:\wamp\bin\apache\Apache2.4.4\conf\httpd.conf
Change line
LoadModule php5_module "c:/wamp/bin/php/php5.3.13/php5apache2_4.dll"
to
LoadModule php5_module "c:/wamp/bin/php/php5.4.12/php5apache2_4.dll"
3) (Re)Start WAMP
4) Install Apache Service
5) Restart all services
Verify the service description of service wampapache in windows service manager to match Apache/2.4.4 (Win64) PHP/5.4.12
I had this same issue - what I finally did was follow ofzza's and Ankit Sharma's tips, as well as manually removing the directory of the older php version while the services were stopped.
It seems to have worked, except when I call phpinfo() the top heading still claims it's the older version of php even though it's definitely running the newer one. Very strange, but everything is working so I'm fine with it.
The previous installation could be part of the problem. Install WAMP 2.4 in a new directory (It comes bundled with the Apache version you want) & then migrate your www folder.
Directly upgrading has not been error-free for me.
Alternatively, back-up your current version [Databases, config files & www dir], uninstall it and install the new version. Restore your information after
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.