Running PHP and MySQL with XAMPP in Ubuntu (laravel) - php

I'm quite new to Linux and still trying to adapt my self. I've setup my working environment all good, installed XAMPP, node, sublime, etc. But when I tried running a laravel app, the first thing that caught me was I couldn't run php.
I was confused because i had already installed XAMPP (which i thought would've done it all for me), but then I simply created a symlink in my /usr/bin to the /opt/lampp/bin/php and it all worked well (I'm not sure if that was all correct, but it worked).
Then when I tried opening the app in my browser, it couldn't find the sql driver, so I asked my self, what exactly am I doing wrong? XAMPP should have taken care of all those things (as its name suggests), but it didn't setup php and mysql as i thought it would.
Am I missing something here? Should I install MySQL driver and PHP apart from XAMPP? Because that makes no sense at all for me. I really need some basic guidance here about this whole thing, what makes it so different from Windows where I simply install XAMPP and start programming?
I need to understand that so I can have a better understanding of the system it self and fix these kind of problems my self in the future.
PS: I'm using Ubuntu 16.04 and instaled XAMPP with PHP 7.0, downloaded from official website.
Thanks everyone!

I never used xampp on linux myself so i dont know how does it work here but I can tell you what really got me good start at understanding of linux was installing whole LAMP stack myself. So i would recommend googling 'How To Install LAMP' and try to figure it out from countless tutorials.
Basically you install apache, then mysql and php, restart server and check if 'It works'.

try two things
In the folder /etc/php/php.ini
uncheck the line extension=pdo_mysql.so
or in the folder of lampp (/opt/lampp/etc/php.ini)
And to start Laravel you need start with ~/php artisan serve
in the browser localhost:8000

Related

Can you download and use XAMPP with WSL2?

I need to pick up PHP, but haven't installed it yet. I'm following a tutorial for building something with the LAMP stack and they've recommended installing XAMPP. I have a windows laptop, and I run WSL2 on it. I'm curious whether it's possible to download and use XAMPP with WSL2 (using the linux download?) or whether WSL2 precludes me from using XAMPP and I should figure out how to manually install apache, mysql, and php?
I've googled a bunch and haven't gotten any clear answer to whether I can use the xampp ubuntu download or not. The answer probably involves some higher level IT conceptual knowledge that I don't understand. Any guidance on how to proceed would be appreciated!

Do I still need XAMP with php version 5.6

