I tried installing memcache and memcached on centos 6.7 running php 5.4
Had few errors etc.
But now the phpinfo() shows:
The error log shows this error:
Cannot find save handler 'memcached'
The php.ini has:
session.save_handler = memcached
session.save_path = "127.0.0.1:11211"
The error disappears if I used:
session.save_handler = memcache
session.save_path =t"tcp://127.0.0.1:11211"
But I want to use memcached.
Or is it fine to use any of them?
So 2 questions:
How can I make memcached work too?
Is it fine to use memcache or memcached both? Or does it make any difference?
Thanks :)
Related
This question already has answers here:
Fatal error: Uncaught Error: Call to undefined function mysql_connect()
(9 answers)
Closed 3 months ago.
I have ran aptitude install php5-mysql (and restarted MySQL/Apache 2), but I am still getting this error:
Fatal error: Call to undefined function mysql_connect() in /home/validate.php on line 21
phpinfo() says the /etc/php5/apache2/conf.d/pdo_mysql.ini file has been parsed.
In case, you are using PHP7 already, the formerly deprecated functions mysql_* were removed entirely, so you should update your code using the PDO-functions or mysqli_* functions instead.
If that's not possible, as a workaround, I created a small PHP include file, that recreates the old mysql_* functions with mysqli_*()-functions: fix_mysql.inc.php
I see that you tagged this with Ubuntu. Most likely the MySQL driver (and possibly MySQL) is not installed. Assuming you have SSH or terminal access and sudo permissions, log into the server and run this:
sudo apt-get install mysql-server mysql-client php5-mysql
If the MySQL packages or the php5-mysql package are already installed, this will update them.
UPDATE
Since this answer still gets the occasional click I am going to update it to include PHP 7. PHP 7 requires a different package for MySQL so you will want to use a different argument for the apt-get command.
# Replace 7.4 with your version of PHP
sudo apt-get install mysql-server mysql-common php7.4 php7.4-mysql
And importantly, mysql_connect() has been deprecated since PHP v5.5.0. Refer the official documentation here: PHP: mysql_connect()
Well, this is your chance! It looks like PDO is ready; use that instead.
Try checking to see if the PHP MySQL extension module is being loaded:
<?php
phpinfo();
?>
If it's not there, add the following to the php.ini file:
extension=php_mysql.dll
If someone came here with the problem of docker php official images, type below command inside the docker container.
$ docker-php-ext-install mysql mysqli pdo pdo_mysql
For more information, please refer to the link above How to install more PHP extensions section(But it's a bit difficult for me...).
Or this doc may help you.
https://docs.docker.com/samples/library/php/
I was also stuck with the same problem of undefined MySQL_connect().I tried to make changes in PHP.ini file but it was giving me the same error.
Then I came to this solution where I changed my code from depreciated php functions to new functions.
$con=mysqli_connect($host,$user,$password);
mysqli_select_db($con,dbname);
//To select the database
session_start(); //To start the session
$query=mysqli_query($con,your query);
//made query after establishing connection with database.
I hope this will help you .
This solution is correctly working for me .
EDIT:
If you upgrade form old php you need to apt-get install php7.0-mysql
Try:
<?php
phpinfo();
?>
Run the page and search for mysql. If not found, run the following in the shell and restart the Apache server:
sudo apt-get install mysql-server mysql-client php5-mysql
Also make sure you have all the following lines uncommented somewhere in your apache2.conf (or in your conf.d/php.ini) file, from
;extension=php_mysql.so
to
extension=php_mysql.so
In php.ini file
change this
;extension=php_mysql.dll
into
extension=php_mysql.dll
My guess is your PHP installation wasn't compiled with MySQL support.
Check your configure command (php -i | grep mysql). You should see something like '--with-mysql=shared,/usr'.
You can check for complete instructions at http://php.net/manual/en/mysql.installation.php. Although, I would rather go with the solution proposed by #wanovak.
Still, I think you need MySQL support in order to use PDO.
The question is tagged with ubuntu, but the solution of un-commenting the extension=mysqli.dll is specific to windows. I am confused here?!, anyways, first thing run <? php phpinfo ?> and search for mysql* under Configuration heading. If you don't see such a thing implies you have not installed or enabled php-mysql. So first install php-mysql
sudo apt get install php-mysql
This command will install php-mysql depending on the php you have already installed, so no worries about the version!!.
Then comes the unix specific solution, in the php.ini file un-comment the line
extension=msql.so
verify that msql.so is present in /usr/lib/php/<timestamp_folder>,
ELSE
extension=path/to/msql.so
Then finally restart the apache and mysql services, and you should now see the mysql section under Configrations heading in phpinfo page
I was getting this error because the project I was working on was developed on php 5.6 and after install, the project was unable to run on php7.1.
Just for anyone that uses Vagrant with ubuntu/nginx, in the nginx directory(/etc/nginx/), there is a directory named "sites-available" which contains a file named like the url configured for the vagrant maschine. In my case was homestead.app. Within this file there is a line that says something like
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
There you can change the php version to the desired for that particular site.
Googled this but wasnt really able to find a simple answer that said where to look and what to change.
Hope that this helps anyone.
Thanks.
If you are getting the error as
Fatal error: Call to undefined function mysql_connect()
Kindly login to the cPanel >> Click on Select Php version >> select the extension MYSQL
For CentOS 7.8 & PHP 7.3
yum install rh-php73-php-mysqlnd
And then restart apache/php.
(Windows mysql config)
Step 1 : Go To Apache Control Panel > Apache > Config > PHP.ini
Step 2 : Search in Notepad (Ctrl+F) For: ;extension_dir = "" (could be commented with a ;). Replace this line with: extension_dir = "C:\php\ext" (please do not you need to remove the ; on the beginning of the sentence).
Step 3 : Search For: extension=php_mysql.dll and remove the ; in the beginning.
Step 4 : Save and Restart You Apache HTTP Server. (On Windows this usually done via a UI)
That's it :)
If you get errors about missing php_mysql.dll you'll probably need to download this file from either the php.net site or the pecl.php.net. (Please be causius about where you get it from)
More info on PHP: Installation of extensions on Windows - Manual
There must be some syntax error. Copy/paste this code and see if it works:
<?php
$link = mysql_connect('localhost', 'root', '');
if (!$link) {
die('Could not connect:' . mysql_error());
}
echo 'Connected successfully';
?
I had the same error message. It turns out I was using the msql_connect() function instead of mysql_connect().
Once upon a time I had a Postgres database that worked with pgAdmin. I have a webservice running on a WildFly server that made connections to the DB and everything worked fine.
After a while(a few months) I have tried to open pgAdmin again and it stuck on the loading...
I remove postgres and pgAdmin using Revo Uninstall, then installed postgres 9.6 and opened pgAdmin and it stays in the loading screen forever.
Can anyone help me ? [Using postgres 9.6 with pgAdmin v1.3],
On Event Viewer I saw the following error in pgAdmin :
Faulting application name: pgAdmin4.exe, version: 0.0.0.0, time stamp: 0x580f31f6
Faulting module name: MSVCP120.dll, version: 6.3.9600.18438, time stamp: 0x57ae642e
Exception code: 0xc0000135
Fault offset: 0x00000000000ecdd0
Faulting process id: 0x1de4
Faulting application start time: 0x01d2a7d1566324ba
Faulting application path: C:\Program Files\PostgreSQL\9.6\pgAdmin 4\bin\pgAdmin4.exe
Faulting module path: MSVCP120.dll
Report Id: 984dd9d8-13c4-11e7-832d-5ce0c535006f
Faulting package full name:
Faulting package-relative application ID:
I had the same problem and I resolved it following the steps on link
https://www.pgadmin.org/faq/#12
When I launch pgAdmin 4 v4.28 or later on Windows, the loading page
never closes. Why? pgAdmin 4 v4.28 includes additional security
features, one of which is intended to prevent security issues caused
by Content Sniffing.
Unfortunately some Windows systems are mis-configured such that this
causes Javascripts used by pgAdmin to fail to load. Opening the
developer tools on your browser will show an error similar to this:
Refused to execute script from
'http://127.0.0.1:57313/static/vendor/require/require.min.js?ver=42800'
because its MIME type ('text/plain') is not executable, and strict
MIME type checking is enabled.
(index):39 Uncaught ReferenceError: require is not defined at
(index):39 This will occur when the value of the registry key at
HKEY_CLASSES_ROOT.js\Content Type is set to text/plain. To resolve
the issue, use the Registry Editor and reset the value of
HKEY_CLASSES_ROOT.js\Content Type to: text/javascript
Finally, restart the pgAdmin server.
I just had this problem on macOS so I went to Terminal and typed ps aux | grep -i pgadmin and made a note of the process id (second column from the left). Then I killed that process with kill -s TERM <process id>. You can also use the simpler form with killall pgAdmin4. Then I was able to start "pgAdmin 4" from the Applications directory.
I just had the same issue on a Windows 7, 64bit machine, DBA told me to "upgrade" to pgAdmin 3 (latest build) and it works.
as per Abrahim's suggestion, it worked fine for me in the environment. Windows 10, pgAdmin 4.28
"value of the registry key at HKEY_CLASSES_ROOT.js\Content Type is set to text/plain. To resolve the issue, use the Registry Editor and reset the value of HKEY_CLASSES_ROOT.js\Content Type to: text/javascript "
I had this issue on Mac. I resolved it by:
Closing the instance of PgAdmin 3 AND PgAdmin4 (I had both open)
System Preferences -> Security & Privacy -> Allow apps downloaded from: Anywhere
Reopen PgAdmin4
I faced the same issue (on window server)
My solution is just open task manager and finds out pg_ctl then just end that task and reopen pgadmin again. It will work!in case it still doesn't work just try to terminate mysql.exe too.
For me, the postgresql server was set to start manual and it was not running in services, i started the service and it worked
Download pgAdmin from its website and install it separately from postgres.(Its works for me on Windows 10 - 64 Bit)
Response from pgadmin-support mail group:
Please try one of the Mac/Windows test builds at https://developer.pgadmin.org/~dpage/.
I would strongly advise doing a complete uninstall before installing, to ensure no old, unused files are left behind.
I had a similar issue and was able to fix it by re-installing the latest Java JDK x64 8 at http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
I found a solution here pgAdmin 4 v3.1 How can I use another browser? (Win 7)
My pgadmin4 stopped working in firefox but it works in chrome. Now i use this configuration to open pgadmin 4 using chrome. It is interesting that pgadmin4 now open in his own window.
I think this is the correct way to use pgadmin4.
Go to Services and restart PostgreSQL Server.
The title pretty much says it - when I try to start a newly created meteor app, this appears when starting the proxy and I get the message that the mongo server can't be started.
I created some swap space already (that was mentioned in the only other thread realted to that problem) and even reinstalled it - no further success.
Weird thing is, on my normal laptop this works. The laptop I'm having trouble with is a Pentium III with 1GB RAM, maybe this matters.
Any thoughts? Is the machine too old?
EDIT:
My setup:
Thinkpad T23, PIII 1.13 GHz, 1GB RAM.
Debian Stretch/testing, Linux Kernel 4.1.0-1-686-pae
My log:
[[[[[ ~/Server/sample ]]]]]
=> Started proxy.
Unexpected mongo exit code null. Restarting.
Unexpected mongo exit code null. Restarting.
Unexpected mongo exit code null. Restarting.
Can't start Mongo Server.
This command will reset your database
meteor reset
Have you tried setting your LANG environment variable? As shown in Mongo can't be started when starting Meteor, which explains the following:
<snip>
If you get an error like
terminate called after throwing an instance of 'std::runtime_error'
what(): locale::facet::_S_create_c_locale name not valid
Unexpected mongo exit code null. Restarting.
...
Can't start Mongo server.
the solution is very easy but not easy to know:
You have not set your LANG settings in current shell.
Set your LANG env vars before starting meteor manually or permanent in your profile settings.
export LANG=C
export LC_ALL=C
Now you can run meteor and it should be able to start the mongo development process.
</snip>
It might be worth trying. HTH.
I think your suspicion about the machine being too old is correct.
You can reproduce the same error by trying to build a meteor app on a digitalocean droplet with 512mb of ram. On an otherwise identical machine with 8gb of ram, the app builds without error.
Just remove the #w=majority param in your connection string
I have application on Zend Framework 1.6 and I use Memcached as backend cache. When I restart Memcached I get error message "Failed saving metadata to metadataCache". Please advice how can I solve this problem.
In my memcached.conf i wrote setting -u www-data
I am using Perl 5.14.2 on Ubuntu wheezy 64 bit.
I am trying to connect to a Pervasive SQL server v9.5 that is installed on a windows 2008 machine.
I tested the connection with isql and it works properly, I tested with the following command:
isql -v <db_name>
I use the DBD:ODBC v1.39 (latest version) perl module installed from cpan.
I am using the following command to connect to sql server:
use DBI;
my $db = DBI->connect('dbi:ODBC:Moked');
Moked is the connection name that was defined in the unixodbc v2.2.14 in odbc.ini.
/etc/odbc.ini
[Moked]
Driver=PERVASIVE_ODBC
Description=Pervasive ODBC Interface: Moked
ServerName=<ip>:<port>
DBQ=MIDA
UID=
PWD=
OpenMode=0
PvTranslate=
when I try to connect with the command i showed above I get error SQL-HY001 that by googling I understood that it relates to memory allocation, usually people get these while querying and not while trying to connect/
it seems that DBI does recognize the connection because if I type a different name, for example 'Moked2', i get the error SQL-IM002 instead.
any ideas?
how can I debug this issue further?
any information regarding the issue would be greatly appreciated.
thanks!
You are getting the memory allocation error because the PSQL v11 client cannot reliably connect to a PSQL v9.5 server. If you want to use the v11 client, you need the v11 server too. You might be able to get away with the v11 client at a Btrieve level but there were significant changes between v9 and v11 on the ODBC side.