SusieWoosey Posted September 16, 2006 Share Posted September 16, 2006 I want to run a local PHP so I can edit my .php files without having to upload to my website all the time.MYsql would be nice too, but first things first.Do I need Apache server on my PC for PHP and MYsql to run? How do I tell my PC that PHP is there, so I can see .php files on my PC, without resorting to uploading them to my webspace?Appreciate any help.Suzanne (sallyjowoods@hotmail.com) Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted September 17, 2006 Share Posted September 17, 2006 Yes you need to install Apache to run your PHP scripts on your PC locally. MySQL doesn't need Apache. MySQL is database server. Apache is a web server.Installing Apache is rather easy. Make sure you download the msi package and download Apache2.0.x (don't download Apache2.2.x). When you run the Apache installer it'll ask you for a couple of details which are Network Domain ,Server Name and Administrator's Email AddressFor the Network Domain and Server Name just enter localhost into the two boxes. Then just add a false email addy into the Admins Email Address eg (admin@localhost). When it ask you where to install Apache to, install it in the root of your hard drive in a folder called server, so click the browse button when it asks for installation directory, type in C:\server, the server folder will be created if it doesn't exists, also change C: to the letter of your hard drive. Now go through the rest of the installation process.Once Apache is installed, fire up a web browser and type in http://localhost or http://127.0.0.1The above addresses are local addresses, that only you can access. No one from the web/out side of your network can access those addresses. You should get the Apache welcome message when you go to either of the above addresses.Now to install PHP, you'll need to go to php.net and download PHP5. Make sure you download the zipped binaries and NOT the INSTALLER. Once you have downloaded PHP. Extract the contents of the zip file to C:\server\PHP\Once you have extracted the contents of the ZIP. PHP is installed! However you must now configure Apache to parse any PHP files with the PHP Interpreter. To do so go to C:\server\Apache2\conf and open up httpd.conf for editing.Now look for the following:[code]#LoadModule ssl_module modules/mod_ssl.so[/code]Add the following after the above:[code]LoadModule php5_module "C:/server/php/php5apache2.dll"#PHPIniDirPHPIniDir "C:/WINDOWS"[/code]Now scroll down further to find the following:[code]AddType application/x-gzip .gz .tgz[/code]Now add the following after the above:[code]AddType application/x-httpd-php .php[/code]Save the httpd.conf file! What you need to do now is go to C:\server\php and find the following files:libmysql.dllphp5ts.dllphp.ini-recommendedCopy the above three files to the WINDOWS folder (C:WINDOWS\). Once you have done so. Rename php.ini-recommended to just php.iniNow you have setup Apache to parse the PHP files with the PHP Interpreter. All you need to do now is restart Apache. To do so go to Start > Program Files > Apache HTTP Server 2.0.x > Control Apache Server > RestartIf everything goes to plan. Apache should restart without any beeps/errors popping up. If no beeps/errors come up then Apache and PHP are installed. To test go to C:\server\Apache2\htdocs\ create a new file called test.php, edit this new file and add the following code to it:[code=php:0]<?phpphpinfo();?>[/code]Save test.php. Now open up your browser again and go to http://localhost/test.phpWhen you go to that address you should get a page full of information about PHP and your server. If you do then Apache and PHP are successfully installed.All you need to do now is install MySQL, which is easy as its just a step through installer. Make sure when you go to install MySQL you install it in the server folder (NOTE: You'll need to choose the custom install option to do this).When MySQL is installed you'll need to enable the MySQL extension for PHP to use in order for you to use PHP with MySQL. You can do this by reading [url=http://www.phpfreaks.com/forums/index.php/topic,95378.0.html]this thread[/url].Hope that helps. Quote Link to comment Share on other sites More sharing options...
SusieWoosey Posted September 20, 2006 Author Share Posted September 20, 2006 Thanks for the help wildteen, I had already downloaded PHP 4.xxxxx so I shall have to go look for php5. Since posting I have been able to get Apache to run without giving me errors, so I must be doing something right.Will look for php5, and out your help into practice.Will let you know how I get on.Thanks for replyingSuzanne. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted September 20, 2006 Share Posted September 20, 2006 PHP4 is okay. Its up to which version of PHP to start of with. if you use PHP4 you just need to adapt the Apache configuration slightly. Quote Link to comment Share on other sites More sharing options...
SusieWoosey Posted October 21, 2006 Author Share Posted October 21, 2006 Hi wildteen,Not sure if you'll read this, it's been a while since my first posting, I've been hopistalised since then, so not done much PC work.Today (21st October) I successfully installed Apache 2.0.59 and PHP5.1.6Thanks for your help, it went smoothly except for notepad naming my testfile as test.php.txt it took me a while to figure that out :DNow for MySQL.Thanks for your help.SusieWoosey Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted October 21, 2006 Share Posted October 21, 2006 MySQL is easy to install just download the installer from mysql.com and follow the onscreen instructions. Quote Link to comment Share on other sites More sharing options...
SusieWoosey Posted October 22, 2006 Author Share Posted October 22, 2006 Hmm, well I guess my euphoria was short lived.Seems today it now won't/doesn't want to work.I get this error when I try to start it - Only one usage of each socket address (protocol/network address/port) is normally permitted. : make_sock could not bind to address 0.0.0.0:80 no listening sockets available.What have I done wrong or what have I not done?Any ideas?Suzanne. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted October 23, 2006 Share Posted October 23, 2006 Whats repoting that error? Apache? If its MYSQL it should be running on port 3306. POrt 80 can only be used once. It cannot be shared with other TCP/IP apps. Quote Link to comment Share on other sites More sharing options...
SusieWoosey Posted October 24, 2006 Author Share Posted October 24, 2006 I think it's Apache. It appears to only do it when I close Apache Server down, and restart it. (I think). Anyway Apache seems to be OK now, I get good local .php pages, so my objective of seeing them before committing them to a live website has been achieved.I've installed MySQL, all seems OK. I cannot use it from that command line client though. Suggestions?Suzanne Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted October 24, 2006 Share Posted October 24, 2006 To use MYSQL via commad line you need to change directory to the MySQL bin directory. You do something like this:[code]cd C:\mysql\bin\[/code]Then you can type mysql -u root and it should log you in to MySQL. If its doesnt then you'll need to add the -p paramter to it and then provide the password for the root user. If you dont get any think from the command then make sure MySQL is running, check your processes (Ctrl+Alt+Del click processes tab). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.