Jump to content

ajoo

Members
  • Posts

    871
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by ajoo

  1. Hi kicken, Thanks for the response. Vagrant is just to set up a VM fast everytime. Once it's installed ubuntu and apache and the required software, it's role is almost over if one wants that. So it's just a ubuntu machine on a VM now. The only thing is that I get a shared folder /vagrant which maps to /var/www. i.e any changes I make to the folder /vagrant/myproject.com/public will reflect in var/www/myproject.com/public. Other than that I can configure the VM it as I like. So yes I have a virtual host configured exactly as you have shown. I have made changes to the hosts file on windows so that I can check out / try out the website on my host machine and it's working too. Yes I can create local equivalents of domain names but that's not really the issue. There is no index.html in public folder because my project, as I wrote earlier, is in a folder called Magical. Instead of putting an index.html in the public folder, I need to put my entire project in that folder. So it becomes /vagrant/myproject.com/public/Magical and to access the index.php in this Magical folder the URL becomes - http://myproject.com/magical. - which is what is odd. What I am looking for is to make whatever changes needed and where ever so that when I type http://www.magical and that should access the index.php from the said folder and display the webpage. I hope I am able to clearly enunciate my problem. Thanks for the response and looking for some more help here. Thanks loads !
  2. ajoo

    linux command sed

    hmmm ! that's exact what I said or at least meant to say. In any case you are absolutely right. Those were my observations too. Thanks again !
  3. Hi all !! I have finally setup my ubuntu linux VM on Virtual box for web development. My document root is /vagrant/myproject.com/public. which is the same as /var/www/myproject.com/public. This is the directory structure by default if i understand correct. My project folder which contains the index.php and all other files and folders is in say a folder called Magical. Now I am supposed to place my project folder at this location: /vagrant/myproject.com/public/Magical. If I now type, http://myproject/magical in the URL, the index.php inside Magical is invoked correcty and displays the webpage. However this is rather odd and not in accordance with the manner websites are normally invoked. I would like to type, just like everyone else, http://Magical.com to invoke the index.php. That would be like placing Magical in place of myproject in the folder hierarchy so that the document root is /vagrant/Magical.com/public. That seems to go against the convention and the tutorial followed. The root folder should be below the public folder. So what should I do to rectifyy this ? Do I need to change some settings in the conf files or in the placement of my folder so that I just type http://Macical.com to invoke the index.php ? Please help clarify. Thanks all !
  4. ajoo

    linux command sed

    Hi requininx, In all cases it simply makes an exact copy of the given file. I am using "test.txt" and it creates a "test.txt," file after the command is run but makes no string substitutions. Maybe that's what the -i is there for. Ok I got it after some more tries. This works : sudo sed -i, s,the,abc,g test.txt. It saves the original file as a copy while actually modifying the orignal file with the string substitutions.. Thanks.
  5. ajoo

    linux command sed

    Hi kicken and requinix, Thanks for the reply. @kicken : Yes it was me clear that it was trying to make a replacement of sorts but the command seems not to do anything. @ requinix : No this - (with "www") - does not work either. Thanks.
  6. ajoo

    linux command sed

    Hi all ! Can someone please explain what the following command does:- sudo sed -i s,scotchbox.local,$DOMAIN,g /etc/apache2/sites-available/$DOMAIN.conf sudo sed -i s,/var/www/public,/var/www/$DOMAIN/public,g /etc/apache2/sites-available/$DOMAIN.conf I can across these commands in here. I have tried them out in the terminal as a modified example :- sudo sed -i, s,www,the,g test.txt. where test.txt has 2 lines of some text containing the word 'the' a couple of times. The command seems to do nothing. There is no change in test.txt. I cannot get any example of sed -i, s on google. In fact i cannot get a similar example of sed anywhere on google. But then i believe sed is extremely versatile and has tons of usages. Grateful for any help. Thanks all.
  7. Thank you Guru Jacques, I'll accept what you say and get back to my original VM, but just out of curiosity and a desire to learn I would be grateful if you or anyone else can shed light on my original questions ! Thanks loads !!
  8. Hi Guru Jacques ! No, I don't want to clone a VM for each site. In fact I just want to use one VM for multiple sites hosting. The cloning is to create a VM so as not to disturb anything on the VM where I have hosted one of the projects successfully. I wanted to learn how to host multiple site on a VM. Hence I cloned a VM from my existing VM state so that I could then test / try out stuff on the cloned VM. Ofocurse the cloned VM does not have any vagrant initialized folder on the host machine and hence my question. Thank you !
  9. Hi requinix, Thanks for that reply. I will try and understand that and implement it and try it out and revert. Meanwhile I have been thinking about this : When creating a VM using vagrant, a folder is created and vagrant init is used to initialize that folder. The project folders are the created Inside that folder. In case of cloning of VM, the cloned VM does not actually have any folder initialized on the host machine ? Would not that be required first after cloning before creating any project folders? If that is required then how to go about it. Thanks.
  10. Hi all ! I recently learnt a bit of vagrant to set up a VM fast and try out things with it and one of the neat things about vagrant is that it lets me keep my project folder / website folder on the host machine and make changes to it there while I can test out the project from the VM Next I wanted to try and host another site on the same VM so instead of trying it out on the same VM, I thought it would be better to create a clone of the current state of my VM and try out things there. So I made the clone but now I don't know how to change the association of the project folder to another folder on my host machine. Earlier I did that using vagrant init in the project/website folder and that was how the machine was initialised and created and the folder association was automatically made. Now here the clone is already there and pointing to the same project/website folder and I want to change this to a new folder and try and host 2 websites from there. This is the folder in the association in the original VM. vagrant ---www---myproject It is also the same in the clone. But I would like to somehow change this to say vagrant1 ----www --- MP1 | ---- MP2 I have searched the net but to no avail. Please looking to the experts for some help here. Thanks loads !!
  11. Hi requinix, Yes you are right like I found out once the xDebug worked fine. Thanks for clarifying it yet again.
  12. Hi ! I found the issue. No xDebug has no limitation. It was a a configuration issue. I did not set an IDE KEY in the DBGP config. So if I set my IDE KEY to 'ide_key' then the String appended to the end of the URL should be XDEBUG_SESSION_STRING='ide_key'. That seems to fix it. Thanks all.
  13. Hi all, I configured my localhost to work with Xdebug and then installed the plugins to work with note++. Everything worked fine and I got the sample two line program to work from the terminal as well as from a browser (chrome) by appending "?XDEBUG_SESSION_START=xyz" after the URL. It worked fine for small programs but for my multi-page application, the appended bit simply disappeared. I guess that's because of jumping to pages on menu clicks where the url is created depending upon the menu button being clicked. Code like : if(isset($_GET['menu_item'])) { $menu_item = fcheckPpage($_GET['menu_item']); switch ($menu_item) { case "menu1": require_once("/some/thing.php"); break; case "menu2": require_once("some/thingelse.php"); break; ... Then I tried the same on firefox by first installing the plugin for it which does not require any strings to be appended to the URL. That too got working but crashed each time at the very same place when it encountered the code shown above in the code box. These are the error messages that I got and It is clear that the the moment the application / program generated it's own url the link to the debugger is lost. Seems like a woeful limitation, I could try and append the XDEBUG... string to the end of each of the generated urls but that would not be a very pretty solution if that did work. If anyone has any suggestions or solutions or an alternative to this I will grateful. Thanks all.
  14. Hi all, For other beginners who may be struggling like me to install their own dev boxes on a VM. Here is what I did to finally have a VM up and running with apache2.4.7, PHP5.6 and MYSQL5.5 UBUNTU 14.04 Go to the hashicorp sitehttps://atlas.hashicorp.com I have searched for the 1404 version and 32 bit (i-386) and so the link https://atlas.hashicorp.com/bento/boxes/ubuntu-14.04-i386 from there pick up the initialization commands there : vagrant init bento/ubuntu-14.04-i386; vagrant up Executing the first command in the terminal ( I use gitbash ) : vagrant init bento/ubuntu-14.04-i386; the vagrant box is initialized. Any changes can then be made to the vagrant file and then issue the vagrant up command at the terminal to download and install the selected disk image if not already on the local system. It takes quite some time to download and install the ubuntu image disk. If the machine does not boot successfully and gives locking errors (ERROR ACCESS or sth like that) check out http://stackoverflow.com/questions/27670076/permission-denied-error-for-vagrant. I had this error and . On the windows host machine I went into C:/users/vagrant.d/data/machine-index and deleted all files there and the machine finally booted successfully. vagrant ssh into the VM now and it should work fine. I followed this: https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu to install the lamp on the ubuntu machine. INSTALL APACHE: sudo apt-get update sudo apt-get install apache2 The public ip address is given as set in the vagrantfile by the line : config.vm.network "private_network", ip: "192.168.33.10" which I had un-commented before vagrant up. browsing to this address, namely, 192.168.33.10, shows the Apache2 ubuntu default page !!!! ( Happyeeeee !!). Here I exited the VM and saved a snapshot of the machine using the command :vagrant snapshot save ubuntu14_with_apache2.4.7 Now I can safely try and install mysql and if something goes wrong, I will restore my snapshot and get to it again. INSTALL MYSQL ver 5.6 : Install using : sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql and activate using : sudo mysql_install_db The activation ended with this loooong message: To start mysqld at boot time you have to copy support-files/mysql.server to the right place for your system PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER ! To do so, start the server, then issue the following commands: /usr/bin/mysqladmin -u root password 'new-password'; /usr/bin/mysqladmin -u root -h vagrant password 'new-password' Alternatively you can run: /usr/bin/mysql_secure_installation which will also give you the option of removing the test databases and anonymous user created by default. This is strongly recommended for production servers. See the manual for more instructions. You can start the MySQL daemon with: cd /usr ; /usr/bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl; cd /usr/mysql-test ; perl mysql-test-run.pl Please report any problems at http://bugs.mysql.com/ vagrant@vagrant:~$ Continuing installation : sudo /usr/bin/mysql_secure_installation . This gives another looong list of questions the answer to most of which is “y”: Setting the root password ensures that nobody can log into the MySQL root user without the proper authorisation. You already have a root password set, so you can safely answer 'n'. Change the root password? [Y/n] n ... skipping. By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] y ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] y ... Success! access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] y - Dropping test database... ERROR 1008 (HY000) at line 1: Can't drop database 'test'; database doesn't exist ... Failed! Not critical, keep moving... - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] y ... Success! Cleaning up... All done! If you've completed all of the above steps, your MySQL installation should now be secure. Thanks for using MySQL! Going on to INSTALL PHP now. Going to try and install PHP version 5.6 from Followed this: http://stackoverflow.com/questions/40567133/cannot-add-ppa-ppaondrej-php5-5-6 ( GOOD THREAD MUST READ) . The steps are: 1. sudo add-apt-repository ppa:ondrej/php 2. sudo apt-get update 3. sudo apt-get -y install php5.6 php5.6-mcrypt php5.6-mbstring php5.6-curl php5.6-cli php5.6-mysql php5.6-gd php5.6-intl php5.6-xsl php5.6-zip AND THE INSTALLATION ENDED WITH THE FOLLOWING : Creating config file /etc/php/5.6/mods-available/dom.ini with new version Creating config file /etc/php/5.6/mods-available/simplexml.ini with new version Creating config file /etc/php/5.6/mods-available/wddx.ini with new version Creating config file /etc/php/5.6/mods-available/xml.ini with new version Creating config file /etc/php/5.6/mods-available/xmlreader.ini with new version Creating config file /etc/php/5.6/mods-available/xmlwriter.ini with new version Creating config file /etc/php/5.6/mods-available/xsl.ini with new version Setting up php5.6-xsl (5.6.30-1+deb.sury.org~trusty+1) ... Setting up php5.6-zip (5.6.30-1+deb.sury.org~trusty+1) ... Creating config file /etc/php/5.6/mods-available/zip.ini with new version Processing triggers for libc-bin (2.19-0ubuntu6.9) ... Processing triggers for libapache2-mod-php5.6 (5.6.30-1+deb.sury.org~trusty+1) ... vagrant@vagrant:~$ GIG !!!!!!! CHANGING THE ROOT DOCUMENT TO YOUR OWN PROJECT I finally changed the default RootDirectory to my own project on the host machine. I had to make changes to the following 2 files : 1. /etc/apache2/sites-available/000-default.conf changes made and lines added: #DocumentRoot /var/www/html --------------- (commented this out) DocumentRoot /vagrant/www/myProject ------------ (used this one) and added these : <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /vagrant/www/myProject> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> 2. /etc/apache2/apache2.conf. changed to <Directory /vagrant/www/> FROM <Directory /var/www/> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory> Now I can make changes to my project in its's folder (/vagrant/www/myProject) on the host windows machine and that's linked to the Document Root of the VM !!!!!!!!!!!!!!!!!!!!!!!! Thanks all !
  15. Hi Benanamen and Guru Jacques, Thanks again for the reply. Ok so I have finally made my own box, just like both of you suggested and after two long hours finally managed to get it working. The php version is still not 7.0 or 7.1 but it's 5.6.30 and i'll change that to 7 next as I am too tired to try it out now. I have apache 2.4.7 and mysql 5.5 i think. Will port the project next and get it working on the VM. Will also spin up a box with php 7 ( as Guru Jacques suggested) since I have a better hang of this now I think ! Vagrant allows me to work on my project from the host and that's a good thing as I have configured it to achieve that as well !! I have recorder all the steps in setting up the stack and will put all the details here, after some editing, tomorrow so that it may benefit someone else ! Thanks Benanaman and Guru Jacques !
  16. hmmm can I use a 64 bit linux on my 32 bit windows machine or do i need a 64 bit windows machine minimum ? I don't know about building our own image but yes we can build our own system using vagrant but the commands for different versions of apache and php and other software are confusing. For e.g. after a searching I finally found and installed a hashicorp/precise32 machine after some hit n trial. And then it gave that error of array re-direction since it did not support. I then tried installing the box boxcutter/ubuntu1604 (32-bit) but that gave error each time i tried. Then i just gave up and tried a few more to no avail. Hence I am here !! Any and all help/suggestions appreciated. Thanks all.
  17. Hi, please can you suggest a lamp stack vagrant box with those specs ( Apache 2.4 and php 7) that would fulfill my testing needs. I have been trying to install a few of them without success on my 32 bit machine but most gave errors. One even had a virus ( scotch.io ). Any help appreciated. Thanks.
  18. Thank you Requinix and Guru Jacques for the advise. Will do the needful then.
  19. Hi all, The 2nd line in this code gives an error on the ubuntu12.04 VM though it works fine on the local xampp installation. $login_attempts_query = $database_connection->query('SELECT @login_attempts'); $login_attempts = $login_attempts_query->fetch_row()[0]; $login_attempts_query->close(); specifically a syntax error due to the square bracket"[". Why should this issue an error in one and not in the other environment? is this method deprecated or is this a version issue? Here is the the apache and php detail in the VM The xampp vesrion of Apache is 2.4 and php is 5.6 Would the following be the correct code replacement for the above? ( sorry checking across the two environments is most cumbersome after a days work ) $login_attempts_query = $database_connection->query('SELECT @login_attempts'); $login_attempts = $login_attempts_query->fetch_row(); $login_attempts = $login_attempts[0]; $login_attempts_query->close(); return $login_attempts; Thanks !
  20. Hi, Thanks for the reply Beneneman and Guru Jacques, Sorry for the late response but i realized a bit late that the question had been shifted to another, more appropriate, forum !! @Guru Jacques : Assuming that I don't have a public webserver at present, How should my present setup be different from the xampp stack setup that i currently have on my local machine? I mean what do I have to do to setup a "production" like environment on my local machine? is my present xampp setup appropriate for the development environment ? It's still unclear to me what's the difference between the two environments? Is it basically security ? I was thinking that I should setup a "production" like environment on the VirtualBox VM, even if just to see what a production like environment really is. Maybe I can then try and replicate it on the public webserver as closely as possible. Amazon aws, for eg, provides a large variety of VMs to choose from if I finally decided to set it up there. If my questions sound quixotic, its simply because I have had very little experience with servers and their setups. Thanks for bearing with them - me ! @Beneneman : I have been reading vagrant. Will use it for sure. Yes it would have made life easier had i read it before and used it. This is what I would like to do !!! I'll read up more, try out some and revert. Thank you both very much.
  21. Hi all, In the last topic i started, Guru Jacques suggested (a great idea ) that I install VM VirtualBox on my machine. After , a number of hit and trials I finally managed to install xubuntu 12.04 on my machine. My machine has the following configuration : Pentium P4 2.2 GHz running Windows 7 and 4Gigs of RAM. I have allotted 1 Gig to the xubuntu and it seems a bit tardy even when the guest additions have yet to be installed. Still it's workable. Given my configuration, I would like to ask if I have chosen the correct linux flavour and the right version. There is a plethora of flavors and versions over there and I am not sure if i have picked the right one. I tried lubuntu which is said to have a smaller footprint and is supposed to be the fastest version there but it failed to start on my machine. I was about to install the XAMPP stack on top of xubuntu when I came across an article which said that the XAMPP STACK should not be installed in the production environment. This has triggered a few more questions. 1. Do specific servers have an advantage over another on a given OS ? 2. Which server should then be installed for production and development environments? I have little experience with any servers and the Apache I installed as my localhost was installed via the stack. 3. Would I have to install 2 servers or would I just need two configurations of the same server for production and development modes? (Benanamen provided a link of vagarant and I think that has something to do with this. I have not had time to check that out yet) 4. If the configurations solve the issue, then is it easy to switch between these 2 modes and how? Well that's it for the time being. I am sure there will be more as I go along this path. Thanks all !
  22. Thanks for clarifying those nagging doubts, Guru Jacques. Happy New year !
  23. HI all ! Ok so before the new year here are some real noob questions maybe after reading the replies of Mac_gyver and Guru Jacques. 1. Instead of making changes to the ini variables like error_reporting(E_ALL); in the index file or changing the variables - that will be used to set some of the ini properties - $secure = false; // Set to true if using https. $httponly = true; would it not have been better for me to make two ini files for dev. and prod. and switch between the two , since now I will have to remove, at least, all of error_reporting(E_ALL); for the production environment? 2. Is there a better way to manage these if not in the ini files ? Like for e.g, Would it be recommended to use some defines to evaluate code for production and development and place these ini variables inside of those blocks for their selective execution. Something like. define('PROD', 1); if(PROD === 1) error_reporting('E_ALL'); 3. Coming back to the custom php.ini files, I just create a php.ini in a text editor and define these variables in there and they would come into effect ? like this : custom php.ini error_reporting : on display_errors: off session.name: sec_sess_id httponly: on secure: off 4. And where should I place this php.ini file which would be local to the project? in the root - or outside the root? Thanks loads & a Happy new year to all !!
  24. Thanks Guru Jacques, That really makes it so much clearer !! hmm , yes I will have to scan the project for these, at least once, and find them, I will do that and revert in case I run into some issue regarding these. Thanks loads and a Merry Christmas to you and all on the forum !
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.