Jump to content

PHP startup warning on amazon aws


Go to solution Solved by requinix,

Recommended Posts

Hi all,
 

I am getting the following warning in the log file 

 

 

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/5.6/modules/mysqli.so' - /usr/lib64/php/5.6/modules/mysqli.so: undefined symbol: mysqlnd_connect in Unknown on line 0

 

 

and because of this, I think, the library functions are not working. For e.g. if I write code with 

strlen() or mb_strlen()

 lib functions, the code fails to work. 

 

Here is the simple test code which gives an http error 500.:

 

<?php
 $sl = "astha12ah";
 sayname($sl);

 function sayname($n){
        $len= mb_strlen($n, 'UTF-8');
        echo $len;
    //  echo strlen($n);
        echo "<br>";
        echo "<br>";
        echo $n;
        return;
 }

?>

Any help appreciated in resolving this. 

 

Thanks all !

 

 

Link to comment
https://forums.phpfreaks.com/topic/304795-php-startup-warning-on-amazon-aws/
Share on other sites

Hi requinix, 

 

The operating system is Amazon Linux. The program uses a bash script, as a hook in the yml, to build PHP, apache, mysql .

 

Here is the script:

sudo yum groupinstall -y "Web Server" "MySQL Database"
sudo yum install php56
#yum list installed | grep php
sudo yum install -y php5.6 php5.6-mcrypt php5.6-mbstring php5.6-curl php5.6-cli php5.6-mysql php5.6-gd php5.6-intl php5.6-xsl php5.6-zip libapache2-mod-php5.6
sudo yum install -y php56-mysqlnd

wget https://tn123.org/mod_xsendfile/mod_xsendfile.c --no-check-certificate
sudo yum install gcc
sudo yum install httpd24-devel.x86_64
sudo apxs -cia mod_xsendfile.c
sudo service httpd restart 

 

 
As you can see, I skipped the PHP as a part of group install and then used the lines below to install the  version 5.6 of PHP

 

Thanks. 

Edited by ajoo

I don't know what you searched for but I do know that

sudo yum install php56
sudo yum install -y php5.6 ...
is weird: you should not have two sets of PHP 5.6 packages available. One or the other. So one of those works and the other doesn't.

 

What php5* packages do you have installed already? What is the proper name of the mysqlnd package?

 

If you don't know how to find out, what are the repo URIs mentioned in /etc/yum/repos.d?

Hi requinix, 

 

I think the two repos are : a) the default repo of Amazon and b) the ppa:ondrej 

 

There is no repo.d in etc/yum.  

 

 

[ec2-user@ip-172-131-20-181 yum]$ ls -la

total 28
drwxr-xr-x  6 root root 4096 Aug 28 12:13 .
drwxr-xr-x 85 root root 4096 Aug 30 05:41 ..
drwxr-xr-x  2 root root 4096 Aug 10 23:50 fssnap.d
drwxr-xr-x  2 root root 4096 Aug 10 23:50 pluginconf.d
drwxr-xr-x  2 root root 4096 Aug 10 23:50 protected.d
drwxr-xr-x  2 root root 4096 Aug 10 23:50 vars
-rw-r--r--  1 root root  444 Aug 10 23:50 version-groups.conf
 
OK I found the repos here  etc/yum.repos.d :
 

 

drwxr-xr-x  2 root root 4096 Aug 28 12:13 .

drwxr-xr-x 85 root root 4096 Aug 30 05:41 ..
-rw-r--r--  1 root root 1014 Aug 10 23:26 amzn-main.repo
-rw-r--r--  1 root root  327 Aug 10 23:26 amzn-nosrc.repo
-rw-r--r--  1 root root 1041 Aug 10 23:26 amzn-preview.repo
-rw-r--r--  1 root root 1041 Aug 10 23:26 amzn-updates.repo
-rw-r--r--  1 root root  957 Aug 26 12:10 epel.repo
-rw-r--r--  1 root root 1056 Mar  1  2013 epel-testing.repo
-rw-r--r--  1 root root   80 Aug 18 05:58 ondrej_php.repo
[ec2-user@ip-172-31-10-188 yum.repos.d]$
 

 

Edited by ajoo

And they say Android is fragmented...

 

ppa:ondrej? The Ubuntu repository? On Amazon Linux, which is based on RHEL? Am I confused or is that totally backwards?

 

What do

yum repolist
yum list installed | grep php
show?

