I'm trying to enable memcached on my file server. I have added the line 'memcached.use_sasl = 1' in my php.ini file, and restarted apache2.
A phpinfo(); command shows that memcached.usesasl is set to 1.
However, whenever I run a php artisan command I get the following error message:
Memcached::setSaslAuthData(): SASL support (memcached.use_sasl) isn't enabled in php.ini
I made sure to run the phpinfo() from within my laravel projects public/index.php to make sure that I was looking at the configuration that Laravel is using (just in case it was using a different php somehow?) and it shows memcached.use_sasl is set to 1.
Apache-embedded PHP and command-line PHP often use separate ini files. Check for php-cli.ini in the same dir as php.ini. You can also run php --ini and it will show what files it uses.
Related
I used to run PHP 5.6 on Win 10 in CLI mode. I had different php.ini files in different directories and PHP would always pick up the one in the current directory if one was there.
Now, after upgrading to PHP 7.4, PHP always loads the php.ini from where php.exe is installed.
I know that I can specify a different php.ini with the -c command line directive, but that's not convenient. Is there a way to restore the 5.6 behavior?
Additional info:
I'm seeing the same behavior change on the LINUX web server: local php.ini files that used to be loaded now get ignored. I was able to mostly solve it there by renaming them to .user.ini
A plugin I'm using to move a wordpress install checks function_exists('mysqli_connect').
In the installer this check comes up as a failure, but from the command line php -r 'echo function_exists("mysqli_connect")?"pass":"fail"; echo "\n";' outputs pass.
What could be causing the function mysqli_connect to cease to exist?
I'm using php7.2, and I verified that is the running script with phpinfo().
The typical causes of this are 1 or more of the following:
Multiple PHP Installations. (CLI is 1, web-server is using another)
Apache/Nginx/PHP-FPM needs to be restarted (Typically a config file was updated but the related service(s) weren't restarted)
You have different php.ini files for CLI and your webserver (which means you need to turn on the extension in your web-server's php.ini)
When I attempt to install Laravel 5 I get a dependency error. I'm using Uniform Server on Windows 7. I have enabled php_mbstring.dll and I checked it's loading properly. (I think)
Here is the console output (Composer):
Here are the extensions in my php.ini
Here are the phpinfo() mbstring details:
I don't know where to go from here.
Any idea?
Pay attention that, both in Windows and Linux, PHP can run with multiples php.ini configuration files.
In general, when you find this kind of issue, you have to double check that the configuration file loaded is the same that you are editing or you need to find the right path and add the extension also to the right php.ini configuration file.
While running a script through a web server, you can find the configuration file using the function
phpinfo();
and checking the line "Loaded Configuration File" (or just look for php.ini)
For what concern the CLI you can run in CMD
php --ini
and check the first lines in order to find the Loaded Configuration File value.
I'm running a console command for symfony sudo php app/console assetic:dump and it is showing Warnings even though I specifically ignore Warnings on the php.ini for apache and for cli.
Is it using a different php.ini altogether?
Do sudo php -i for a readout of your PHP settings, including the path to php.ini.
Run the following command:
php -i | grep .ini
and you will see the full path of the php.ini used by cli.
Don't use sudo when dumping assets as the owner of the created files will be "root" and the nginx/apache user will not be able to use them.
Yes, it is probable that php used on the command line uses a different php.ini than php in apache.
Specifically in wamp server, php cli uses the php.ini in the php directory, and php as apache module uses php.ini situated in the apache/bin folder.
I am using Laravel 3 for a project, and I've made a little cronjob script, and when I moved to the new server it keeps saying:
Warning: ob_start(): function 'mb_output_handler' not found or invalid function name
and
Notice: ob_start(): failed to create buffer
Any idea how to fix this?
The new server is Ubuntu? Are your development server and the "new server" the same OS? Same PHP versions?
It's possible the two servers are completely different!
Can you show your cronjob? (Does it attempt to use a specific php binary via a #!/usr/bin/env php call ?
One possibility for Ubuntu:
PHP run in CLI can be different from being run in Apache, and especially is likely different if you're using php5-fpm with Nginx.
They each can have their own php.ini and different extensions loaded.
As you said, you're using Ubuntu Server. If you're using php 5.5, you may note a few things in /etc/php5:
/etc/php5/mods-available # All mods available / installed
/etc/php5/cli/php.ini # php.ini for CLI-called php5
/etc/php5/cli/conf.d # Directory of symlinks to extensions in mods-available!
/etc/php5/apache2/php.ini # php.ini for Apache-run php5
/etc/php5/apache2/conf.d # Symlinks to mods-available extensions
So, php in CLI vs Apache2 vs PHP-FPM can all have different extensions loaded and separated php.ini's installed.
Perhaps the cli-based one (likely what the cronjob is using) may be a different version of PHP (!) or loading a different .ini file and/or set of extensions.