cancel
Showing results for 
Search instead for 
Did you mean: 

Advice on PHP5 + MySQL4

dbriggs1950
Dabbler
Posts: 22
Thanks: 1
Registered: ‎16-04-2007

Advice on PHP5 + MySQL4

As a PHP/MySQL newbie, I have got myself on the technical review panel for a new book on PHP and MySQL. I have just run into a problem - the sample code in the book requires PHP5 and MySQL4. PlusNet doesn't support PHP5 yet. So, I would be grateful for any suggestions as to how I can:-
1 - Convert those pesky mysqli_* function calls into something that will run on PHP4 in my PlusNet webspace
or
2 - Get a PHP5+MySQL4 setup running elsewhere (I have a bunch of PCs running XP, 2K, though no Servers, even a Vista Ultimate VMware virtual machine). I don't really want to spend any more cash on service providers...
Thanks for any suggestions,
David
11 REPLIES 11
Strat
Community Veteran
Posts: 31,320
Thanks: 1,609
Fixes: 565
Registered: ‎14-04-2007

Re: Advice on PHP5 + MySQL4

Maybe it's on it's way David...fingers crossed Smiley
http://community.plus.net/forum/index.php/topic,67441.0.html
Windows 10 Firefox 109.0 (64-bit)
To argue with someone who has renounced the use of reason is like administering medicine to the dead - Thomas Paine
samuria
Grafter
Posts: 1,581
Thanks: 3
Registered: ‎13-04-2007

Re: Advice on PHP5 + MySQL4

You can install php and mysql on your own pc it doesnt take up much room or memory or you can run it on a virtual pc. You need a webserver for which you can use IIS or any free server.
There are plenty of free host that offer the service if you want to try it on the web
IanQ
Grafter
Posts: 26
Registered: ‎06-06-2008

Re: Advice on PHP5 + MySQL4

If you are running XP download the free Xampp from http://www.apachefriends.org/en/xampp.html
This installs the Apache webserver, MySQL and PHP5 on your pc. You can then try your web site and php scripts on your own pc which saves uploading them to your webspace to try them. It also has the option to switch to PHP 4 if you want.
dbriggs1950
Dabbler
Posts: 22
Thanks: 1
Registered: ‎16-04-2007

Re: Advice on PHP5 + MySQL4

Thanks to everyone for those rapid replies. Obviously, I wasn't the last to go to bed last night!
I had thought about using a mysqli_* to mysql_* shim, but haven't found any of those yet. This approach would require continuous maintenance as I work through the sample code in the book, of course. On the other hand, looking through the notes on the mysql web site, it seems that the mysqli interface isn't included in PHP5 but is an optional extra, so a site offering PHP5 might not support it anyway.
I'm inclined to go for an option that doesn't require much setting up or running on my part. I find the thought of IIS a bit scary! Doesn't that require a Server machine?
Thanks again,
David
IanQ
Grafter
Posts: 26
Registered: ‎06-06-2008

Re: Advice on PHP5 + MySQL4

Xampp is fairly easy to setup, the install package does most of it for you and it installs all you need in one go. It even has an option to run it from a USB stick or directory on your hard drive without it installing any files elsewhere or making registry entries. Uninstalling it is then simply a matter of deleting the directory.
It does not use IIS, it uses Apache.  It installs as a local server on your existing XP pc, no extra hardware or software is needed and no internet connection is needed if you only want to try the web pages and php scripts locally. If you want to access it from the internet or let other people access it then it can be set up as a webserver if you allow the correct port forwarding in your firewall, but it also needs more configuring to make it secure which is more complicated. As your original post seemed to imply that you only needed a way of testing your php scripts installing it for local use is a very quick and free way of achieving your aim.
dbriggs1950
Dabbler
Posts: 22
Thanks: 1
Registered: ‎16-04-2007

Re: Advice on PHP5 + MySQL4

Thanks Ian, I'll take a look at it.
David
Prod_Man
Grafter
Posts: 287
Registered: ‎04-08-2007

Re: Advice on PHP5 + MySQL4

