Link to home
Start Free TrialLog in
Avatar of dlewis61
dlewis61Flag for United States of America

asked on

Learning PHP via Web Host-HOW?

So, I want to hone my PHP/MYSQL skills I haven't used for a while. I have a web hosting account (25 sites with this cpanel). An author of one of my PHP books says we can use PHP in a web host account. I've used phpMyAdmin for my databases in my cPanel account no worries. But I don't understand where I'd write code and run my php scripts in cPanel...?  Do I create a file structure in File Manager in cPanel?
Does any of this make sense? Please help, as I am anxious to get back in touch with my coding side :)
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Although almost all web hosting supports PHP these days, you need to verify that yours does.  You also need to get a domain name to use for one of those 25 sites because you are going to need to run your PHP programs on the web using your web browser connected to that site.

You don't use Cpanel to create and run code.  I and all the PHP programmers I know of create the code on their own computers and upload it by FTP or SFTP to the web site you want it to run on.  I use a couple of different editors.  A good code editor does colorized highlighting of different elements in your code.  HTML-Kit http://www.chami.com/ is my favorite in part because I have been using it for at least 10 years.  Notepad++ http://notepad-plus-plus.org/ is another good one.
In it's simplest terms, a PHP file is just like an HTML file. It goes on the server in your web folder and is served when the user requests it. For example, if you drop an index.php file in the root of your web package, then it will be served whenever a web visitor accesses your domain name. In the marority of cases, your PHP files will be structured just like an HTML file, and coded just like an HTML file. You then add in the PHP tags to run your server-side code.

As long as your server supports PHP (I'd be very surprised if they didn't) then you don't need to do anything else. Just FTP your files to the proper folder (your cPanel account will give you these details) and you'll have a PHP website up and running.
Avatar of dlewis61

ASKER

Thanks folks. So does this mean I need to install WAMP on my laptop, develop code locally, then FTP it up to my wordpress site??
Yes - that tends to be a very straight-forward way of doing it, and is probably the simplest way to get up and running with your own dev environment.

If you set WAMP up correctly, then you can use it to develop as many sites as you need through it's virtual hosts options. This means that you can serve a local website from any folder, and map them to local domains. For example, a site in the c:\website\website1\ could be served locally as http://dev.myfirstwebsite.com. You can then serve a completely different website, say in folder c:\my documents\new website\ with the url http://dev.funkynewwebsite.com/

With WAMP, you also get the MySQL Database Server, so you have full DB access in your local development environment
Thanks Chris. I have cPanel / Web Hosting. So I have phpmyadmin, MySql, and all that. Is there a way to link WAMP up to my databases in my Web Hosting accounts?
ASKER CERTIFIED SOLUTION
Avatar of Chris Stanyon
Chris Stanyon
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I never connect my development code directly to the live database.  I always use phpMyAdmin or some other means to transfer (and backup) my databases.