I am returning to php after a long time (although I have a very basic understanding of php in general), and understand that I can run a php server locally by running the command now with version 5.6:
php -S localhost:8080
Do I still need to install XAMP or WAMP as many of the online tutorials are suggesting or am I okay to just use the above command?
Note: I have postgresql installed on my computer already and do not use mysql, if that matters at all
You need a webserver which you prefer depends on you. XAMPP is the most used for private but you could also take a look at BigApache, EasyPHP, PHPTriad, MampServer, WampServer.
Xampp is a combination of below
Apache server
Mysql server
PHP
and others.
This is a pretty famous and most used package. But if you want to install everything manually then thats even better you can control your server in any way you want. Go for it and you will learn more about it.
If you want a very flexible development environment you need to use a package like EasyPHP Devserver (http://www.easyphp.org/) or equivalent.

MAC OSX Php Developmet. XAMP vs MAMP vs Entropy.ch (Marc Liyanage)

I do Php and MySQL development on a small scale on my Mac. When first researching it all a few years back, I came across Marc Liyanage's Apache build (entropy.ch). Since that's all I knew, I installed it and have been using it ever since.
I hear a lot about XAMP and MAMP these days. Now I'm not a Linux guy really. I can get around the terminal, and use MySQL via the terminal, but I'm not too UNIX savy in general. I find that I'm stumped when I have to install packages for Apache / Php via the command line.
My question is: is the interface / installation / maintenance in XAMP / MAMP simpler or more intuitive, than the entropy.ch build? (As in, more interfaces and less UNIX code to build things)?
How about any other differences?
I can't say I've ever seen or used Marc Liyanage's Apache build, but can attest that both XAMPP and MAMP are extremely easy to install and use and neither require any command line commands to setup.
I use XAMPP daily, and tried MAMP for a while but saw nothing better or worse about it so just kept using XAMPP. If you find yourself needing to extend Apache and install additional modules then you might need the command line to do so, but I've never needed to.
The only frustration I've ever had with either is default location for site files being with the application folder. It's not too difficult to change or work around, but it's annoying if you're used to having them in the sites folder.
XAMPP and MAMP are pretty well self contained and neither should affect your existing setup if oyu give them a test drive.
I have found MAMP to be simpler and more intuitive. XAMPP is almost exactly the same, but it doesn't seem as "mac"-like.
I have never even heard of entropy.ch so I can not comment on the differences, but if you havent tried MAMP yet you should take a look. Its incredibly easy.

Using Mamp or another package vs manually enabling PHP and installing MySQL on Mac 10.6

What are the benefits of installing mamp or another package vs enabling php in httpd.conf and manually installing mysql? I am really not sure of which option is better and would love some info.
Thanks,
MAMP and other packages are usually pre-configured and come with other tools like phpMyAdmin, SQLite Manager, SSL, code optimizers. If you think you're handy enough to do what others have done, go ahead. But it'll save you a lot of time and trouble by grabbing what's already available.
I've used MAMP for over two years now and I love it.
For me, I didn't want to configure PHP and MySQL with Apache. On my old computer I installed MySQL and then phpMyAdmin and had a lot of fun trying to get it all working. (But I'm not good with terminal and bash commands)
I installed MAMP on my new computer just because it does all the work for me. When I want to debug a php script, I just fire up my local server and make a few changes.
Imo, MAMP/WAMP = Easy get up and go in a development environment.
If you are running a business critical app, you may be better off with a LAMP stack

Best PHP download to keep all my options open?

In the past, I used WAMPserver on windows to parse PHP for me. This is a pre-configured package, focussed on working with MySQL.
When I tried to run PostgreSQL, I got error messages that said that my version of PHP wasn't compiled to work with PostgreSQL.
So, I've recently uninstalled WAMP and every associated with it. I've downloaded Apache 2.2.11 with openSSL, installed as admin(you know, run the command prompt as administrator, cd to the directory where the download was done and have it executed, so the install was done as admin).
That's that. I now have Apache installed, "it works" shows up, so I'm that far.
Now I'm wondering, do I download the exe and install, or the zip, or something else.
What is the best thing to do to make sure that the PHP on my system can handle everything I can ever throw at it?
Also, PHP first, or MySQL/Postgre first.
And lastly, what about PEAR? I need PEAR installed, which isn't standard on Windows. I'm guessing the pear.bat file in the PHP downloads will do that for me?
EDIT: I see one close vote, yet no comment as to why. It makes me wonder how people who are so lazy and rude got to have somany points.
I would recommend downloading the zip package, as configuring php is not really that difficult, and it allows you to add features as needed.
As for whether first to install php or MySQL/PostgreSQL, - it does not really matter. You can install them in any order.
Your guess regarding PEAR is quite correct
i haven't used wamp before, so i can't comment on that
i do however use xampp which sounds very similar
in xampp if i want to enable postgres support i edit the php.ini file and uncomment the postgres section of the ini file, same with any of the extensions that i need
perhaps this might be an alternative you can try if you get stuck
There are many ways to setup a HTTP server/PHP/database machine. Sometimes the behaviour of your development setup will differ from the live server's.
I would recommend finding out the setup your web host is using, then getting a vmware appliance image that fits that as close as possible and get any additional software using it's package manager (which is easier that installing stuff on Windows).
Setup a file sharing link between the VM and the host, make sure you can view the VM's port 80 in a browser running in your host OS and you're set.

Categories