I'm new to configuring Apache and I'm trying to optimize my Apache server. Reading through the documentation, I found that I should be using the Event MPM instead of the Prefork MPM. Everything was straight forward until this point as I only had to comment out Prefork and uncomment Event in 00-mpm.conf. However, when I restarted Apache, I got the following error -
AH00526: Syntax error on line 31 of /etc/httpd/conf.d/php.conf: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
Digging for some more information, I found out that mod_php should not be used with Event. So, I'm commented out php_value in php.conf and also commented out LoadModule in 10-php.conf.
My webpages wouldn't load anymore and I realized that I should be using php-fpm. However, documentation regarding this is really unclear and I'm not sure how to use it. I tried this -
[root#ip-xxx-xx-xx-xxx ~]# yum install php-fpm
Loaded plugins: amazon-id, rhui-lb, search-disabled-repos
Resolving Dependencies
--> Running transaction check
---> Package php70w-fpm.x86_64 0:7.0.4-1.w7 will be installed
--> Processing Dependency: php70w-common(x86-64) = 7.0.4-1.w7 for package: php70w-fpm-7.0.4-1.w7.x86_64
--> Running transaction check
---> Package php70w-common.x86_64 0:7.0.4-1.w7 will be installed
--> Processing Conflict: php70w-common-7.0.4-1.w7.x86_64 conflicts php-common < 5.5.0
--> Finished Dependency Resolution
Error: php70w-common conflicts with php-common-5.4.16-36.el7_1.x86_64
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
I'm not sure how to proceed and would really appreciate any help with this problem. Thank you!
You will need to remove your current installation of php and php-common will be uninstalled as a dependency.
I can confirm that I have just done this and found that when I uninstalled php a large number of related packages were also removed, so you will need to add the relevant php70w versions of various plugins (such as php70w-fpm, php70w-mysql, etc)
I also found that roundcube was uninstalled, but am now planning to install the latest version of this now that I have PHP 7
Related
I'm running PHP7.4 on CentOS7 and am having trouble getting the zip module to show up when I run php -m
I tried installing php-zip and php-pecl-zip through yum, which gives me the following result:
Resolving Dependencies
--> Running transaction check
---> Package php72w-common.x86_64 0:7.2.34-1.w7 will be installed
Removing php72w-common.x86_64 0:7.2.34-1.w7 - u due to obsoletes from installed php-common-7.4.21-1.el7.remi.x86_64
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package php72w-common.x86_64 0:7.2.34-1.w7 will be installed
--> Finished Dependency Resolution
Does this mean the zip module is already installed by default onto PHP7.4? Is there a reason I can't get it to activate?
I also added 40-zip.ini as per another Stackoverflow answer under /etc/php.d/ but no dice. I've also restarted my apache webserver (systemctl restart httpd).
Can someone tell me what the message means and what I can do to install ZipArchive onto my server? Any help would be appreciated, thanks!
I am building and installing custom RPMs on Centos/RHEL 6. When deploying on containers and VMs everything works as expected, however, on the production box we have extra, internal repositories. yum install my.rpm leads to a conflict with php70w-*:
Error: php70w-common conflicts with php-common-5.3.3-46.el6_7.1.x86_64
You could try using --skip-broken to work around the problem You could
try running: rpm -Va --nofiles --nodigest
The php version chosen should be the 5.3.3 because of the RPM's requirements. php-gd is listed in the .spec which enforces that:
---> Package php-gd.x86_64 0:5.3.3-46.el6_7.1 will be installed
--> Processing Dependency: php-common(x86-64) = 5.3.3-46.el6_7.1 for package: php-gd-5.3.3-46.el6_7.1.x86_64
The interesting thing is that if I install all php-* packages by hand (exactly as listed in the .spec file) and then install the package everything works. (This verifies that the conflict has nothing to do with the rest/non-php dependencies). Note that I have AutoReqProv: no in the spec...
Questions:
I would assume that yum will choose php 5.3.3 because all dependencies are satisfied without conflicts... why isn't doing that?
How can I prevent that behavior for my.rpm installation only?
The solutions I have considered are:
Explicitly state version <=5.4 in all php requirements. However, since I don't know what makes yum pick version 7, I am not sure this will work. Also, I prefer to keep dependencies version-less if possible. Once all required php modules are available in php 7 or once our software changes and we drop php-gd, it would be nice to port to php 7 without changing all versions in specs.
In the repository definition on the host I can exclude the package. I would like to avoid this - I control the RPM spec but the repositories are set by sysadmins (using puppet)
Instruct puppet to install all php dependencies first and then deploy my.rpm. A solution I don't like because we are splitting the installation in two steps and two different systems: puppet and rpm.
Any help and/or ideas would be appreciated
php70w-common looks like a webtatic or atomic repo package.
Either way you need to determine what repo it belongs to, either to exclude selectively the repo at install time or to configure repository priorities.
You can easily find out with:
yum info php70w-common
I prefer the priorities approach, which is cleaner and more portable.
https://wiki.centos.org/PackageManagement/Yum/Priorities
I am trying to install php-mbstring with php 5.6 and I get this error:
Error: php56w-common conflicts with php-common-5.4.45-3.el6.remi.x86_64
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
I have attempted to install php56-mbstring, but I get the following. I am not sure if this means it is already installed or not:
Nothing to do
What is the most appropriate package to install? Which one should I be trying to resolve and how can I resolve it. Thanks!
I run into same problem with my server running PHP 5.6.17. For me it seems that the extension that I was looking for was php56w-mbstring.x86_64
It can be found from webtatic repository. I don't remember enabling that by myself, but in case it is missing here is the instructions how to enable said repo: http://www.certdepot.net/rhel7-install-webtatic-repository/
You can list available repos in your server by command yum repolist
To search if your repos has something related to mbstring use command yum list *mbstring*
So solution for me was this: yum install php56w-mbstring.x86_64
Finally restart Apache: service httpd restart
By the way, I am running CentOS server so your commands might be slightly different on your OS.
Have you added the module to your PHP.ini file extension=php_mbstring.dll
I tried and tried everything until i came to this link. https://docs.phpmyadmin.net/en/latest/setup.html#debian-setup
I run /usr/sbin/pma-configure and bam I had phpmyadmin working without the mbstring error
there is so many setups now that it is hard to find the one you need.
running ubuntu 14.04 with 4 versions of php installed with virtualmin webmin cp. Debian and Ubuntu changed the way how setup is enabled and disabled. few just happy this is working now. hope this helps you spend less time that i did to find this solution.
I am trying to configure apache 2.2.15 with php5 in my linux system. I have installed both of them. But when I added libphp5.so module in httpd.conf of apache, it has given the following error while starting the server:
Starting httpd: httpd: Syntax error on line 202 of /etc/httpd/conf/httpd.conf: Cannot load /etc/httpd/modules/libphp5.so into server: /etc/httpd/modules/libphp5.so: undefined symbol: ap_unixd_config
Can anybody tell me how to fix this, as I tried every possible solution by googling it but in vain?
Some newer PHP versions may not be compatible with Apache2.2. This error occurs because the function ap_unixd_config is in Apache2.2 still called unixd_config.
Try to use Apache2.4 if you need to use this PHP version, otherwise you can use an older version of PHP.
This also happens on Arch Linux when one doesn't upgrade Apache 2.2 to Apache 2.4. So if you are using Arch Linux you need to downgrade php-apache package to the version that works for you. php-apache-5.5.8-1 is still OK, whereas 5.5.11-1 is not.
On RedHat Apache2 and PHP installation is done by issuing the following commands (as root):
yum install httpd httpd-devel php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml
/etc/init.d/httpd start
That's all. (I'm following this tutorial.) You may add or remove some php extensions to or from the list of packages to be installed if so desired.
I am running a simple test script from the command line on CentOS 5.6 with the PHP package installed from PHP 5.3 on CentOS/RHEL 5.6.
PHP runs fine in all other cases but when I hit mysql_connect() it fails without error.
If I run
$ php -m
I am not seeing MySQL as an installed module.
However I have added extension=mysql.so to my php.ini and rebooted.
Output of 'rpm -qa | grep php'
php-common-5.3.10-1.w5
php-5.3.10-1.w5
php-cli-5.3.10-1.w5
Output of 'yum install php-mysql'
--> Missing Dependency: php-common = 5.1.6-27.el5_7.5 is needed by package php-mysql-5.1.6-27.el5_7.5.x86_64 (updates)
php-pdo-5.1.6-27.el5_7.5.x86_64 from updates has depsolving problems
--> Missing Dependency: php-common = 5.1.6-27.el5_7.5 is needed by package php-pdo-5.1.6-27.el5_7.5.x86_64 (updates)
Error: Missing Dependency: php-common = 5.1.6-27.el5_7.5 is needed by package php-pdo-5.1.6-27.el5_7.5.x86_64 (updates)
Error: Missing Dependency: php-common = 5.1.6-27.el5_7.5 is needed by package php-mysql-5.1.6-27.el5_7.5.x86_64 (updates)
You could try using --skip-broken to work around the problem
You could try running: package-cleanup --problems
package-cleanup --dupes
rpm -Va --nofiles --nodigest
The program package-cleanup is found in the yum-utils package.
I am not seeing MySQL as an installed module.
Did you install it?
# yum install php-mysql
(from the same repo you installed php from).
EDIT:
run this:
yum --enablerepo=webtatic install php-mysql
this tells yum to get the packages from webtatic repository (in addition to system configured repositories). If you want webtatic among system enabled repositories, run:
yum --enablerepo=webtatic install webtatic-release
First, some advice: stop using mysql libraries and use PDO or at least the mysqli libraries.
Now for some troubleshooting help: the first step is to be 100% sure the mysql is loading. Create a script (web based) with:
phpinfo();
Confirm that somewhere on this page there is a block indicating that the mysql extension is being loaded.
Wherever you are testing an are uncertain of errors, right before you call mysql_connect add these lines:
ini_set('display_errors', 1);
ini_set('log_errors', 1);
error_reporting(E_ALL | E_STRICT);
This will ensure you aren't suppressing the errors somewhere else before the connect. Some frameworks sometimes do this.
If it's indeed the module is loading and with the added error logging code you still don't get a valid error. I'd try connecting in a command line php script. Look in the php.ini file to see what "error_log" is set to. This is the default log it will it will log to--sometime http based settings override logging, so even if errors are thown, you don't see or can't find them. A command line php script factors this out.
Last but not least, you can always post your connection string to this post. Try connecting from the command line on the server as your script using the mysql command with the same credentials as your mysql_connect. You might be able to connecting just fine, but have bad credentials.
If the module is not loading, try to find exactly where the module resides and put the full path into the php.ini. Yum sometimes installs stuff not where php.ini is looking for it. At the end of the Yum install, it sometimes tells you the path, if not, to find it with brute force, do this:
cd /
find . -name 'mysql.so'
so in the php.ini, instead of
extension=mysql.so
put
extension=/path/to/found/mysql.so
Good luck!