search
HomeBackend DevelopmentPHP Tutorial高分!win7上php,apache,mysql配置有关问题

高分!!win7下php,apache,mysql配置问题
先说明,这三个我都已经安装了,而且我用phpinfo()试过没问题,但是当我连接数据库后,在浏览器上运行,可恶的事情发生了Fatal error: Call to undefined function mysql_connect() 本人急用,

------解决方案--------------------
phpinfo里找得到mysql 或者mysqli吗?
------解决方案--------------------
急用就赶紧装个xampp好了.
------解决方案--------------------
把错误信息都粘出来。。
------解决方案--------------------
应该再多描述一些
------解决方案--------------------
方面的集成环境的话
xampp
appserv 都还可以

你就要用这个的话看看php.ini 关于mysql的不要注释
extension=php_mysql.dll
extension=php_mysqli.dll 主要是这两项

phpinfo() 输出的内容有没有mysql?

不行的话,再试试这样弄 我觉得这个是最有可能的
将 1、x:\php\ext\php_mysql.dll 2、x:\php\libmysql.dll
这两个文件拷贝到c:\windows文件夹下
------解决方案--------------------
直接安装XAMPP就可以了,这个是集成的,不用自己手动配置,很方便的,不会出现这样的问题,我现在用的就是这个,而且在win7上,如果需要联系我。
------解决方案--------------------
打开php.ini 文件,开启这2项:
extension=php_mysql.dll
extension=php_mysqli.dll 
要是还不好使,直接安装XAMPP就可以了,这个是集成的,不用自己手动配置。
------解决方案--------------------
你说phpinfo()正常,上面至少要有php apache与mysql的块说明,不是有数据就是正常
mysql_connect()未定义就是mysql未关联上,你有按楼上说的解开扩展extension吗,有无重启apache
看下端口netstat -an 3306端口是否打开,未打开表明mysql未启动

集成包还是快捷便利,我也推荐集成包
xampp , phpNow 一健安装,三分钟内配好环境
前提是:你要把你已安的东西卸载了,因为端口会冲突造成影响,甚至运行失败



------解决方案--------------------
这个错误的意思是php没有找到mysql_connect该函数,但是你现在要使用这个函数,所以报错。
确认phpinfo()中有mysql模块扩展吗?如果没有,打开php.ini 文件,将这2项:
;extension=php_mysql.dll
;extension=php_mysqli.dll
修改为:
extension=php_mysql.dll
extension=php_mysqli.dll
另外
extension_dir = "C:\Program Files\ApacheDir\phpdir\ext\";
确认你自己的extension_dir路径正确,
然后重启apache看看,应该在phpinfo中有mysql的扩展
------解决方案--------------------
楼上的正解!!!!!!!1

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
PHP Dependency Injection Container: A Quick StartPHP Dependency Injection Container: A Quick StartMay 13, 2025 am 12:11 AM

APHPDependencyInjectionContainerisatoolthatmanagesclassdependencies,enhancingcodemodularity,testability,andmaintainability.Itactsasacentralhubforcreatingandinjectingdependencies,thusreducingtightcouplingandeasingunittesting.

Dependency Injection vs. Service Locator in PHPDependency Injection vs. Service Locator in PHPMay 13, 2025 am 12:10 AM

Select DependencyInjection (DI) for large applications, ServiceLocator is suitable for small projects or prototypes. 1) DI improves the testability and modularity of the code through constructor injection. 2) ServiceLocator obtains services through center registration, which is convenient but may lead to an increase in code coupling.

PHP performance optimization strategies.PHP performance optimization strategies.May 13, 2025 am 12:06 AM

PHPapplicationscanbeoptimizedforspeedandefficiencyby:1)enablingopcacheinphp.ini,2)usingpreparedstatementswithPDOfordatabasequeries,3)replacingloopswitharray_filterandarray_mapfordataprocessing,4)configuringNginxasareverseproxy,5)implementingcachingwi

PHP Email Validation: Ensuring Emails Are Sent CorrectlyPHP Email Validation: Ensuring Emails Are Sent CorrectlyMay 13, 2025 am 12:06 AM

PHPemailvalidationinvolvesthreesteps:1)Formatvalidationusingregularexpressionstochecktheemailformat;2)DNSvalidationtoensurethedomainhasavalidMXrecord;3)SMTPvalidation,themostthoroughmethod,whichchecksifthemailboxexistsbyconnectingtotheSMTPserver.Impl

How to make PHP applications fasterHow to make PHP applications fasterMay 12, 2025 am 12:12 AM

TomakePHPapplicationsfaster,followthesesteps:1)UseOpcodeCachinglikeOPcachetostoreprecompiledscriptbytecode.2)MinimizeDatabaseQueriesbyusingquerycachingandefficientindexing.3)LeveragePHP7 Featuresforbettercodeefficiency.4)ImplementCachingStrategiessuc

PHP Performance Optimization Checklist: Improve Speed NowPHP Performance Optimization Checklist: Improve Speed NowMay 12, 2025 am 12:07 AM

ToimprovePHPapplicationspeed,followthesesteps:1)EnableopcodecachingwithAPCutoreducescriptexecutiontime.2)ImplementdatabasequerycachingusingPDOtominimizedatabasehits.3)UseHTTP/2tomultiplexrequestsandreduceconnectionoverhead.4)Limitsessionusagebyclosin

PHP Dependency Injection: Improve Code TestabilityPHP Dependency Injection: Improve Code TestabilityMay 12, 2025 am 12:03 AM

Dependency injection (DI) significantly improves the testability of PHP code by explicitly transitive dependencies. 1) DI decoupling classes and specific implementations make testing and maintenance more flexible. 2) Among the three types, the constructor injects explicit expression dependencies to keep the state consistent. 3) Use DI containers to manage complex dependencies to improve code quality and development efficiency.

PHP Performance Optimization: Database Query OptimizationPHP Performance Optimization: Database Query OptimizationMay 12, 2025 am 12:02 AM

DatabasequeryoptimizationinPHPinvolvesseveralstrategiestoenhanceperformance.1)Selectonlynecessarycolumnstoreducedatatransfer.2)Useindexingtospeedupdataretrieval.3)Implementquerycachingtostoreresultsoffrequentqueries.4)Utilizepreparedstatementsforeffi

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.