Well ...
XXAMP will do the job for most peoples needs,
But there is no harm in trying a manual Setup of Apache/IIS w/ PHP + Modules and MySQL.
Else, you'll become detached from the Setup Process to know what is good and bad Security Practice in the long run.
All the PHP Modules are Optional Extra DLL / SO Modules which extend the PHP Core.
The difference between MySQL and MySQLi is practially neglegable in everything I've needed to do with MySQL.
Learning to code for Compatability (aka: old hat) will widen your skills anyway.
MySQLi is just Class Oriented [and Uglier] version of the original MySQL Functions if you ask me.
I would peronsally only use MySQLi, if you really have a reason for utilising the Class Structures for new functionality.
As there is no new functionality of use, I see no reason (Personally) moving to Bloated Classes,
when you can utilise a perfectly good and working older set of Functions that do practially everything the same.
@IanQ:
Apache doesn't require Registry Entries anyway if you don;t use the installer,
it has configuration Files for most things it needs.
All paths can be done relative to the Location of Apache to allow PHP to Function anyway.
PHP just needs the configuration INI to be configured, Necessary Extensions
and any Binaries which you may require for Command Line usage...
As for MySQL, it's again just a case of modifying Configuration Files to work with the setup.
The way you worded your last post,
almost makes it sound as if IIS doesn't allow you to execute pages Locally.
(I know you don't mean it that way :))
But, as it happens that is practially true anyway,
it's 1000x slower than Apache,
even IIS is slow with it's more native ASP Language as well...
Just my 50 pence...
Jim,
IanQ
Grafter
Posts: 26
Registered: ‎06-06-2008

Re: Advice on PHP5 + MySQL4

Prodman
I don't have much experience with Apache, IIS, PHP or MySQL.
I just needed a quick way of testing websites locally and after searching for information on how to achieve it I tried using Apache and IIS.
IIS seemed very involved to get working, ran very slow and as it is Microsoft it probably has all sorts of issues, compatibility problems and security holes etc.  Smiley

Apache was a nightmare to configure, probably just my lack of knowledge.  Undecided
Then I found Xampp which had everything in one package ready to go and was simple to install and configure.
Xampp does warn you about security issues but as I was only using it locally it is not a problem for me. So far it does what I need without having to spend ages reading help files to configure it all. I am sure that there are disadvantages to it if used differently but it saved me a lot of time and effort.
Ian

dbriggs1950
Dabbler
Posts: 22
Thanks: 1
Registered: ‎16-04-2007

Re: Advice on PHP5 + MySQL4

I have now downloaded XAMPPLite and "installed" it (i.e. unpacked the ZIP file!) on my Windows 2000 Pro workstation. This is where I'm writing the PHP code, so it's very convenient. I haven't finished setting MySQL up yet, but everything else just ran first time.
Thanks for the suggestions.
David
IanQ
Grafter
Posts: 26
Registered: ‎06-06-2008

Re: Advice on PHP5 + MySQL4

David
Glad to hear that you found Xampp useful.
2 things that caught me out and that you may find helpful.
If you are using a rewrite rule in the.htacess file you need to modify the Apache\conf\httpd.conf file to load the rewrite module as by default it is commented out. If you have been used to using a hosted service this may not occur to you and the rewrite rule then does not work! It took me a while to realise why.  Undecided
This also applies if you need to use any other modules that are not loaded by default. The ini file is fully commented to explain the settings.
Also if you follow the Xampp security tips and assign a password to the MySQL database you need to use the Xampp Control Panel, MySQL, Admin button to call up WinMySQLAdmin and then edit the ini and add your password.

Ian
dbriggs1950
Dabbler
Posts: 22
Thanks: 1
Registered: ‎16-04-2007

Re: Advice on PHP5 + MySQL4

IanQ wrote:
Quote
If you are using a rewrite rule in the.htacess file you need to modify the Apache\conf\httpd.conf file to load the rewrite module as by default it is commented out.

Sorry, that's (almost) complete gobblydegook to me (at present). Hopefully it will mean something in the future!
Quote
This also applies if you need to use any other modules that are not loaded by default.

That was the case with the mcrypt DLLs. I had a warning that mcrypt was not loading. I'm not using it yet, but with a bit of help from your message, I found (the correct version of) php.ini and made the necessary corrections.
I had to sort out some interference as that PC had FrontPage installed on it, so there were programs (services) using most of the ports (e.g. 21, 80) that XAMPP needed. I'm not using FrontPage, so I've sorted them out by changing those services from auto- to manual-start. I was able to get mail sending working, so one of the test programs, which sends e-mails to an HTML+PHP-maintained mailing list, actually works! That is a whole lot safer to have locally inside my firewall than outside, where a spammer might find it...
Thanks for the helpful suggestions.
David