PDOException: could not find driver after server reboot - php

When rebooting the server (RHEL6, Apache 2.2, PHP 7.2) I always get the error "PDOException: could not find driver". Apache is started automatically via httpd init script.
After an apachectl stop | start everything works fine.
Any ideas?
Thanks.

Related

How to properly install Xampp on Mac in order to run PHP code

I downloaded the installer version of Xampp version 8.1.6-0 for Mac and went to the manager-osx widget to start the Apache and MySQL servers but neither would start.
I then tried using the command sudo apachectl start and then created an index.php file and put it in htdocs, and then tried to open it using http://localhost/index.php as well as http://localhost:8080/index.php and both times it said the server could not be reached.
I've actually downloaded Xamp in the past and was able to reach the server but wasn't able to get php scripts to run, but now for some reason I can't even get the server to run.
I made sure to download the installer and not the virtual machine version. I'm running Monterey version 12.4.
I tried the solutions here but they didn't seem to work. I checked my activity monitor and nothing is running on port 80.
I also installed MAMP from here and tried to start Apache but it displayed the error:
"Apache couldn't be started. Please check your MAMP installation and
configuration."
Any help would be appreciated as I just want to run PHP.

Mysql not working on mac Sierra after upgrading php

I recently upgraded my laravel valet to version 2 which installed php 7.2 through brew. I had previously been on php 7.1. I ran into a few bumps but got php and valet working but once I did I noticed mysql is no longer working. If I do brew services start mysql it shows successful but if I type mysql -v I get the following error message. ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
If I type mysql.server start I get the following error message
./usr/local/Cellar/mysql/8.0.17_1/bin/mysqld_safe: line 674: /Users/swany/.valet/Log/mysql.log: No such file or directory
2019-09-11T17:24:54.6NZ mysqld_safe error: log-error set to '/Users/swany/.valet/Log/mysql.log', however file don't exists. Create writable for user 'mysql'.
/usr/local/Cellar/mysql/8.0.17_1/bin/mysqld_safe: line 144: /Users/swany/.valet/Log/mysql.log: No such file or directory
ERROR! The server quit without updating PID file (/usr/local/var/mysql/Chriss-MacBook-Pro-2.local.pid).
I have seen others with similar issues but when i walked through some of the solutions they didn't seem to work for me. I am hoping to be able to save all my databases I already have when mysql was running. I didn't try to upgrade mysql but it may tried as part of the valet upgrade.
Check to see if there is a mysql process still running. Run the following command:
ps aux | grep -i mysql
If you see any processes running then kill them using the
kill -9 PID
Where PID = Process ID of the MySQL process.
After the processes have been terminated, try restarting mysql and see if this solved your problem.

SQLAnywhere PHP extension errors on Apache restart

I have the SQLAnywhere PHP extension installed and it's working fine, right up until Apache restarts.
After Apache has restarted, any attempt to access any website on the server generates the following error in the Apache error log and throws a 500 internal server error on the page:
AH01215: PHP Warning: request_startup() for sqlanywhere module failed in Unknown on line 0: /usr/local/cpanel/cgi-sys/ea-php56
To resolve it, I can explicitly stop and start Apache, but restarting Apache (apachectl restart) doesn't.
This is generally fine until an automated process (such as a cPanel update) causes Apache to restart.
The SQLAnywhere PHP extension was configured as follows:
Install the SQLAnywhere client
Download the PHP extension to the extensions directory
Add LD_LIBRARY_PATH=[sqlanywhere/lib64] to /etc/environment
Log out and back in for the LD_LIBRARY_PATH to take effect
Add the extension to the php.ini (or sqlanywhere.ini in php.d folder)
Stop then start Apache
My current thinking for a workaround is to modify the cPanel update script to perform an Apache restart by explicitly doing a stop then a start as this would cover the immediate issue, but I'm hoping that somebody might know of an actual fix for this to avoid any other automated restarts causing problems.
The stack I'm running is:
CentOS Linux release 7.3.1611 (Core)
cPanel 60.0 (build 28)
Apache/2.4.23 (cPanel)
PHP 5.6 (using cPanel's MultiPHP and EasyApache4)
SQLAnywhere12 Client
Thanks in advance for any suggestions!

Unable to start apache2.2 gave me No such file or directory

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>

phpMyAdmin get error 404 for php 5.5.8

I just upgraded my PHP version from 5.3 to 5.5.8
When i was trying to connect back to phpMyAdmin i got the message:
Not Found
The requested URL /phpmyadmin/ was not found on this server.
Apache/2.4.6 (Ubuntu) Server at 192.168.168.59 Port 80
What can be the problem?
I restarted to apache2 server and updated all the apps with sudo apt-get update
Try reinstall phpmyadmin and it was the simple way to do so.
Because, it maybe PHP5.5.X removed PHP/APACHE virtual host. If you know how to put it back the virtual host, you may try it. else try reinstall it

Categories