Home >Backend Development >PHP Tutorial >PHP编译问题汇总
1、PDO_MYSQL make: *** [pdo_mysql.lo] Error 1
编译安装PDO_MYSQL拓展模块,总是提示:
In file included from/data0/software/PDO_MYSQL-1.0.2/pdo_mysql.c:31:
/data0/software/PDO_MYSQL-1.0.2/php_pdo_mysql_int.h:25:19:error: mysql.h: No such file or directory
In file included from/data0/software/PDO_MYSQL-1.0.2/pdo_mysql.c:31:
/data0/software/PDO_MYSQL-1.0.2/php_pdo_mysql_int.h:36:error: expected specifier-qualifier-list before ‘MYSQL’
/data0/software/PDO_MYSQL-1.0.2/php_pdo_mysql_int.h:48:error: expected specifier-qualifier-list before ‘MYSQL_FIELD’
/data0/software/PDO_MYSQL-1.0.2/php_pdo_mysql_int.h:53:error: expected specifier-qualifier-list before ‘MYSQL_RES’
make: *** [pdo_mysql.lo] Error 1
这是因为这是因为在编译时需要 MySQL 的头的文件。而它按默认搜索找不到头文件的位置,所以才出现这个问题。通过软连接把MySQL头文件对应到/usr/local/include/下就好
比如你的MySQL安装文件位于/usr/local/mysql,那么就执行以下命令:
# ln -s /usr/local/mysql/include/* /usr/local/include/
在PHP配置文件php.ini中添加扩展时要使用绝对路径
extension="/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/pdo_mysql.so"
2、在搭建phpadmin的时候系统session_start()错误
错误信息:
Warning: session_start():open(/var/lib/php/session/sess_qavhhacl7lrdbggauasf1qdlo5, O_RDWR) failed: Nosuch file or directory (2) in /www/tool/classes/service/User.php on line75
Warning: Unknown: open(/var/lib/php/session/sess_qavhhacl7lrdbggauasf1qdlo5,O_RDWR) failed: No such file or directory (2) in Unknown on line 0
Warning: Unknown: Failed to write session data (files). Please verify that thecurrent setting of session.save_path is correct (/var/lib/php/session) inUnknown on line 0
查看php.ini:
session.save_path = "/var/lib/php/session" //session的存放路径
所以上面的文字是提示没有该目录
解决问题:
创建上面的目录
mkdir session
chmod -R 777 session
再次运行程序就OK了