Solving PHP has encountered an Access Violation
In short: it’s caused by compatibility of different version of MySQL.
I have installed php + MySQL on two similar servers. The first one was running without any problem while the second one gave me “PHP has encountered an Access Violation”. Here is the version of each component:
- PHP: 5.2.8
- MySQL: 5.1.34
- Zend Optimizer: 3.3.3 (The key point)
On the 2nd server, I installed MySQL before PHP. When deploying the web application, “Access Violation” appeared. I reinstalled MySQL, problem solved. I remembered the difference in phpinfo() between 1st server and 2nd server: MySQL Client API version – 5.0.51a vs 5.1.34. Strange that I installed 5.1.34 on both servers, why the 1st one got older version of API? I did not pay more attention on this question for the problem was solved at that time. But after no more than 24 hrs, same problem happened again. This time, I remembered that I forgot to install Zend Optimizer on 2nd server. Then I install it and found that the API version changed to 5.0.51a… Now I know why the 1st server is running well: Zend Optimizer replaced the MySQL API for php.
My experience is proven here, exact same problem.
It teaches me the lesson again, which, though, I already knew but often forgot to apply:
The latest version may not be the best