hmm , I guess that's my fault requinix. I checked installing php5.6 on digital ocean tutorial and then implemented it here changing the apt-get by yum !! :o  :o Sorry.

 

 

Loaded plugins: priorities, update-motd, upgrade-helper

Repository 'ondrej_php': Error parsing config: Error parsing "baseurl = 'ppa:ondrej/php'": URL must be http, ftp, file or https not "ppa"
1011 packages excluded due to repository priority protections
repo id                                            repo name                                                                     status
!amzn-main/latest                                  amzn-main-Base                                                                       5,668
!amzn-updates/latest                               amzn-updates-Base                                                                      776
epel/x86_64                                        Extra Packages for Enterprise Linux 6 - x86_64                                11,369+1,011
repolist: 17,813
[ec2-user@ip-172-31-10-188 yum.repos.d]$ yum list installed | grep php
Repository 'ondrej_php': Error parsing config: Error parsing "baseurl = 'ppa:ondrej/php'": URL must be http, ftp, file or https not "ppa"
php56.x86_64                         5.6.31-1.134.amzn1            @amzn-updates
php56-cli.x86_64                     5.6.31-1.134.amzn1            @amzn-updates
php56-common.x86_64                  5.6.31-1.134.amzn1            @amzn-updates
php56-fpm.x86_64                     5.6.31-1.134.amzn1            @amzn-updates
php56-gd.x86_64                      5.6.31-1.134.amzn1            @amzn-updates
php56-jsonc.x86_64                   1.3.6-1.19.amzn1              @amzn-main
php56-mysqlnd.x86_64                 5.6.31-1.134.amzn1            @amzn-updates
php56-pdo.x86_64                     5.6.31-1.134.amzn1            @amzn-updates
php56-process.x86_64                 5.6.31-1.134.amzn1            @amzn-updates
php56-soap.x86_64                    5.6.31-1.134.amzn1            @amzn-updates
php56-xml.x86_64                     5.6.31-1.134.amzn1            @amzn-updates
php56-xmlrpc.x86_64                  5.6.31-1.134.amzn1            @amzn-updates
[

 

But that's been excluded, isn't that what it says?

Thanks !!

hmmm ni I never used apt to install anything. I used only yum but took the procedure from an ubuntu tutorial. Do I need to remove the ppa:ondrej repo / package from my linux so that it may not interfere ? What would be the command for that ?

 

Thanks requinix !

Hi requinix, 

 

I uninstalled the php and apache and reinstalled using only yum as suggested by you and that cleared the warning related to the libs in the error_log. Thanks !!

 

However, the original problem still remains !! If I just echo out "Hello World", it displays correctly on my secure site ! But if I try and do a small bit of code as in #1, shown below again for convenience

<?php
 $sl = "astha12ah";
 sayname($sl);

 function sayname($n){
        $len= mb_strlen($n, 'UTF-8');
        echo $len;
    //  echo strlen($n);
        echo "<br>";
        echo "<br>";
        echo $n;
        return;
 }

?> 

it simply gives an HTML 500 error. The error_log has no errors, warnings or notices. 

 

Does changing to a secure (HTTPS) site change the error logs too ? If so, then maybe I am looking up the wrong ones at /var/log/httpd/. Else I am not sure what do do from here to try and debug this.

 

Thanks for any inputs !!

  • Solution

However, the original problem still remains !! If I just echo out "Hello World", it displays correctly on my secure site ! But if I try and do a small bit of code as in #1 [...] it simply gives an HTML 500 error. The error_log has no errors, warnings or notices.

Check the PHP configuration used with Apache. You at least display_errors=off, so set error_log to somewhere appropriate, restart Apache, and try again.

 

But the problem is probably a missing mbstring.

 

Does changing to a secure (HTTPS) site change the error logs too ?

Depends on the configuration. It could. Personally I wouldn't use a separate configuration for the two.

 

If so, then maybe I am looking up the wrong ones at /var/log/httpd/.

You have php-fpm installed, which works differently from a regular Apache module. Now you need to look at its configuration to see what it has. The logs would probably be in /var/log/php-fpm.
  • Like 1

Hi !

 

I found out that there is another log in the same place as the error logs called ssl_error_log and that confirms that indeed the mb_strlen is an undefined function in index.php.

 

So what lib needs to be installed now ? Strangely i was not getting any of these problems earlier and this started when I changed to the secure HTTPS protocol.

 

Thanks !

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.